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

Diff for /texi2mdoc/main.c between version 1.20 and 1.21

version 1.20, 2015/02/19 16:15:17 version 1.21, 2015/02/19 16:35:54
Line 277  static void dodefn(struct texi *, enum texicmd, const 
Line 277  static void dodefn(struct texi *, enum texicmd, const 
 static  void dodisplay(struct texi *, enum texicmd, const char *, size_t, size_t *);  static  void dodisplay(struct texi *, enum texicmd, const char *, size_t, size_t *);
 static  void doenumerate(struct texi *, enum texicmd, const char *, size_t, size_t *);  static  void doenumerate(struct texi *, enum texicmd, const char *, size_t, size_t *);
 static  void doexample(struct texi *, enum texicmd, const char *, size_t, size_t *);  static  void doexample(struct texi *, enum texicmd, const char *, size_t, size_t *);
 static  void dofont(struct texi *, enum texicmd, const char *, size_t, size_t *);  
 static  void doignargn(struct texi *, enum texicmd, const char *, size_t, size_t *);  static  void doignargn(struct texi *, enum texicmd, const char *, size_t, size_t *);
 static  void doignblock(struct texi *, enum texicmd, const char *, size_t, size_t *);  static  void doignblock(struct texi *, enum texicmd, const char *, size_t, size_t *);
 static  void doignbracket(struct texi *, enum texicmd, const char *, size_t, size_t *);  static  void doignbracket(struct texi *, enum texicmd, const char *, size_t, size_t *);
Line 312  static const struct texitok texitoks[TEXICMD__MAX] = {
Line 311  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 */
         { dofont, "b", 1 }, /* TEXICMD_BOLD */          { doinline, "b", 1 }, /* TEXICMD_BOLD */
         { 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 320  static const struct texitok texitoks[TEXICMD__MAX] = {
Line 319  static const struct texitok texitoks[TEXICMD__MAX] = {
         { dosection, "chapter", 7 }, /* TEXICMD_CHAPTER */          { dosection, "chapter", 7 }, /* TEXICMD_CHAPTER */
         { doignline, "cindex", 6 }, /* TEXICMD_CINDEX */          { doignline, "cindex", 6 }, /* TEXICMD_CINDEX */
         { doaccent, "^", 1 }, /* TEXICMD_CIRCUMFLEX */          { doaccent, "^", 1 }, /* TEXICMD_CIRCUMFLEX */
         { dofont, "code", 4 }, /* TEXICMD_CODE */          { doinline, "code", 4 }, /* TEXICMD_CODE */
         { dofont, "cite", 4 }, /* TEXICMD_CITE */          { doinline, "cite", 4 }, /* TEXICMD_CITE */
         { dosymbol, ":", 1 }, /* TEXICMD_COLON */          { dosymbol, ":", 1 }, /* TEXICMD_COLON */
         { NULL, "columnfractions", 15 }, /* TEXICMD_COLUMNFRACTIONS */          { NULL, "columnfractions", 15 }, /* TEXICMD_COLUMNFRACTIONS */
         { doinline, "command", 7 }, /* TEXICMD_COMMAND */          { doinline, "command", 7 }, /* TEXICMD_COMMAND */
Line 351  static const struct texitok texitoks[TEXICMD__MAX] = {
Line 350  static const struct texitok texitoks[TEXICMD__MAX] = {
         { dodefn, "defvr", 5 }, /* TEXICMD_DEFVR */          { dodefn, "defvr", 5 }, /* TEXICMD_DEFVR */
         { dodefn, "defvrx", 6 }, /* TEXICMD_DEFVRX */          { dodefn, "defvrx", 6 }, /* TEXICMD_DEFVRX */
         { doignblock, "detailmenu", 10 }, /* TEXICMD_DETAILMENU */          { doignblock, "detailmenu", 10 }, /* TEXICMD_DETAILMENU */
         { dofont, "dfn", 3 }, /* TEXICMD_DFN */          { doinline, "dfn", 3 }, /* TEXICMD_DFN */
         { doignline, "dircategory", 11 }, /* TEXICMD_DIRCATEGORY */          { doignline, "dircategory", 11 }, /* TEXICMD_DIRCATEGORY */
         { doignblock, "direntry", 8 }, /* TEXICMD_DIRENTRY */          { doignblock, "direntry", 8 }, /* TEXICMD_DIRENTRY */
         { dodisplay, "display", 7 }, /* TEXICMD_DISPLAY */          { dodisplay, "display", 7 }, /* TEXICMD_DISPLAY */
         { dosymbol, "dots", 4 }, /* TEXICMD_DOTS */          { dosymbol, "dots", 4 }, /* TEXICMD_DOTS */
         { dolink, "email", 5 }, /* TEXICMD_EMAIL */          { dolink, "email", 5 }, /* TEXICMD_EMAIL */
         { dofont, "emph", 4 }, /* TEXICMD_EMPH */          { doinline, "emph", 4 }, /* TEXICMD_EMPH */
         { NULL, "end", 3 }, /* TEXICMD_END */          { NULL, "end", 3 }, /* TEXICMD_END */
         { doenumerate, "enumerate", 9 }, /* TEXICMD_ENUMERATE */          { doenumerate, "enumerate", 9 }, /* TEXICMD_ENUMERATE */
         { doinline, "env", 3 }, /* TEXICMD_ENV */          { doinline, "env", 3 }, /* TEXICMD_ENV */
Line 375  static const struct texitok texitoks[TEXICMD__MAX] = {
Line 374  static const struct texitok texitoks[TEXICMD__MAX] = {
         { doignline, "headings", 8 }, /* TEXICMD_HEADINGS */          { doignline, "headings", 8 }, /* TEXICMD_HEADINGS */
         { doitem, "headitem", 8 }, /* TEXICMD_HEADITEM */          { doitem, "headitem", 8 }, /* TEXICMD_HEADITEM */
         { dosymbol, "-", 1 }, /* TEXICMD_HYPHEN */          { dosymbol, "-", 1 }, /* TEXICMD_HYPHEN */
         { dofont, "i", 1 }, /* TEXICMD_I */          { doinline, "i", 1 }, /* TEXICMD_I */
         { doignblock, "ifclear", 7 }, /* TEXICMD_IFCLEAR */          { doignblock, "ifclear", 7 }, /* TEXICMD_IFCLEAR */
         { doignblock, "ifdocbook", 9 }, /* TEXICMD_IFDOCBOOK */          { doignblock, "ifdocbook", 9 }, /* TEXICMD_IFDOCBOOK */
         { doignblock, "ifhtml", 6 }, /* TEXICMD_IFHTML */          { doignblock, "ifhtml", 6 }, /* TEXICMD_IFHTML */
Line 398  static const struct texitok texitoks[TEXICMD__MAX] = {
Line 397  static const struct texitok texitoks[TEXICMD__MAX] = {
         { doitem, "item", 4 }, /* TEXICMD_ITEM */          { doitem, "item", 4 }, /* TEXICMD_ITEM */
         { doitemize, "itemize", 7 }, /* TEXICMD_ITEMIZE */          { doitemize, "itemize", 7 }, /* TEXICMD_ITEMIZE */
         { doitem, "itemx", 5 }, /* TEXICMD_ITEMX */          { doitem, "itemx", 5 }, /* TEXICMD_ITEMX */
         { dofont, "kbd", 3 }, /* TEXICMD_KBD */          { doinline, "kbd", 3 }, /* TEXICMD_KBD */
         { dobracket, "key", 3 }, /* TEXICMD_KEY */          { dobracket, "key", 3 }, /* TEXICMD_KEY */
         { doignline, "kindex", 6 }, /* TEXICMD_KINDEX */          { doignline, "kindex", 6 }, /* TEXICMD_KINDEX */
         { dosymbol, "LaTeX", 5 }, /* TEXICMD_LATEX */          { dosymbol, "LaTeX", 5 }, /* TEXICMD_LATEX */
Line 416  static const struct texitok texitoks[TEXICMD__MAX] = {
Line 415  static const struct texitok texitoks[TEXICMD__MAX] = {
         { doignline, "page", 4 }, /* TEXICMD_PAGE */          { doignline, "page", 4 }, /* TEXICMD_PAGE */
         { doignline, "paragraphindent", 14 }, /* TEXICMD_PARINDENT */          { doignline, "paragraphindent", 14 }, /* TEXICMD_PARINDENT */
         { doignline, "printindex", 10 }, /* TEXICMD_PRINTINDEX */          { doignline, "printindex", 10 }, /* TEXICMD_PRINTINDEX */
         { dofont, "r", 1 }, /* TEXICMD_R */          { doinline, "r", 1 }, /* TEXICMD_R */
         { dobracket, "ref", 3 }, /* TEXICMD_REF */          { dobracket, "ref", 3 }, /* TEXICMD_REF */
         { dosymbol, "result", 6 }, /* TEXICMD_RESULT */          { dosymbol, "result", 6 }, /* TEXICMD_RESULT */
         { dofont, "samp", 4 }, /* TEXICMD_SAMP */          { doinline, "samp", 4 }, /* TEXICMD_SAMP */
         { dofont, "sansserif", 9 }, /* TEXICMD_SANSSERIF */          { doinline, "sansserif", 9 }, /* TEXICMD_SANSSERIF */
         { dobracket, "sc", 2 }, /* TEXICMD_SC */          { dobracket, "sc", 2 }, /* TEXICMD_SC */
         { dosection, "section", 7 }, /* TEXICMD_SECTION */          { dosection, "section", 7 }, /* TEXICMD_SECTION */
         { doignline, "set", 3 }, /* TEXICMD_SET */          { doignline, "set", 3 }, /* TEXICMD_SET */
         { doignline, "setchapternewpage", 17 }, /* TEXICMD_SETCHAPNEWPAGE */          { doignline, "setchapternewpage", 17 }, /* TEXICMD_SETCHAPNEWPAGE */
         { doignline, "setfilename", 11 }, /* TEXICMD_SETFILENAME */          { doignline, "setfilename", 11 }, /* TEXICMD_SETFILENAME */
         { dotitle, "settitle", 8 }, /* TEXICMD_SETTITLE */          { dotitle, "settitle", 8 }, /* TEXICMD_SETTITLE */
         { dofont, "slanted", 7 }, /* TEXICMD_SLANTED */          { doinline, "slanted", 7 }, /* TEXICMD_SLANTED */
         { dosp, "sp", 2 }, /* TEXICMD_SP */          { dosp, "sp", 2 }, /* TEXICMD_SP */
         { dosymbol, " ", 1 }, /* TEXICMD_SPACE */          { dosymbol, " ", 1 }, /* TEXICMD_SPACE */
         { doignline, "smallbook", 9 }, /* TEXICMD_SMALLBOOK */          { doignline, "smallbook", 9 }, /* TEXICMD_SMALLBOOK */
Line 437  static const struct texitok texitoks[TEXICMD__MAX] = {
Line 436  static const struct texitok texitoks[TEXICMD__MAX] = {
         { dodisplay, "smallindentblock", 16 }, /* TEXICMD_SMALLINDENTBLOCK */          { dodisplay, "smallindentblock", 16 }, /* TEXICMD_SMALLINDENTBLOCK */
         { dosymbol, "{", 1 }, /* TEXICMD_SQUIGGLE_LEFT */          { dosymbol, "{", 1 }, /* TEXICMD_SQUIGGLE_LEFT */
         { dosymbol, "}", 1 }, /* TEXICMD_SQUIGGLE_RIGHT */          { dosymbol, "}", 1 }, /* TEXICMD_SQUIGGLE_RIGHT */
         { dofont, "strong", 6 }, /* TEXICMD_STRONG */          { doinline, "strong", 6 }, /* TEXICMD_STRONG */
         { dosubsection, "subheading", 10 }, /* TEXICMD_SUBHEADING */          { dosubsection, "subheading", 10 }, /* TEXICMD_SUBHEADING */
         { dosubsection, "subsection", 10 }, /* TEXICMD_SUBSECTION */          { dosubsection, "subsection", 10 }, /* TEXICMD_SUBSECTION */
         { doignline, "subtitle", 8 }, /* TEXICMD_SUBTITLE */          { doignline, "subtitle", 8 }, /* TEXICMD_SUBTITLE */
         { doignline, "syncodeindex", 12 }, /* TEXICMD_SYNCODEINDEX */          { doignline, "syncodeindex", 12 }, /* TEXICMD_SYNCODEINDEX */
         { dofont, "t", 1 }, /* TEXICMD_T */          { doinline, "t", 1 }, /* TEXICMD_T */
         { dotab, "tab", 3 }, /* TEXICMD_TAB */          { dotab, "tab", 3 }, /* TEXICMD_TAB */
         { dosymbol, "\t", 1 }, /* TEXICMD_TABSYM */          { dosymbol, "\t", 1 }, /* TEXICMD_TABSYM */
         { dotable, "table", 5 }, /* TEXICMD_TABLE */          { dotable, "table", 5 }, /* TEXICMD_TABLE */
Line 1349  static void
Line 1348  static void
 doinline(struct texi *p, enum texicmd cmd,  doinline(struct texi *p, enum texicmd cmd,
         const char *buf, size_t sz, size_t *pos)          const char *buf, size_t sz, size_t *pos)
 {  {
         const char      *macro;          const char      *macro = NULL;
   
         switch (cmd) {          switch (cmd) {
           case (TEXICMD_CODE):
           case (TEXICMD_KBD):
           case (TEXICMD_SAMP):
           case (TEXICMD_T):
                   macro = "Li";
                   break;
           case (TEXICMD_CITE):
           case (TEXICMD_DFN):
           case (TEXICMD_EMPH):
           case (TEXICMD_I):
           case (TEXICMD_SLANTED):
                   macro = "Em";
                   break;
           case (TEXICMD_B):
           case (TEXICMD_STRONG):
                   macro = "Sy";
                   break;
         case (TEXICMD_COMMAND):          case (TEXICMD_COMMAND):
                 macro = "Xr";                  macro = "Xr";
                 break;                  break;
Line 1371  doinline(struct texi *p, enum texicmd cmd,
Line 1387  doinline(struct texi *p, enum texicmd cmd,
                 abort();                  abort();
         }          }
   
         if (p->literal) {          if (NULL == macro || p->literal) {
                 parsebracket(p, buf, sz, pos);                  parsebracket(p, buf, sz, pos);
                 return;                  return;
         }          }
Line 1471  doinclude(struct texi *p, enum texicmd cmd, 
Line 1487  doinclude(struct texi *p, enum texicmd cmd, 
 }  }
   
 static void  static void
 dofont(struct texi *p, enum texicmd cmd,  
         const char *buf, size_t sz, size_t *pos)  
 {  
         const char      *font;  
   
         switch (cmd) {  
         case (TEXICMD_B):  
         case (TEXICMD_STRONG):  
                 font = "\\fB";  
                 break;  
         case (TEXICMD_CITE):  
         case (TEXICMD_DFN):  
         case (TEXICMD_EMPH):  
         case (TEXICMD_I):  
         case (TEXICMD_SLANTED):  
                 font = "\\fI";  
                 break;  
         case (TEXICMD_CODE):  
         case (TEXICMD_KBD):  
         case (TEXICMD_R):  
         case (TEXICMD_SAMP):  
         case (TEXICMD_SANSSERIF):  
         case (TEXICMD_T):  
                 font = "\\fR";  
                 break;  
         default:  
                 abort();  
         }  
   
         if (p->seenws) {  
                 texiputchar(p, ' ');  
                 p->seenws = 0;  
         }  
         texiputchars(p, font);  
         parsebracket(p, buf, sz, pos);  
         texiputchars(p, "\\fP");  
 }  
   
 static void  
 dobracket(struct texi *p, enum texicmd cmd,  dobracket(struct texi *p, enum texicmd cmd,
         const char *buf, size_t sz, size_t *pos)          const char *buf, size_t sz, size_t *pos)
 {  {
Line 1834  dosubsection(struct texi *p, enum texicmd cmd, 
Line 1811  dosubsection(struct texi *p, enum texicmd cmd, 
         else if (p->literal)          else if (p->literal)
                 texierr(p, "\"Em\" in a literal scope!?");                  texierr(p, "\"Em\" in a literal scope!?");
   
           /* We don't have a subsubsection, so make one up. */
         texivspace(p);          texivspace(p);
         teximacroopen(p, "Em");          teximacroopen(p, "Em");
         parseeoln(p, buf, sz, pos);          parseeoln(p, buf, sz, pos);
Line 2075  doitemize(struct texi *p, enum texicmd cmd, 
Line 2053  doitemize(struct texi *p, enum texicmd cmd, 
 {  {
         enum texilist   sv = p->list;          enum texilist   sv = p->list;
   
         p->list = TEXILIST_ITEM;          p->list = TEXILIST_NOITEM;
         teximacro(p, "Bl -bullet");          teximacro(p, "Bl -bullet");
         p->seenvs = 1;          p->seenvs = 1;
         /* FIXME: ignore and parseeoln. */          /* FIXME: ignore and parseeoln. */

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

CVSweb