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

Diff for /texi2mdoc/main.c between version 1.56 and 1.59

version 1.56, 2015/03/01 13:39:51 version 1.59, 2015/03/03 15:04:24
Line 94  static const struct texitok __texitoks[TEXICMD__MAX] =
Line 94  static const struct texitok __texitoks[TEXICMD__MAX] =
         { dosymbol, "*", 1 }, /* TEXICMD_ASTERISK */          { dosymbol, "*", 1 }, /* TEXICMD_ASTERISK */
         { dosymbol, "@", 1 }, /* TEXICMD_AT */          { dosymbol, "@", 1 }, /* TEXICMD_AT */
         { doignline, "author", 6 }, /* TEXICMD_AUTHOR */          { doignline, "author", 6 }, /* TEXICMD_AUTHOR */
         { doinline, "b", 1 }, /* TEXICMD_BOLD */          { doinline, "b", 1 }, /* TEXICMD_B */
           { dosymbol, "\\", 1 }, /* TEXICMD_BACKSLASH */
         { dosymbol, "!", 1 }, /* TEXICMD_BANG */          { dosymbol, "!", 1 }, /* TEXICMD_BANG */
         { dosymbol, "bullet", 6 }, /* TEXICMD_BULLET */          { dosymbol, "bullet", 6 }, /* TEXICMD_BULLET */
         { dobye, "bye", 3 }, /* TEXICMD_BYE */          { dobye, "bye", 3 }, /* TEXICMD_BYE */
Line 268  static const struct texitok __texitoks[TEXICMD__MAX] =
Line 269  static const struct texitok __texitoks[TEXICMD__MAX] =
         { doaccent, "ringaccent", 10 }, /* TEXICMD_RINGACCENT */          { doaccent, "ringaccent", 10 }, /* TEXICMD_RINGACCENT */
         { doinline, "samp", 4 }, /* TEXICMD_SAMP */          { doinline, "samp", 4 }, /* TEXICMD_SAMP */
         { doinline, "sansserif", 9 }, /* TEXICMD_SANSSERIF */          { doinline, "sansserif", 9 }, /* TEXICMD_SANSSERIF */
         { dobracket, "sc", 2 }, /* TEXICMD_SC */          { doinline, "sc", 2 }, /* TEXICMD_SC */
         { dosection, "section", 7 }, /* TEXICMD_SECTION */          { dosection, "section", 7 }, /* TEXICMD_SECTION */
         { dovalue, "set", 3 }, /* TEXICMD_SET */          { dovalue, "set", 3 }, /* TEXICMD_SET */
         { doignline, "setchapternewpage", 17 }, /* TEXICMD_SETCHAPNEWPAGE */          { doignline, "setchapternewpage", 17 }, /* TEXICMD_SETCHAPNEWPAGE */
Line 725  doinline(struct texi *p, enum texicmd cmd, size_t *pos
Line 726  doinline(struct texi *p, enum texicmd cmd, size_t *pos
         }          }
   
         if (NULL == macro || p->literal || TEXILIST_TABLE == p->list) {          if (NULL == macro || p->literal || TEXILIST_TABLE == p->list) {
                   if (TEXICMD_SC == cmd)
                           p->uppercase++;
                 parsebracket(p, pos, 0);                  parsebracket(p, pos, 0);
                   if (TEXICMD_SC == cmd)
                           p->uppercase--;
                 return;                  return;
         }          }
   
           /*
            * If we haven't seen any whitespace, then we don't want the
            * subsequent macro to insert any whitespace.
            */
           if (p->outmacro && 0 == p->seenws) {
                   teximacroopen(p, "Ns");
                   teximacroclose(p);
           }
   
         teximacroopen(p, macro);          teximacroopen(p, macro);
         p->seenws = 0;          p->seenws = 0;
           if (TEXICMD_SC == cmd)
                   p->uppercase++;
         parsebracket(p, pos, 0);          parsebracket(p, pos, 0);
           if (TEXICMD_SC == cmd)
                   p->uppercase--;
         texipunctuate(p, pos);          texipunctuate(p, pos);
         teximacroclose(p);          teximacroclose(p);
 }  }
Line 942  static void
Line 960  static void
 dodisplay(struct texi *p, enum texicmd cmd, size_t *pos)  dodisplay(struct texi *p, enum texicmd cmd, size_t *pos)
 {  {
   
           advanceeoln(p, pos, 1);
   
         switch (cmd) {          switch (cmd) {
         case (TEXICMD_FORMAT):          case (TEXICMD_FORMAT):
         case (TEXICMD_SMALLFORMAT):          case (TEXICMD_SMALLFORMAT):
Line 953  dodisplay(struct texi *p, enum texicmd cmd, size_t *po
Line 973  dodisplay(struct texi *p, enum texicmd cmd, size_t *po
         }          }
   
         p->seenvs = 1;          p->seenvs = 1;
         /* FIXME: ignore and parseeoln. */  
         advanceeoln(p, pos, 1);  
         parseto(p, pos, texitoks[cmd].tok);          parseto(p, pos, texitoks[cmd].tok);
         teximacro(p, "Ed");          teximacro(p, "Ed");
 }  }
Line 963  static void
Line 981  static void
 doexample(struct texi *p, enum texicmd cmd, size_t *pos)  doexample(struct texi *p, enum texicmd cmd, size_t *pos)
 {  {
   
         teximacro(p, "Bd -literal -offset indent");  
         /* FIXME: ignore and parseeoln. */  
         advanceeoln(p, pos, 1);          advanceeoln(p, pos, 1);
   
           teximacro(p, "Bd -literal -offset indent");
         p->literal++;          p->literal++;
         parseto(p, pos, texitoks[cmd].tok);          parseto(p, pos, texitoks[cmd].tok);
         p->literal--;          p->literal--;
Line 983  dobye(struct texi *p, enum texicmd cmd, size_t *pos)
Line 1001  dobye(struct texi *p, enum texicmd cmd, size_t *pos)
 static void  static void
 dotitle(struct texi *p, enum texicmd cmd, size_t *pos)  dotitle(struct texi *p, enum texicmd cmd, size_t *pos)
 {  {
         size_t   start, end;          size_t   start;
   
         while (*pos < BUFSZ(p) && isws(BUF(p)[*pos]))          while (*pos < BUFSZ(p) && isws(BUF(p)[*pos]))
                 advance(p, pos);                  advance(p, pos);
         start = end = *pos;  
         while (end < BUFSZ(p) && '\n' != BUF(p)[end])          /* We want to suck down the entire line, inclusive \n. */
                 end++;          start = *pos;
         if (end < BUFSZ(p))          while (*pos < BUFSZ(p) && '\n' != BUF(p)[*pos]) {
                 end++;                  if ('@' == BUF(p)[*pos])
         advanceeoln(p, pos, 1);                          advance(p, pos);
                   advance(p, pos);
           }
           if (*pos < BUFSZ(p))
                   advance(p, pos);
   
           /* Copy this into a buffer. */
         free(p->subtitle);          free(p->subtitle);
         p->subtitle = malloc(end - start + 1);          if (NULL == (p->subtitle = malloc(*pos - start + 1)))
         if (NULL == p->subtitle)  
                 texiabort(p, NULL);                  texiabort(p, NULL);
         memcpy(p->subtitle, &BUF(p)[start], end - start);          memcpy(p->subtitle, &BUF(p)[start], *pos - start);
         p->subtitle[end - start] = '\0';          p->subtitle[*pos - start] = '\0';
 }  }
   
 static void  static void
Line 1191  dosymbol(struct texi *p, enum texicmd cmd, size_t *pos
Line 1214  dosymbol(struct texi *p, enum texicmd cmd, size_t *pos
         case (TEXICMD_AT):          case (TEXICMD_AT):
                 texiputchar(p, '@');                  texiputchar(p, '@');
                 break;                  break;
           case (TEXICMD_BACKSLASH):
                   texiputchar(p, '\\');
                   break;
         case (TEXICMD_BANG):          case (TEXICMD_BANG):
                 texiputchar(p, '!');                  texiputchar(p, '!');
                 break;                  break;
Line 1604  static void
Line 1630  static void
 dosp(struct texi *p, enum texicmd cmd, size_t *pos)  dosp(struct texi *p, enum texicmd cmd, size_t *pos)
 {  {
   
           advanceeoln(p, pos, 1);
         if (p->literal)          if (p->literal)
                 texiputchar(p, '\n');                  texiputchar(p, '\n');
         else          else
                 texivspace(p);                  texivspace(p);
         /* FIXME: ignore and parseeoln. */  
         advanceeoln(p, pos, 1);  
 }  }
   
 static void  static void
Line 1681  domultitable(struct texi *p, enum texicmd cmd, size_t 
Line 1706  domultitable(struct texi *p, enum texicmd cmd, size_t 
   
         /* Make sure we don't print anything when scanning. */          /* Make sure we don't print anything when scanning. */
         p->ign++;          p->ign++;
         if ('@' == BUF(p)[*pos]) {          if (*pos < BUFSZ(p) && '@' == BUF(p)[*pos]) {
                 /*                  /*
                  * Look for @columnfractions.                   * Look for @columnfractions.
                  * We ignore these, but we do use the number of                   * We ignore these, but we do use the number of
Line 1733  dotable(struct texi *p, enum texicmd cmd, size_t *pos)
Line 1758  dotable(struct texi *p, enum texicmd cmd, size_t *pos)
 {  {
         enum texilist   sv = p->list;          enum texilist   sv = p->list;
   
           advanceeoln(p, pos, 1);
   
         p->list = TEXILIST_ITEM;          p->list = TEXILIST_ITEM;
         teximacro(p, "Bl -tag -width Ds");          teximacro(p, "Bl -tag -width Ds");
         /* FIXME: ignore and parseeoln. */  
         advanceeoln(p, pos, 1);  
         p->seenvs = 1;          p->seenvs = 1;
         parseto(p, pos, texitoks[cmd].tok);          parseto(p, pos, texitoks[cmd].tok);
         teximacro(p, "El");          teximacro(p, "El");
Line 1764  doenumerate(struct texi *p, enum texicmd cmd, size_t *
Line 1789  doenumerate(struct texi *p, enum texicmd cmd, size_t *
 {  {
         enum texilist    sv = p->list;          enum texilist    sv = p->list;
   
           advanceeoln(p, pos, 1);
   
         p->list = TEXILIST_NOITEM;          p->list = TEXILIST_NOITEM;
         teximacro(p, "Bl -enum");          teximacro(p, "Bl -enum");
         p->seenvs = 1;          p->seenvs = 1;
         /* FIXME: ignore and parseeoln. */          parseto(p, pos, texitoks[cmd].tok);
         advanceeoln(p, pos, 1);  
         parseto(p, pos, "enumerate");  
         teximacro(p, "El");          teximacro(p, "El");
         p->list = sv;          p->list = sv;
 }  }
Line 1779  doitemize(struct texi *p, enum texicmd cmd, size_t *po
Line 1804  doitemize(struct texi *p, enum texicmd cmd, size_t *po
 {  {
         enum texilist   sv = p->list;          enum texilist   sv = p->list;
   
           advanceeoln(p, pos, 1);
   
         p->list = TEXILIST_NOITEM;          p->list = TEXILIST_NOITEM;
         teximacro(p, "Bl -bullet");          teximacro(p, "Bl -bullet");
         p->seenvs = 1;          p->seenvs = 1;
         /* FIXME: ignore and parseeoln. */          parseto(p, pos, texitoks[cmd].tok);
         advanceeoln(p, pos, 1);  
         parseto(p, pos, "itemize");  
         teximacro(p, "El");          teximacro(p, "El");
         p->list = sv;          p->list = sv;
 }  }
Line 1802  static void
Line 1827  static void
 doignline(struct texi *p, enum texicmd cmd, size_t *pos)  doignline(struct texi *p, enum texicmd cmd, size_t *pos)
 {  {
   
         /* FIXME: ignore and parseeoln. */          advanceeoln(p, pos, 1);
         advanceeoln(p,  pos, 1);  
 }  }
   
 /*  /*

Legend:
Removed from v.1.56  
changed lines
  Added in v.1.59

CVSweb