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

Diff for /pod2mdoc/pod2mdoc.c between version 1.38 and 1.39

version 1.38, 2015/02/13 12:40:54 version 1.39, 2015/02/13 15:35:15
Line 479  formatcode(struct state *st, const char *buf, size_t *
Line 479  formatcode(struct state *st, const char *buf, size_t *
 {  {
         enum fmt         fmt;          enum fmt         fmt;
         size_t           i, j, dsz;          size_t           i, j, dsz;
           unsigned char    uc;
   
         assert(*start + 1 < end);          assert(*start + 1 < end);
         assert('<' == buf[*start + 1]);          assert('<' == buf[*start + 1]);
Line 612  formatcode(struct state *st, const char *buf, size_t *
Line 613  formatcode(struct state *st, const char *buf, size_t *
                                 else                                  else
                                         printf("Ar ");                                          printf("Ar ");
                                 break;                                  break;
                         }                          }
                         if (0 == strncmp(buf + *start, "NULL", 4) &&                          i = 0;
                             ('=' == buf[*start + 4] ||                          uc = buf[*start];
                              '>' == buf[*start + 4])) {                          while (isalnum(uc) || '_' == uc || ' ' == uc)
                                   uc = buf[*start + ++i];
                           if ('=' != uc && '>' != uc)
                                   i = 0;
                           if (4 == i && ! strncmp(buf + *start, "NULL", 4)) {
                                 printf("Dv ");                                  printf("Dv ");
                                 break;                                  break;
                         }                          }
                         i = 0;                          switch (i ? dict_get(buf + *start, i) : MDOC_MAX) {
                         while (isalnum((unsigned char)buf[*start + i]) ||                          case MDOC_Fa:
                             '_' == buf[*start + i])  
                                 i++;  
                         if (i && MDOC_Fa == dict_get(buf + *start, i))  
                                 printf("Fa ");                                  printf("Fa ");
                         else                                  break;
                           case MDOC_Vt:
                                   printf("Vt ");
                                   break;
                           default:
                                 printf("Sy ");                                  printf("Sy ");
                                   break;
                           }
                         break;                          break;
                 case (FMT_CODE):                  case (FMT_CODE):
                         printf("Qo Li ");                          printf("Qo Li ");
Line 1014  command(struct state *st, const char *buf, size_t star
Line 1022  command(struct state *st, const char *buf, size_t star
 }  }
   
 /*  /*
    * Put the type provided as an argument into the dictionary.
    */
   static void
   register_type(const char *ptype)
   {
           const char      *pname, *pend;
   
           pname = ptype;
           while (isalnum((unsigned char)*pname) || '_' == *pname)
                   pname++;
           if ((pname - ptype == 6 && ! strncmp(ptype, "struct", 6)) ||
               (pname - ptype == 4 && ! strncmp(ptype, "enum", 4))) {
                   while (' ' == *pname)
                           pname++;
                   pend = pname;
                   while (isalnum((unsigned char)*pend) || '_' == *pend)
                           pend++;
                   if (pend > pname)
                           dict_put(pname, pend - pname, MDOC_Vt);
           } else
                   pend = pname;
           if (pend > ptype)
                   dict_put(ptype, pend - ptype, MDOC_Vt);
   }
   
   /*
  * Just pump out the line in a verbatim block.   * Just pump out the line in a verbatim block.
  * From the perspective of external callers,   * From the perspective of external callers,
  * always stays in OUST_NL/wantws mode.   * always stays in OUST_NL/wantws mode.
Line 1110  again:
Line 1144  again:
                                 if (buf[i] == '\n')                                  if (buf[i] == '\n')
                                         buf[i] = ' ';                                          buf[i] = ' ';
                         buf[ifo++] = '\0';                          buf[ifo++] = '\0';
                           register_type(buf + ift);
                         printf(".Ft %s", buf + ift);                          printf(".Ft %s", buf + ift);
                         if (buf[ifo] == '*') {                          if (buf[ifo] == '*') {
                                 fputs(" *", stdout);                                  fputs(" *", stdout);
Line 1118  again:
Line 1153  again:
                         putchar('\n');                          putchar('\n');
                         buf[ifa++] = '\0';                          buf[ifa++] = '\0';
                         printf(".Fo %s\n", buf + ifo);                          printf(".Fo %s\n", buf + ifo);
                         dict_put(buf + ifo, MDOC_Fo);                          dict_put(buf + ifo, 0, MDOC_Fo);
                         buf[ifc++] = '\0';                          buf[ifc++] = '\0';
                         for (;;) {                          for (;;) {
                                 cp = strchr(buf + ifa, ',');                                  cp = strchr(buf + ifa, ',');
Line 1131  again:
Line 1166  again:
                                     '_' == cp2[-1])                                      '_' == cp2[-1])
                                         cp2--;                                          cp2--;
                                 if ('\0' != *cp2)                                  if ('\0' != *cp2)
                                         dict_put(cp2, MDOC_Fa);                                          dict_put(cp2, 0, MDOC_Fa);
                                   register_type(buf + ifa);
                                 printf(".Fa \"%s\"\n", buf + ifa);                                  printf(".Fa \"%s\"\n", buf + ifa);
                                 if (cp == NULL)                                  if (cp == NULL)
                                         break;                                          break;

Legend:
Removed from v.1.38  
changed lines
  Added in v.1.39

CVSweb