[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.46 and 1.47

version 1.46, 2010/03/30 08:24:01 version 1.47, 2010/03/31 07:13:53
Line 42  static int   blk_exp_close(MACRO_PROT_ARGS);
Line 42  static int   blk_exp_close(MACRO_PROT_ARGS);
 static  int       blk_part_imp(MACRO_PROT_ARGS);  static  int       blk_part_imp(MACRO_PROT_ARGS);
   
 static  int       phrase(struct mdoc *, int, int, char *);  static  int       phrase(struct mdoc *, int, int, char *);
 static  int       rew_dohalt(int, enum mdoc_type,  static  int       rew_dohalt(enum mdoct, enum mdoc_type,
                         const struct mdoc_node *);                          const struct mdoc_node *);
 static  int       rew_alt(int);  static  enum mdoct rew_alt(enum mdoct);
 static  int       rew_dobreak(int, const struct mdoc_node *);  static  int       rew_dobreak(enum mdoct, const struct mdoc_node *);
 static  int       rew_elem(struct mdoc *, int);  static  int       rew_elem(struct mdoc *, enum mdoct);
 static  int       rew_sub(enum mdoc_type, struct mdoc *,  static  int       rew_sub(enum mdoc_type, struct mdoc *,
                         int, int, int);                          enum mdoct, int, int);
 static  int       rew_last(struct mdoc *,  static  int       rew_last(struct mdoc *,
                         const struct mdoc_node *);                          const struct mdoc_node *);
 static  int       append_delims(struct mdoc *, int, int *, char *);  static  int       append_delims(struct mdoc *, int, int *, char *);
Line 318  rew_last(struct mdoc *mdoc, const struct mdoc_node *to
Line 318  rew_last(struct mdoc *mdoc, const struct mdoc_node *to
  * Return the opening macro of a closing one, e.g., `Ec' has `Eo' as its   * Return the opening macro of a closing one, e.g., `Ec' has `Eo' as its
  * matching pair.   * matching pair.
  */   */
 static int  static enum mdoct
 rew_alt(int tok)  rew_alt(enum mdoct tok)
 {  {
         switch (tok) {          switch (tok) {
         case (MDOC_Ac):          case (MDOC_Ac):
Line 369  rew_alt(int tok)
Line 369  rew_alt(int tok)
  * The scope-closing and so on occurs in the various rew_* routines.   * The scope-closing and so on occurs in the various rew_* routines.
  */   */
 static int  static int
 rew_dohalt(int tok, enum mdoc_type type, const struct mdoc_node *p)  rew_dohalt(enum mdoct tok, enum mdoc_type type,
                   const struct mdoc_node *p)
 {  {
   
         if (MDOC_ROOT == p->type)          if (MDOC_ROOT == p->type)
Line 508  rew_dohalt(int tok, enum mdoc_type type, const struct 
Line 509  rew_dohalt(int tok, enum mdoc_type type, const struct 
  * REWIND_NOHALT).   * REWIND_NOHALT).
  */   */
 static int  static int
 rew_dobreak(int tok, const struct mdoc_node *p)  rew_dobreak(enum mdoct tok, const struct mdoc_node *p)
 {  {
   
         assert(MDOC_ROOT != p->type);          assert(MDOC_ROOT != p->type);
Line 537  rew_dobreak(int tok, const struct mdoc_node *p)
Line 538  rew_dobreak(int tok, const struct mdoc_node *p)
                         return(1);                          return(1);
                 break;                  break;
         case (MDOC_Oc):          case (MDOC_Oc):
                 /* XXX - experimental! */  #ifdef UGLY
                 if (MDOC_Op == p->tok)                  if (MDOC_Op == p->tok)
                         return(1);                          return(1);
   #endif
                 break;                  break;
         default:          default:
                 break;                  break;
Line 555  rew_dobreak(int tok, const struct mdoc_node *p)
Line 557  rew_dobreak(int tok, const struct mdoc_node *p)
   
   
 static int  static int
 rew_elem(struct mdoc *mdoc, int tok)  rew_elem(struct mdoc *mdoc, enum mdoct tok)
 {  {
         struct mdoc_node *n;          struct mdoc_node *n;
   
Line 571  rew_elem(struct mdoc *mdoc, int tok)
Line 573  rew_elem(struct mdoc *mdoc, int tok)
   
 static int  static int
 rew_sub(enum mdoc_type t, struct mdoc *m,  rew_sub(enum mdoc_type t, struct mdoc *m,
                 int tok, int line, int ppos)                  enum mdoct tok, int line, int ppos)
 {  {
         struct mdoc_node *n;          struct mdoc_node *n;
         int               c;          int               c;
Line 595  rew_sub(enum mdoc_type t, struct mdoc *m, 
Line 597  rew_sub(enum mdoc_type t, struct mdoc *m, 
         }          }
   
         assert(n);          assert(n);
         return(rew_last(m, n));          if ( ! rew_last(m, n))
                   return(0);
   
   #ifdef  UGLY
           /*
            * The current block extends an enclosing block beyond a line
            * break.  Now that the current block ends, close the enclosing
            * block, too.
            */
           if (NULL != (n = n->pending)) {
                   assert(MDOC_HEAD == n->type);
                   if ( ! rew_last(m, n))
                           return(0);
                   if ( ! mdoc_body_alloc(m, n->line, n->pos, n->tok))
                           return(0);
           }
   #endif
   
           return(1);
 }  }
   
   
Line 861  blk_full(MACRO_PROT_ARGS)
Line 881  blk_full(MACRO_PROT_ARGS)
         int               c, la;          int               c, la;
         struct mdoc_arg  *arg;          struct mdoc_arg  *arg;
         struct mdoc_node *head; /* save of head macro */          struct mdoc_node *head; /* save of head macro */
           struct mdoc_node *n;
         char             *p;          char             *p;
   
         /* Close out prior implicit scope. */          /* Close out prior implicit scope. */
Line 978  blk_full(MACRO_PROT_ARGS)
Line 999  blk_full(MACRO_PROT_ARGS)
         if (MDOC_Nd == tok)          if (MDOC_Nd == tok)
                 return(1);                  return(1);
   
   #ifdef  UGLY
           /*
            * If there is an open sub-block requiring explicit close-out,
            * postpone switching the current block from head to body until
            * the rew_sub() call closing out that sub-block.
            */
           for (n = m->last; n && n != head; n = n->parent) {
                   if (MDOC_EXPLICIT & mdoc_macros[n->tok].flags &&
                                   MDOC_BLOCK == n->type) {
                           n->pending = head;
                           return(1);
                   }
           }
   #endif
   
         /* Close out scopes to remain in a consistent state. */          /* Close out scopes to remain in a consistent state. */
   
         if ( ! rew_sub(MDOC_HEAD, m, tok, line, ppos))          if ( ! rew_sub(MDOC_HEAD, m, tok, line, ppos))
Line 1066  blk_part_imp(MACRO_PROT_ARGS)
Line 1102  blk_part_imp(MACRO_PROT_ARGS)
                 body = m->last;                  body = m->last;
         }          }
   
   #ifdef  UGLY
         /*          /*
          * If we can't rewind to our body, then our scope has already           * If we can't rewind to our body, then our scope has already
          * been closed by another macro (like `Oc' closing `Op').  This           * been closed by another macro (like `Oc' closing `Op').  This
          * is ugly behaviour nodding its head to OpenBSD's overwhelming           * is ugly behaviour nodding its head to OpenBSD's overwhelming
          * crufty use of `Op' breakage.  XXX: DEPRECATE.           * crufty use of `Op' breakage.
          */           */
   
         for (n = m->last; n; n = n->parent)          for (n = m->last; n; n = n->parent)
                 if (body == n)                  if (body == n)
                         break;                          break;
   #endif
   
         if (NULL == n && ! mdoc_nwarn(m, body, EIMPBRK))          if (NULL == n && ! mdoc_nwarn(m, body, EIMPBRK))
                 return(0);                  return(0);

Legend:
Removed from v.1.46  
changed lines
  Added in v.1.47

CVSweb