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

Diff for /mandoc/roff.c between version 1.132 and 1.133

version 1.132, 2011/04/13 09:57:41 version 1.133, 2011/04/13 10:01:27
Line 277  roffnode_pop(struct roff *r)
Line 277  roffnode_pop(struct roff *r)
         assert(r->last);          assert(r->last);
         p = r->last;          p = r->last;
   
           if (ROFF_el == p->tok)
                   if (r->rstackpos > -1)
                           r->rstackpos--;
   
         r->last = r->last->parent;          r->last = r->last->parent;
         free(p->name);          free(p->name);
         free(p->end);          free(p->end);
Line 972  roff_cond(ROFF_ARGS)
Line 976  roff_cond(ROFF_ARGS)
         int              sv;          int              sv;
         enum roffrule    rule;          enum roffrule    rule;
   
         /*          /* Stack overflow! */
          * An `.el' has no conditional body: it will consume the value  
          * of the current rstack entry set in prior `ie' calls or  
          * defaults to DENY.  
          *  
          * If we're not an `el', however, then evaluate the conditional.  
          */  
   
         rule = ROFF_el == tok ?          if (ROFF_ie == tok && r->rstackpos == RSTACK_MAX - 1) {
                 (r->rstackpos < 0 ?                  mandoc_msg(MANDOCERR_MEM, r->parse, ln, ppos, NULL);
                  ROFFRULE_DENY : r->rstack[r->rstackpos--]) :                  return(ROFF_ERR);
                 roff_evalcond(*bufp, &pos);          }
   
           /* First, evaluate the conditional. */
   
           if (ROFF_el == tok) {
                   /*
                    * An `.el' will get the value of the current rstack
                    * entry set in prior `ie' calls or defaults to DENY.
                    */
                   if (r->rstackpos < 0)
                           rule = ROFFRULE_DENY;
                   else
                           rule = r->rstack[r->rstackpos];
           } else
                   rule = roff_evalcond(*bufp, &pos);
   
         sv = pos;          sv = pos;
   
         while (' ' == (*bufp)[pos])          while (' ' == (*bufp)[pos])
                 pos++;                  pos++;
   
Line 1005  roff_cond(ROFF_ARGS)
Line 1018  roff_cond(ROFF_ARGS)
   
         r->last->rule = rule;          r->last->rule = rule;
   
         /*  
          * An if-else will put the NEGATION of the current evaluated  
          * conditional into the stack of rules.  
          */  
   
         if (ROFF_ie == tok) {          if (ROFF_ie == tok) {
                 if (r->rstackpos == RSTACK_MAX - 1) {                  /*
                         mandoc_msg(MANDOCERR_MEM,                   * An if-else will put the NEGATION of the current
                                 r->parse, ln, ppos, NULL);                   * evaluated conditional into the stack.
                         return(ROFF_ERR);                   */
                 }                  r->rstackpos++;
                 r->rstack[++r->rstackpos] =                  if (ROFFRULE_DENY == r->last->rule)
                         ROFFRULE_DENY == r->last->rule ?                          r->rstack[r->rstackpos] = ROFFRULE_ALLOW;
                         ROFFRULE_ALLOW : ROFFRULE_DENY;                  else
                           r->rstack[r->rstackpos] = ROFFRULE_DENY;
         }          }
   
         /* If the parent has false as its rule, then so do we. */          /* If the parent has false as its rule, then so do we. */

Legend:
Removed from v.1.132  
changed lines
  Added in v.1.133

CVSweb