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

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

version 1.230, 2014/10/16 01:11:20 version 1.233, 2014/10/20 15:04:56
Line 1857  roff_T_(ROFF_ARGS)
Line 1857  roff_T_(ROFF_ARGS)
 static enum rofferr  static enum rofferr
 roff_eqndelim(struct roff *r, char **bufp, size_t *szp, int pos)  roff_eqndelim(struct roff *r, char **bufp, size_t *szp, int pos)
 {  {
         char    *cp1, *cp2;          char            *cp1, *cp2;
           const char      *bef_pr, *bef_nl, *mac, *aft_nl, *aft_pr;
   
         /*          /*
          * Outside equations, look for an opening delimiter.           * Outside equations, look for an opening delimiter.
Line 1872  roff_eqndelim(struct roff *r, char **bufp, size_t *szp
Line 1873  roff_eqndelim(struct roff *r, char **bufp, size_t *szp
         if (cp2 == NULL)          if (cp2 == NULL)
                 return(ROFF_CONT);                  return(ROFF_CONT);
   
         /* Found a delimiter; get rid of surrounding blanks. */          *cp2++ = '\0';
           bef_pr = bef_nl = aft_nl = aft_pr = "";
   
         cp1 = cp2++;          /* Handle preceding text, protecting whitespace. */
         while (cp2[0] == ' ')  
                 cp2++;  
         while (cp1[-1] == ' ')  
                 cp1--;  
         *cp1 = '\0';  
   
         /* Replace the delimiter with an equation macro. */          if (**bufp != '\0') {
                   if (r->eqn == NULL)
                           bef_pr = "\\&";
                   bef_nl = "\n";
           }
   
         *szp = mandoc_asprintf(&cp1, "%s\n.E%c\n\\&%s", *bufp,          /*
             r->eqn == NULL ? 'Q' : 'N', cp2) + 1;           * Prepare replacing the delimiter with an equation macro
            * and drop leading white space from the equation.
            */
   
           if (r->eqn == NULL) {
                   while (*cp2 == ' ')
                           cp2++;
                   mac = ".EQ";
           } else
                   mac = ".EN";
   
           /* Handle following text, protecting whitespace. */
   
           if (*cp2 != '\0') {
                   aft_nl = "\n";
                   if (r->eqn != NULL)
                           aft_pr = "\\&";
           }
   
           /* Do the actual replacement. */
   
           *szp = mandoc_asprintf(&cp1, "%s%s%s%s%s%s%s", *bufp,
               bef_pr, bef_nl, mac, aft_nl, aft_pr, cp2) + 1;
         free(*bufp);          free(*bufp);
         *bufp = cp1;          *bufp = cp1;
   

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

CVSweb