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

Diff for /mandoc/roff.c between version 1.351 and 1.352

version 1.351, 2018/12/14 06:33:14 version 1.352, 2018/12/15 19:30:26
Line 1154  roff_res(struct roff *r, struct buf *buf, int ln, int 
Line 1154  roff_res(struct roff *r, struct buf *buf, int ln, int 
         struct roff_node *n;    /* used for header comments */          struct roff_node *n;    /* used for header comments */
         const char      *start; /* start of the string to process */          const char      *start; /* start of the string to process */
         char            *stesc; /* start of an escape sequence ('\\') */          char            *stesc; /* start of an escape sequence ('\\') */
           const char      *esct;  /* type of esccape sequence */
         char            *ep;    /* end of comment string */          char            *ep;    /* end of comment string */
         const char      *stnam; /* start of the name, after "[(*" */          const char      *stnam; /* start of the name, after "[(*" */
         const char      *cp;    /* end of the name, e.g. before ']' */          const char      *cp;    /* end of the name, e.g. before ']' */
Line 1163  roff_res(struct roff *r, struct buf *buf, int ln, int 
Line 1164  roff_res(struct roff *r, struct buf *buf, int ln, int 
         size_t           naml;  /* actual length of the escape name */          size_t           naml;  /* actual length of the escape name */
         size_t           asz;   /* length of the replacement */          size_t           asz;   /* length of the replacement */
         size_t           rsz;   /* length of the rest of the string */          size_t           rsz;   /* length of the rest of the string */
         enum mandoc_esc  esc;   /* type of the escape sequence */  
         int              inaml; /* length returned from mandoc_escape() */          int              inaml; /* length returned from mandoc_escape() */
         int              expand_count;  /* to avoid infinite loops */          int              expand_count;  /* to avoid infinite loops */
         int              npos;  /* position in numeric expression */          int              npos;  /* position in numeric expression */
Line 1172  roff_res(struct roff *r, struct buf *buf, int ln, int 
Line 1172  roff_res(struct roff *r, struct buf *buf, int ln, int 
         int              done;  /* no more input available */          int              done;  /* no more input available */
         int              deftype; /* type of definition to paste */          int              deftype; /* type of definition to paste */
         int              rcsid; /* kind of RCS id seen */          int              rcsid; /* kind of RCS id seen */
           enum mandocerr   err;   /* for escape sequence problems */
         char             sign;  /* increment number register */          char             sign;  /* increment number register */
         char             term;  /* character terminating the escape */          char             term;  /* character terminating the escape */
   
Line 1304  roff_res(struct roff *r, struct buf *buf, int ln, int 
Line 1305  roff_res(struct roff *r, struct buf *buf, int ln, int 
   
                 term = '\0';                  term = '\0';
                 cp = stesc + 1;                  cp = stesc + 1;
                 switch (*cp) {                  if (*cp == 'E')
                           cp++;
                   esct = cp;
                   switch (*esct) {
                 case '*':                  case '*':
                 case '$':                  case '$':
                         res = NULL;                          res = NULL;
Line 1320  roff_res(struct roff *r, struct buf *buf, int ln, int 
Line 1324  roff_res(struct roff *r, struct buf *buf, int ln, int 
                         res = ubuf;                          res = ubuf;
                         break;                          break;
                 default:                  default:
                         esc = mandoc_escape(&cp, &stnam, &inaml);                          err = MANDOCERR_OK;
                         if (esc == ESCAPE_ERROR ||                          switch(mandoc_escape(&cp, &stnam, &inaml)) {
                             (esc == ESCAPE_SPECIAL &&                          case ESCAPE_SPECIAL:
                              mchars_spec2cp(stnam, inaml) < 0))                                  if (mchars_spec2cp(stnam, inaml) >= 0)
                                 mandoc_msg(MANDOCERR_ESC_BAD,                                          break;
                                     ln, (int)(stesc - buf->buf),                                  /* FALLTHROUGH */
                           case ESCAPE_ERROR:
                                   err = MANDOCERR_ESC_BAD;
                                   break;
                           case ESCAPE_UNDEF:
                                   err = MANDOCERR_ESC_UNDEF;
                                   break;
                           case ESCAPE_UNSUPP:
                                   err = MANDOCERR_ESC_UNSUPP;
                                   break;
                           default:
                                   break;
                           }
                           if (err != MANDOCERR_OK)
                                   mandoc_msg(err, ln, (int)(stesc - buf->buf),
                                     "%.*s", (int)(cp - stesc), stesc);                                      "%.*s", (int)(cp - stesc), stesc);
                         stesc--;                          stesc--;
                         continue;                          continue;
Line 1382  roff_res(struct roff *r, struct buf *buf, int ln, int 
Line 1400  roff_res(struct roff *r, struct buf *buf, int ln, int 
                                 cp++;                                  cp++;
                                 break;                                  break;
                         }                          }
                         if (*cp++ != '\\' || stesc[1] != 'w') {                          if (*cp++ != '\\' || *esct != 'w') {
                                 naml++;                                  naml++;
                                 continue;                                  continue;
                         }                          }
Line 1390  roff_res(struct roff *r, struct buf *buf, int ln, int 
Line 1408  roff_res(struct roff *r, struct buf *buf, int ln, int 
                         case ESCAPE_SPECIAL:                          case ESCAPE_SPECIAL:
                         case ESCAPE_UNICODE:                          case ESCAPE_UNICODE:
                         case ESCAPE_NUMBERED:                          case ESCAPE_NUMBERED:
                           case ESCAPE_UNDEF:
                         case ESCAPE_OVERSTRIKE:                          case ESCAPE_OVERSTRIKE:
                                 naml++;                                  naml++;
                                 break;                                  break;
Line 1403  roff_res(struct roff *r, struct buf *buf, int ln, int 
Line 1422  roff_res(struct roff *r, struct buf *buf, int ln, int 
                  * undefined, resume searching for escapes.                   * undefined, resume searching for escapes.
                  */                   */
   
                 switch (stesc[1]) {                  switch (*esct) {
                 case '*':                  case '*':
                         if (arg_complete) {                          if (arg_complete) {
                                 deftype = ROFFDEF_USER | ROFFDEF_PRE;                                  deftype = ROFFDEF_USER | ROFFDEF_PRE;
Line 1430  roff_res(struct roff *r, struct buf *buf, int ln, int 
Line 1449  roff_res(struct roff *r, struct buf *buf, int ln, int 
                                 break;                                  break;
                         }                          }
                         ctx = r->mstack + r->mstackpos;                          ctx = r->mstack + r->mstackpos;
                         npos = stesc[2] - '1';                          npos = esct[1] - '1';
                         if (npos >= 0 && npos <= 8) {                          if (npos >= 0 && npos <= 8) {
                                 res = npos < ctx->argc ?                                  res = npos < ctx->argc ?
                                     ctx->argv[npos] : "";                                      ctx->argv[npos] : "";
                                 break;                                  break;
                         }                          }
                         if (stesc[2] == '*')                          if (esct[1] == '*')
                                 quote_args = 0;                                  quote_args = 0;
                         else if (stesc[2] == '@')                          else if (esct[1] == '@')
                                 quote_args = 1;                                  quote_args = 1;
                         else {                          else {
                                 mandoc_msg(MANDOCERR_ARG_NONUM, ln,                                  mandoc_msg(MANDOCERR_ARG_NONUM, ln,
Line 1500  roff_res(struct roff *r, struct buf *buf, int ln, int 
Line 1519  roff_res(struct roff *r, struct buf *buf, int ln, int 
                 }                  }
   
                 if (res == NULL) {                  if (res == NULL) {
                         if (stesc[1] == '*')                          if (*esct == '*')
                                 mandoc_msg(MANDOCERR_STR_UNDEF,                                  mandoc_msg(MANDOCERR_STR_UNDEF,
                                     ln, (int)(stesc - buf->buf),                                      ln, (int)(stesc - buf->buf),
                                     "%.*s", (int)naml, stnam);                                      "%.*s", (int)naml, stnam);

Legend:
Removed from v.1.351  
changed lines
  Added in v.1.352

CVSweb