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

Diff for /mandoc/roff.c between version 1.330 and 1.336

version 1.330, 2018/08/10 04:41:25 version 1.336, 2018/08/19 17:46:14
Line 327  const char *__roff_name[MAN_MAX + 1] = {
Line 327  const char *__roff_name[MAN_MAX + 1] = {
         "Dx",           "%Q",           "%U",           "Ta",          "Dx",           "%Q",           "%U",           "Ta",
         NULL,          NULL,
         "TH",           "SH",           "SS",           "TP",          "TH",           "SH",           "SS",           "TP",
           "TQ",
         "LP",           "PP",           "P",            "IP",          "LP",           "PP",           "P",            "IP",
         "HP",           "SM",           "SB",           "BI",          "HP",           "SM",           "SB",           "BI",
         "IB",           "BR",           "RB",           "R",          "IB",           "BR",           "RB",           "R",
Line 334  const char *__roff_name[MAN_MAX + 1] = {
Line 335  const char *__roff_name[MAN_MAX + 1] = {
         "nf",           "fi",          "nf",           "fi",
         "RE",           "RS",           "DT",           "UC",          "RE",           "RS",           "DT",           "UC",
         "PD",           "AT",           "in",          "PD",           "AT",           "in",
         "OP",           "EX",           "EE",           "UR",          "SY",           "YS",           "OP",
           "EX",           "EE",           "UR",
         "UE",           "MT",           "ME",           NULL          "UE",           "MT",           "ME",           NULL
 };  };
 const   char *const *roff_name = __roff_name;  const   char *const *roff_name = __roff_name;
Line 1203  roff_res(struct roff *r, struct buf *buf, int ln, int 
Line 1205  roff_res(struct roff *r, struct buf *buf, int ln, int 
                         r->man->next = ROFF_NEXT_SIBLING;                          r->man->next = ROFF_NEXT_SIBLING;
                 }                  }
   
                 /* Discard comments. */                  /* Line continuation with comment. */
   
                 while (stesc > start && stesc[-1] == ' ')                  if (stesc[1] == '#') {
                           *stesc = '\0';
                           return ROFF_APPEND;
                   }
   
                   /* Discard normal comments. */
   
                   while (stesc > start && stesc[-1] == ' ' &&
                       (stesc == start + 1 || stesc[-2] != '\\'))
                         stesc--;                          stesc--;
                 *stesc = '\0';                  *stesc = '\0';
                 break;                  break;
Line 1367  roff_res(struct roff *r, struct buf *buf, int ln, int 
Line 1377  roff_res(struct roff *r, struct buf *buf, int ln, int 
                         if (arg_complete) {                          if (arg_complete) {
                                 deftype = ROFFDEF_USER | ROFFDEF_PRE;                                  deftype = ROFFDEF_USER | ROFFDEF_PRE;
                                 res = roff_getstrn(r, stnam, naml, &deftype);                                  res = roff_getstrn(r, stnam, naml, &deftype);
   
                                   /*
                                    * If not overriden, let \*(.T
                                    * through to the formatters.
                                    */
   
                                   if (res == NULL && naml == 2 &&
                                       stnam[0] == '.' && stnam[1] == 'T') {
                                           roff_setstrn(&r->strtab,
                                               ".T", 2, NULL, 0, 0);
                                           stesc--;
                                           continue;
                                   }
                         }                          }
                         break;                          break;
                 case 'B':                  case 'B':
Line 2145  out:
Line 2168  out:
 static int  static int
 roff_evalcond(struct roff *r, int ln, char *v, int *pos)  roff_evalcond(struct roff *r, int ln, char *v, int *pos)
 {  {
         char    *cp, *name;          const char      *start, *end;
         size_t   sz;          char            *cp, *name;
         int      deftype, number, savepos, istrue, wanttrue;          size_t           sz;
           int              deftype, len, number, savepos, istrue, wanttrue;
   
         if ('!' == v[*pos]) {          if ('!' == v[*pos]) {
                 wanttrue = 0;                  wanttrue = 0;
Line 2162  roff_evalcond(struct roff *r, int ln, char *v, int *po
Line 2186  roff_evalcond(struct roff *r, int ln, char *v, int *po
         case 'o':          case 'o':
                 (*pos)++;                  (*pos)++;
                 return wanttrue;                  return wanttrue;
         case 'c':  
         case 'e':          case 'e':
         case 't':          case 't':
         case 'v':          case 'v':
                 (*pos)++;                  (*pos)++;
                 return !wanttrue;                  return !wanttrue;
           case 'c':
                   do {
                           (*pos)++;
                   } while (v[*pos] == ' ');
   
                   /*
                    * Quirk for groff compatibility:
                    * The horizontal tab is neither available nor unavailable.
                    */
   
                   if (v[*pos] == '\t') {
                           (*pos)++;
                           return 0;
                   }
   
                   /* Printable ASCII characters are available. */
   
                   if (v[*pos] != '\\') {
                           (*pos)++;
                           return wanttrue;
                   }
   
                   end = v + ++*pos;
                   switch (mandoc_escape(&end, &start, &len)) {
                   case ESCAPE_SPECIAL:
                           istrue = mchars_spec2cp(start, len) != -1;
                           break;
                   case ESCAPE_UNICODE:
                           istrue = 1;
                           break;
                   case ESCAPE_NUMBERED:
                           istrue = mchars_num2char(start, len) != -1;
                           break;
                   default:
                           istrue = !wanttrue;
                           break;
                   }
                   *pos = end - v;
                   return istrue == wanttrue;
         case 'd':          case 'd':
         case 'r':          case 'r':
                 cp = v + *pos + 1;                  cp = v + *pos + 1;

Legend:
Removed from v.1.330  
changed lines
  Added in v.1.336

CVSweb