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

Diff for /mandoc/roff.c between version 1.340 and 1.341

version 1.340, 2018/08/24 23:12:33 version 1.341, 2018/08/25 16:53:39
Line 176  static int   roff_br(ROFF_ARGS);
Line 176  static int   roff_br(ROFF_ARGS);
 static  int              roff_cblock(ROFF_ARGS);  static  int              roff_cblock(ROFF_ARGS);
 static  int              roff_cc(ROFF_ARGS);  static  int              roff_cc(ROFF_ARGS);
 static  int              roff_ccond(struct roff *, int, int);  static  int              roff_ccond(struct roff *, int, int);
   static  int              roff_char(ROFF_ARGS);
 static  int              roff_cond(ROFF_ARGS);  static  int              roff_cond(ROFF_ARGS);
 static  int              roff_cond_text(ROFF_ARGS);  static  int              roff_cond_text(ROFF_ARGS);
 static  int              roff_cond_sub(ROFF_ARGS);  static  int              roff_cond_sub(ROFF_ARGS);
Line 397  static struct roffmac  roffs[TOKEN_NONE] = {
Line 398  static struct roffmac  roffs[TOKEN_NONE] = {
         { roff_insec, NULL, NULL, 0 },  /* cf */          { roff_insec, NULL, NULL, 0 },  /* cf */
         { roff_line_ignore, NULL, NULL, 0 },  /* cflags */          { roff_line_ignore, NULL, NULL, 0 },  /* cflags */
         { roff_line_ignore, NULL, NULL, 0 },  /* ch */          { roff_line_ignore, NULL, NULL, 0 },  /* ch */
         { roff_unsupp, NULL, NULL, 0 },  /* char */          { roff_char, NULL, NULL, 0 },  /* char */
         { roff_unsupp, NULL, NULL, 0 },  /* chop */          { roff_unsupp, NULL, NULL, 0 },  /* chop */
         { roff_line_ignore, NULL, NULL, 0 },  /* class */          { roff_line_ignore, NULL, NULL, 0 },  /* class */
         { roff_insec, NULL, NULL, 0 },  /* close */          { roff_insec, NULL, NULL, 0 },  /* close */
Line 3318  roff_cc(ROFF_ARGS)
Line 3319  roff_cc(ROFF_ARGS)
                 mandoc_vmsg(MANDOCERR_ARG_EXCESS, r->parse,                  mandoc_vmsg(MANDOCERR_ARG_EXCESS, r->parse,
                     ln, p - buf->buf, "cc ... %s", p);                      ln, p - buf->buf, "cc ... %s", p);
   
           return ROFF_IGN;
   }
   
   static int
   roff_char(ROFF_ARGS)
   {
           const char      *p, *kp, *vp;
           size_t           ksz, vsz;
           int              font;
   
           /* Parse the character to be replaced. */
   
           kp = buf->buf + pos;
           p = kp + 1;
           if (*kp == '\0' || (*kp == '\\' &&
                mandoc_escape(&p, NULL, NULL) != ESCAPE_SPECIAL) ||
               (*p != ' ' && *p != '\0')) {
                   mandoc_vmsg(MANDOCERR_CHAR_ARG, r->parse,
                       ln, pos, "char %s", kp);
                   return ROFF_IGN;
           }
           ksz = p - kp;
           while (*p == ' ')
                   p++;
   
           /*
            * If the replacement string contains a font escape sequence,
            * we have to restore the font at the end.
            */
   
           vp = p;
           vsz = strlen(p);
           font = 0;
           while (*p != '\0') {
                   if (*p++ != '\\')
                           continue;
                   switch (mandoc_escape(&p, NULL, NULL)) {
                   case ESCAPE_FONT:
                   case ESCAPE_FONTROMAN:
                   case ESCAPE_FONTITALIC:
                   case ESCAPE_FONTBOLD:
                   case ESCAPE_FONTBI:
                   case ESCAPE_FONTPREV:
                           font++;
                           break;
                   default:
                           break;
                   }
           }
           if (font > 1)
                   mandoc_msg(MANDOCERR_CHAR_FONT, r->parse,
                       ln, vp - buf->buf, vp);
   
           /*
            * Approximate the effect of .char using the .tr tables.
            * XXX In groff, .char and .tr interact differently.
            */
   
           if (ksz == 1) {
                   if (r->xtab == NULL)
                           r->xtab = mandoc_calloc(128, sizeof(*r->xtab));
                   assert((unsigned int)*kp < 128);
                   free(r->xtab[(int)*kp].p);
                   r->xtab[(int)*kp].sz = mandoc_asprintf(&r->xtab[(int)*kp].p,
                       "%s%s", vp, font ? "\fP" : "");
           } else {
                   roff_setstrn(&r->xmbtab, kp, ksz, vp, vsz, 0);
                   if (font)
                           roff_setstrn(&r->xmbtab, kp, ksz, "\\fP", 3, 1);
           }
         return ROFF_IGN;          return ROFF_IGN;
 }  }
   

Legend:
Removed from v.1.340  
changed lines
  Added in v.1.341

CVSweb