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

Diff for /mandoc/roff.c between version 1.229 and 1.230

version 1.229, 2014/09/07 00:21:53 version 1.230, 2014/10/16 01:11:20
Line 120  struct roff {
Line 120  struct roff {
         struct eqn_node *last_eqn; /* last equation parsed */          struct eqn_node *last_eqn; /* last equation parsed */
         struct eqn_node *first_eqn; /* first equation parsed */          struct eqn_node *first_eqn; /* first equation parsed */
         struct eqn_node *eqn; /* current equation being parsed */          struct eqn_node *eqn; /* current equation being parsed */
           int              eqn_inline; /* current equation is inline */
         int              options; /* parse options */          int              options; /* parse options */
         int              rstacksz; /* current size limit of rstack */          int              rstacksz; /* current size limit of rstack */
         int              rstackpos; /* position in rstack */          int              rstackpos; /* position in rstack */
Line 183  static enum rofferr  roff_cond(ROFF_ARGS);
Line 184  static enum rofferr  roff_cond(ROFF_ARGS);
 static  enum rofferr     roff_cond_text(ROFF_ARGS);  static  enum rofferr     roff_cond_text(ROFF_ARGS);
 static  enum rofferr     roff_cond_sub(ROFF_ARGS);  static  enum rofferr     roff_cond_sub(ROFF_ARGS);
 static  enum rofferr     roff_ds(ROFF_ARGS);  static  enum rofferr     roff_ds(ROFF_ARGS);
   static  enum rofferr     roff_eqndelim(struct roff *,
                                   char **, size_t *, int);
 static  int              roff_evalcond(const char *, int *);  static  int              roff_evalcond(const char *, int *);
 static  int              roff_evalnum(const char *, int *, int *, int);  static  int              roff_evalnum(const char *, int *, int *, int);
 static  int              roff_evalpar(const char *, int *, int *);  static  int              roff_evalpar(const char *, int *, int *);
Line 724  roff_parseln(struct roff *r, int ln, char **bufp,
Line 727  roff_parseln(struct roff *r, int ln, char **bufp,
         enum rofferr     e;          enum rofferr     e;
         int              ppos, ctl;          int              ppos, ctl;
   
         /*          /* Handle in-line equation delimiters. */
          * Run the reserved-word filter only if we have some reserved  
          * words to fill in.  
          */  
   
           if (r->last_eqn != NULL && r->last_eqn->delim &&
               (r->eqn == NULL || r->eqn_inline)) {
                   e = roff_eqndelim(r, bufp, szp, pos);
                   if (e == ROFF_REPARSE)
                           return(e);
                   assert(e == ROFF_CONT);
           }
   
           /* Expand some escape sequences. */
   
         e = roff_res(r, bufp, szp, ln, pos);          e = roff_res(r, bufp, szp, ln, pos);
         if (ROFF_IGN == e)          if (ROFF_IGN == e)
                 return(e);                  return(e);
Line 1841  roff_T_(ROFF_ARGS)
Line 1851  roff_T_(ROFF_ARGS)
         return(ROFF_IGN);          return(ROFF_IGN);
 }  }
   
 #if 0  /*
 static int   * Handle in-line equation delimiters.
 roff_closeeqn(struct roff *r)   */
   static enum rofferr
   roff_eqndelim(struct roff *r, char **bufp, size_t *szp, int pos)
 {  {
           char    *cp1, *cp2;
   
         return(r->eqn && ROFF_EQN == eqn_end(&r->eqn) ? 1 : 0);          /*
            * Outside equations, look for an opening delimiter.
            * If we are inside an equation, we already know it is
            * in-line, or this function wouldn't have been called;
            * so look for a closing delimiter.
            */
   
           cp1 = *bufp + pos;
           cp2 = strchr(cp1, r->eqn == NULL ?
               r->last_eqn->odelim : r->last_eqn->cdelim);
           if (cp2 == NULL)
                   return(ROFF_CONT);
   
           /* Found a delimiter; get rid of surrounding blanks. */
   
           cp1 = cp2++;
           while (cp2[0] == ' ')
                   cp2++;
           while (cp1[-1] == ' ')
                   cp1--;
           *cp1 = '\0';
   
           /* Replace the delimiter with an equation macro. */
   
           *szp = mandoc_asprintf(&cp1, "%s\n.E%c\n\\&%s", *bufp,
               r->eqn == NULL ? 'Q' : 'N', cp2) + 1;
           free(*bufp);
           *bufp = cp1;
   
           /* Toggle the in-line state of the eqn subsystem. */
   
           r->eqn_inline = r->eqn == NULL;
           return(ROFF_REPARSE);
 }  }
 #endif  
   
 static void  static void
 roff_openeqn(struct roff *r, const char *name, int line,  roff_openeqn(struct roff *r, const char *name, int line,
Line 1860  roff_openeqn(struct roff *r, const char *name, int lin
Line 1904  roff_openeqn(struct roff *r, const char *name, int lin
         assert(NULL == r->eqn);          assert(NULL == r->eqn);
         e = eqn_alloc(name, offs, line, r->parse);          e = eqn_alloc(name, offs, line, r->parse);
   
         if (r->last_eqn)          if (r->last_eqn) {
                 r->last_eqn->next = e;                  r->last_eqn->next = e;
         else                  e->delim = r->last_eqn->delim;
                   e->odelim = r->last_eqn->odelim;
                   e->cdelim = r->last_eqn->cdelim;
           } else
                 r->first_eqn = r->last_eqn = e;                  r->first_eqn = r->last_eqn = e;
   
         r->eqn = r->last_eqn = e;          r->eqn = r->last_eqn = e;

Legend:
Removed from v.1.229  
changed lines
  Added in v.1.230

CVSweb