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

Diff for /texi2mdoc/main.c between version 1.16 and 1.22

version 1.16, 2015/02/19 10:20:31 version 1.22, 2015/02/19 16:44:26
Line 42  enum texicmd {
Line 42  enum texicmd {
         TEXICMD_ANCHOR,          TEXICMD_ANCHOR,
         TEXICMD_APPENDIX,          TEXICMD_APPENDIX,
         TEXICMD_APPENDIXSEC,          TEXICMD_APPENDIXSEC,
           TEXICMD_APPENDIXSUBSEC,
         TEXICMD_ASTERISK,          TEXICMD_ASTERISK,
         TEXICMD_AT,          TEXICMD_AT,
         TEXICMD_AUTHOR,          TEXICMD_AUTHOR,
Line 56  enum texicmd {
Line 57  enum texicmd {
         TEXICMD_CITE,          TEXICMD_CITE,
         TEXICMD_CODE,          TEXICMD_CODE,
         TEXICMD_COLON,          TEXICMD_COLON,
           TEXICMD_COLUMNFRACTIONS,
         TEXICMD_COMMAND,          TEXICMD_COMMAND,
         TEXICMD_COMMENT,          TEXICMD_COMMENT,
         TEXICMD_COMMENT_LONG,          TEXICMD_COMMENT_LONG,
Line 95  enum texicmd {
Line 97  enum texicmd {
         TEXICMD_ENV,          TEXICMD_ENV,
         TEXICMD_ERROR,          TEXICMD_ERROR,
         TEXICMD_EXAMPLE,          TEXICMD_EXAMPLE,
           TEXICMD_EXPANSION,
         TEXICMD_FILE,          TEXICMD_FILE,
           TEXICMD_FINALOUT,
           TEXICMD_FINDEX,
           TEXICMD_FTABLE,
           TEXICMD_FORMAT,
         TEXICMD_GRAVE,          TEXICMD_GRAVE,
         TEXICMD_GROUP,          TEXICMD_GROUP,
         TEXICMD_HEADING,          TEXICMD_HEADING,
         TEXICMD_HEADINGS,          TEXICMD_HEADINGS,
           TEXICMD_HEADITEM,
         TEXICMD_HYPHEN,          TEXICMD_HYPHEN,
         TEXICMD_I,          TEXICMD_I,
         TEXICMD_IFCLEAR,          TEXICMD_IFCLEAR,
Line 116  enum texicmd {
Line 124  enum texicmd {
         TEXICMD_IFTEX,          TEXICMD_IFTEX,
         TEXICMD_IFSET,          TEXICMD_IFSET,
         TEXICMD_IFXML,          TEXICMD_IFXML,
           TEXICMD_IGNORE,
         TEXICMD_IMAGE,          TEXICMD_IMAGE,
         TEXICMD_INCLUDE,          TEXICMD_INCLUDE,
         TEXICMD_INDENTBLOCK,          TEXICMD_INDENTBLOCK,
         TEXICMD_INSERTCOPYING,          TEXICMD_INSERTCOPYING,
         TEXICMD_ITEM,          TEXICMD_ITEM,
         TEXICMD_ITEMIZE,          TEXICMD_ITEMIZE,
           TEXICMD_ITEMX,
         TEXICMD_KBD,          TEXICMD_KBD,
           TEXICMD_KEY,
           TEXICMD_KINDEX,
         TEXICMD_LATEX,          TEXICMD_LATEX,
         TEXICMD_MATH,          TEXICMD_MATH,
         TEXICMD_MENU,          TEXICMD_MENU,
           TEXICMD_MULTITABLE,
         TEXICMD_NEED,          TEXICMD_NEED,
         TEXICMD_NEWLINE,          TEXICMD_NEWLINE,
         TEXICMD_NODE,          TEXICMD_NODE,
Line 151  enum texicmd {
Line 164  enum texicmd {
         TEXICMD_SLANTED,          TEXICMD_SLANTED,
         TEXICMD_SP,          TEXICMD_SP,
         TEXICMD_SPACE,          TEXICMD_SPACE,
           TEXICMD_SMALLBOOK,
         TEXICMD_SMALLDISPLAY,          TEXICMD_SMALLDISPLAY,
         TEXICMD_SMALLEXAMPLE,          TEXICMD_SMALLEXAMPLE,
           TEXICMD_SMALLFORMAT,
         TEXICMD_SMALLINDENTBLOCK,          TEXICMD_SMALLINDENTBLOCK,
         TEXICMD_SQUIGGLE_LEFT,          TEXICMD_SQUIGGLE_LEFT,
         TEXICMD_SQUIGGLE_RIGHT,          TEXICMD_SQUIGGLE_RIGHT,
         TEXICMD_STRONG,          TEXICMD_STRONG,
           TEXICMD_SUBHEADING,
         TEXICMD_SUBSECTION,          TEXICMD_SUBSECTION,
         TEXICMD_SUBTITLE,          TEXICMD_SUBTITLE,
           TEXICMD_SYNCODEINDEX,
         TEXICMD_T,          TEXICMD_T,
         TEXICMD_TAB,          TEXICMD_TAB,
           TEXICMD_TABSYM,
         TEXICMD_TABLE,          TEXICMD_TABLE,
         TEXICMD_TEX,          TEXICMD_TEX,
         TEXICMD_TEXSYM,          TEXICMD_TEXSYM,
Line 172  enum texicmd {
Line 190  enum texicmd {
         TEXICMD_UMLAUT,          TEXICMD_UMLAUT,
         TEXICMD_UNNUMBERED,          TEXICMD_UNNUMBERED,
         TEXICMD_UNNUMBEREDSEC,          TEXICMD_UNNUMBEREDSEC,
           TEXICMD_UNNUMBEREDSUBSEC,
         TEXICMD_UREF,          TEXICMD_UREF,
         TEXICMD_URL,          TEXICMD_URL,
         TEXICMD_VAR,          TEXICMD_VAR,
         TEXICMD_VERBATIMINCLUDE,          TEXICMD_VERBATIMINCLUDE,
           TEXICMD_VINDEX,
         TEXICMD_VSKIP,          TEXICMD_VSKIP,
           TEXICMD_VTABLE,
         TEXICMD_W,          TEXICMD_W,
         TEXICMD_XREF,          TEXICMD_XREF,
         TEXICMD__MAX          TEXICMD__MAX
Line 215  enum texilist {
Line 236  enum texilist {
         TEXILIST_NONE = 0,          TEXILIST_NONE = 0,
         TEXILIST_ITEM,          TEXILIST_ITEM,
         TEXILIST_NOITEM,          TEXILIST_NOITEM,
           TEXILIST_TABLE
 };  };
   
 /*  /*
Line 255  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 266  static void doitem(struct texi *, enum texicmd, const 
Line 287  static void doitem(struct texi *, enum texicmd, const 
 static  void doitemize(struct texi *, enum texicmd, const char *, size_t, size_t *);  static  void doitemize(struct texi *, enum texicmd, const char *, size_t, size_t *);
 static  void dolink(struct texi *, enum texicmd, const char *, size_t, size_t *);  static  void dolink(struct texi *, enum texicmd, const char *, size_t, size_t *);
 static  void domath(struct texi *, enum texicmd, const char *, size_t, size_t *);  static  void domath(struct texi *, enum texicmd, const char *, size_t, size_t *);
   static  void domultitable(struct texi *, enum texicmd, const char *, size_t, size_t *);
 static  void doquotation(struct texi *, enum texicmd, const char *, size_t, size_t *);  static  void doquotation(struct texi *, enum texicmd, const char *, size_t, size_t *);
 static  void dotable(struct texi *, enum texicmd, const char *, size_t, size_t *);  static  void dotable(struct texi *, enum texicmd, const char *, size_t, size_t *);
 static  void dotop(struct texi *, enum texicmd, const char *, size_t, size_t *);  static  void dotop(struct texi *, enum texicmd, const char *, size_t, size_t *);
Line 273  static void dosection(struct texi *, enum texicmd, con
Line 295  static void dosection(struct texi *, enum texicmd, con
 static  void dosp(struct texi *, enum texicmd, const char *, size_t, size_t *);  static  void dosp(struct texi *, enum texicmd, const char *, size_t, size_t *);
 static  void dosubsection(struct texi *, enum texicmd, const char *, size_t, size_t *);  static  void dosubsection(struct texi *, enum texicmd, const char *, size_t, size_t *);
 static  void dosymbol(struct texi *, enum texicmd, const char *, size_t, size_t *);  static  void dosymbol(struct texi *, enum texicmd, const char *, size_t, size_t *);
   static  void dotab(struct texi *, enum texicmd, const char *, size_t, size_t *);
 static  void dotitle(struct texi *, enum texicmd, const char *, size_t, size_t *);  static  void dotitle(struct texi *, enum texicmd, const char *, size_t, size_t *);
 static  void doverbinclude(struct texi *, enum texicmd, const char *, size_t, size_t *);  static  void doverbinclude(struct texi *, enum texicmd, const char *, size_t, size_t *);
   
 static  const struct texitok texitoks[TEXICMD__MAX] = {  static  const struct texitok texitoks[TEXICMD__MAX] = {
           /* TEXICMD__BEGIN */
         { doignargn, "acronym", 7 }, /* TEXICMD_ACRONYM */          { doignargn, "acronym", 7 }, /* TEXICMD_ACRONYM */
         { doaccent, "'", 1 }, /* TEXICMD_ACUTE */          { doaccent, "'", 1 }, /* TEXICMD_ACUTE */
         { doignline, "afourpaper", 10 }, /* TEXICMD_A4PAPER */          { doignline, "afourpaper", 10 }, /* TEXICMD_A4PAPER */
         { doignbracket, "anchor", 6 }, /* TEXICMD_ANCHOR */          { doignbracket, "anchor", 6 }, /* TEXICMD_ANCHOR */
         { dosection, "appendix", 8 }, /* TEXICMD_APPENDIX */          { dosection, "appendix", 8 }, /* TEXICMD_APPENDIX */
         { dosection, "appendixsec", 11 }, /* TEXICMD_APPENDIXSEC */          { dosection, "appendixsec", 11 }, /* TEXICMD_APPENDIXSEC */
           { dosubsection, "appendixsubsec", 14 }, /* TEXICMD_APPENDIXSUBSEC */
         { 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 294  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 */
         { doinline, "command", 7 }, /* TEXICMD_COMMAND */          { doinline, "command", 7 }, /* TEXICMD_COMMAND */
         { doignline, "c", 1 }, /* TEXICMD_COMMENT */          { doignline, "c", 1 }, /* TEXICMD_COMMENT */
         { doignline, "comment", 7 }, /* TEXICMD_COMMENT_LONG */          { doignline, "comment", 7 }, /* TEXICMD_COMMENT_LONG */
Line 324  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 */
         { dosymbol, "error", 5 }, /* TEXICMD_ERROR */          { dosymbol, "error", 5 }, /* TEXICMD_ERROR */
         { doexample, "example", 7 }, /* TEXICMD_EXAMPLE */          { doexample, "example", 7 }, /* TEXICMD_EXAMPLE */
           { dosymbol, "expansion", 9 }, /* TEXICMD_EXPANSION */
         { doinline, "file", 4 }, /* TEXICMD_FILE */          { doinline, "file", 4 }, /* TEXICMD_FILE */
           { doignline, "finalout", 8 }, /* TEXICMD_FINALOUT */
           { doignline, "findex", 6 }, /* TEXICMD_FINDEX */
           { dotable, "ftable", 6 }, /* TEXICMD_FTABLE */
           { dodisplay, "format", 6 }, /* TEXICMD_FORMAT */
         { doaccent, "`", 1 }, /* TEXICMD_GRAVE */          { doaccent, "`", 1 }, /* TEXICMD_GRAVE */
         { doblock, "group", 5 }, /* TEXICMD_GROUP */          { doblock, "group", 5 }, /* TEXICMD_GROUP */
         { dosection, "heading", 7 }, /* TEXICMD_HEADING */          { dosection, "heading", 7 }, /* TEXICMD_HEADING */
         { doignline, "headings", 8 }, /* TEXICMD_HEADINGS */          { doignline, "headings", 8 }, /* TEXICMD_HEADINGS */
           { 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 357  static const struct texitok texitoks[TEXICMD__MAX] = {
Line 389  static const struct texitok texitoks[TEXICMD__MAX] = {
         { doignblock, "iftex", 5 }, /* TEXICMD_IFTEX */          { doignblock, "iftex", 5 }, /* TEXICMD_IFTEX */
         { doignblock, "ifset", 5 }, /* TEXICMD_IFSET */          { doignblock, "ifset", 5 }, /* TEXICMD_IFSET */
         { doignblock, "ifxml", 5 }, /* TEXICMD_IFXML */          { doignblock, "ifxml", 5 }, /* TEXICMD_IFXML */
           { doignblock, "ignore", 6 }, /* TEXICMD_IGNORE */
         { doignbracket, "image", 5 }, /* TEXICMD_IMAGE */          { doignbracket, "image", 5 }, /* TEXICMD_IMAGE */
         { doinclude, "include", 7 }, /* TEXICMD_INCLUDE */          { doinclude, "include", 7 }, /* TEXICMD_INCLUDE */
         { dodisplay, "indentblock", 11 }, /* TEXICMD_INDENTBLOCK */          { dodisplay, "indentblock", 11 }, /* TEXICMD_INDENTBLOCK */
         { doignline, "insertcopying", 13 }, /* TEXICMD_INSERTCOPYING */          { doignline, "insertcopying", 13 }, /* TEXICMD_INSERTCOPYING */
         { doitem, "item", 4 }, /* TEXICMD_ITEM */          { doitem, "item", 4 }, /* TEXICMD_ITEM */
         { doitemize, "itemize", 7 }, /* TEXICMD_ITEMIZE */          { doitemize, "itemize", 7 }, /* TEXICMD_ITEMIZE */
         { dofont, "kbd", 3 }, /* TEXICMD_KBD */          { doitem, "itemx", 5 }, /* TEXICMD_ITEMX */
           { doinline, "kbd", 3 }, /* TEXICMD_KBD */
           { dobracket, "key", 3 }, /* TEXICMD_KEY */
           { doignline, "kindex", 6 }, /* TEXICMD_KINDEX */
         { dosymbol, "LaTeX", 5 }, /* TEXICMD_LATEX */          { dosymbol, "LaTeX", 5 }, /* TEXICMD_LATEX */
         { domath, "math", 4 }, /* TEXICMD_MATH */          { domath, "math", 4 }, /* TEXICMD_MATH */
         { doignblock, "menu", 4 }, /* TEXICMD_MENU */          { doignblock, "menu", 4 }, /* TEXICMD_MENU */
           { domultitable, "multitable", 10 }, /* TEXICMD_MULTITABLE */
         { doignline, "need", 4 }, /* TEXICMD_NEED */          { doignline, "need", 4 }, /* TEXICMD_NEED */
         { dosymbol, "\n", 1 }, /* TEXICMD_NEWLINE */          { dosymbol, "\n", 1 }, /* TEXICMD_NEWLINE */
         { doignline, "node", 4 }, /* TEXICMD_NODE */          { doignline, "node", 4 }, /* TEXICMD_NODE */
Line 378  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 */
         { dodisplay, "smalldisplay", 12 }, /* TEXICMD_SMALLDISPLAY */          { dodisplay, "smalldisplay", 12 }, /* TEXICMD_SMALLDISPLAY */
         { doexample, "smallexample", 12 }, /* TEXICMD_SMALLEXAMPLE */          { doexample, "smallexample", 12 }, /* TEXICMD_SMALLEXAMPLE */
           { dodisplay, "smallformat", 11 }, /* TEXICMD_SMALLFORMAT */
         { 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, "subsection", 10 }, /* TEXICMD_SUBSECTION */          { dosubsection, "subsection", 10 }, /* TEXICMD_SUBSECTION */
         { doignline, "subtitle", 8 }, /* TEXICMD_SUBTITLE */          { doignline, "subtitle", 8 }, /* TEXICMD_SUBTITLE */
         { dofont, "t", 1 }, /* TEXICMD_T */          { doignline, "syncodeindex", 12 }, /* TEXICMD_SYNCODEINDEX */
         { dosymbol, "\t", 1 }, /* TEXICMD_TAB */          { doinline, "t", 1 }, /* TEXICMD_T */
           { dotab, "tab", 3 }, /* TEXICMD_TAB */
           { dosymbol, "\t", 1 }, /* TEXICMD_TABSYM */
         { dotable, "table", 5 }, /* TEXICMD_TABLE */          { dotable, "table", 5 }, /* TEXICMD_TABLE */
         { doignblock, "tex", 3 }, /* TEXICMD_TEX */          { doignblock, "tex", 3 }, /* TEXICMD_TEX */
         { dosymbol, "TeX", 3 }, /* TEXICMD_TEXSYM */          { dosymbol, "TeX", 3 }, /* TEXICMD_TEXSYM */
Line 413  static const struct texitok texitoks[TEXICMD__MAX] = {
Line 455  static const struct texitok texitoks[TEXICMD__MAX] = {
         { doaccent, "\"", 1 }, /* TEXICMD_UMLAUT */          { doaccent, "\"", 1 }, /* TEXICMD_UMLAUT */
         { dosection, "unnumbered", 10 }, /* TEXICMD_UNNUMBERED */          { dosection, "unnumbered", 10 }, /* TEXICMD_UNNUMBERED */
         { dosection, "unnumberedsec", 13 }, /* TEXICMD_UNNUMBEREDSEC */          { dosection, "unnumberedsec", 13 }, /* TEXICMD_UNNUMBEREDSEC */
           { dosubsection, "unnumberedsubsec", 16 }, /* TEXICMD_UNNUMBEREDSUBSEC */
         { dolink, "uref", 4 }, /* TEXICMD_UREF */          { dolink, "uref", 4 }, /* TEXICMD_UREF */
         { dolink, "url", 3 }, /* TEXICMD_URL */          { dolink, "url", 3 }, /* TEXICMD_URL */
         { doinline, "var", 3 }, /* TEXICMD_VAR */          { doinline, "var", 3 }, /* TEXICMD_VAR */
         { doverbinclude, "verbatiminclude", 15 }, /* TEXICMD_VERBATIMINCLUDE */          { doverbinclude, "verbatiminclude", 15 }, /* TEXICMD_VERBATIMINCLUDE */
           { doignline, "vindex", 6 }, /* TEXICMD_VINDEX */
         { dosp, "vskip", 5 }, /* TEXICMD_VSKIP */          { dosp, "vskip", 5 }, /* TEXICMD_VSKIP */
           { dotable, "vtable", 6 }, /* TEXICMD_VTABLE */
         { dobracket, "w", 1 }, /* TEXICMD_W */          { dobracket, "w", 1 }, /* TEXICMD_W */
         { dolink, "xref", 4 }, /* TEXICMD_XREF */          { dolink, "xref", 4 }, /* TEXICMD_XREF */
           /* TEXICMD__END */
 };  };
   
 /*  /*
Line 515  texierr(struct texi *p, const char *fmt, ...)
Line 561  texierr(struct texi *p, const char *fmt, ...)
 /*  /*
  * Put a single data character to the output if we're not ignoring.   * Put a single data character to the output if we're not ignoring.
  * Adjusts our output status.   * Adjusts our output status.
    * This shouldn't be called for macros: just for ordinary text.
  */   */
 static void  static void
 texiputchar(struct texi *p, char c)  texiputchar(struct texi *p, char c)
Line 522  texiputchar(struct texi *p, char c)
Line 569  texiputchar(struct texi *p, char c)
   
         if (p->ign)          if (p->ign)
                 return;                  return;
   
           if ('.' == c && 0 == p->outcol)
                   fputs("\\&", stdout);
   
         putchar(c);          putchar(c);
         p->seenvs = 0;          p->seenvs = 0;
         if ('\n' == c) {          if ('\n' == c) {
Line 533  texiputchar(struct texi *p, char c)
Line 584  texiputchar(struct texi *p, char c)
   
 /*  /*
  * Put multiple characters (see texiputchar()).   * Put multiple characters (see texiputchar()).
    * This shouldn't be called for macros: just for ordinary text.
  */   */
 static void  static void
 texiputchars(struct texi *p, const char *s)  texiputchars(struct texi *p, const char *s)
Line 550  static void
Line 602  static void
 teximacroclose(struct texi *p)  teximacroclose(struct texi *p)
 {  {
   
         /* FIXME: punctuation. */          if (p->ign)
         if (0 == --p->outmacro)                  return;
                 texiputchar(p, '\n');  
           if (0 == --p->outmacro) {
                   putchar('\n');
                   p->outcol = p->seenws = 0;
           }
 }  }
   
 /*  /*
Line 563  teximacroclose(struct texi *p)
Line 619  teximacroclose(struct texi *p)
 static void  static void
 teximacroopen(struct texi *p, const char *s)  teximacroopen(struct texi *p, const char *s)
 {  {
           int      rc;
   
         if (p->outcol && 0 == p->outmacro)          if (p->ign)
                 texiputchar(p, '\n');                  return;
   
           if (p->outcol && 0 == p->outmacro) {
                   putchar('\n');
                   p->outcol = 0;
           }
   
         if (0 == p->outmacro)          if (0 == p->outmacro)
                 texiputchar(p, '.');                  putchar('.');
         else          else
                 texiputchar(p, ' ');                  putchar(' ');
         texiputchars(p, s);  
         texiputchar(p, ' ');          if (EOF != (rc = fputs(s, stdout)))
                   p->outcol += rc;
   
           putchar(' ');
           p->outcol++;
         p->outmacro++;          p->outmacro++;
         p->seenws = 0;          p->seenws = 0;
 }  }
Line 583  static void
Line 650  static void
 teximacro(struct texi *p, const char *s)  teximacro(struct texi *p, const char *s)
 {  {
   
           if (p->ign)
                   return;
   
         if (p->outmacro)          if (p->outmacro)
                 texierr(p, "\"%s\" in open line scope!?", s);                  texierr(p, "\"%s\" in open line scope!?", s);
         else if (p->literal)          if (p->literal)
                 texierr(p, "\"%s\" in a literal scope!?", s);                  texierr(p, "\"%s\" in a literal scope!?", s);
   
         if (p->outcol)          if (p->outcol)
                 texiputchar(p, '\n');                  putchar('\n');
   
         texiputchar(p, '.');          putchar('.');
         texiputchars(p, s);          puts(s);
         texiputchar(p, '\n');          p->outcol = p->seenws = 0;
 }  }
   
 static void  static void
Line 729  texiword(struct texi *p, const char *buf, 
Line 799  texiword(struct texi *p, const char *buf, 
         size_t sz, size_t *pos, char extra)          size_t sz, size_t *pos, char extra)
 {  {
   
         if (0 == p->outmacro && p->outcol > 72 && 0 == p->literal)          if (p->seenws && 0 == p->outmacro && p->outcol > 72 && 0 == p->literal)
                 texiputchar(p, '\n');                  texiputchar(p, '\n');
         /* FIXME: abstract this: we use it elsewhere. */          /* FIXME: abstract this: we use it elsewhere. */
         if (p->seenws && p->outcol && 0 == p->literal)          if (p->seenws && p->outcol && 0 == p->literal)
Line 917  parseeoln(struct texi *p, const char *buf, size_t sz, 
Line 987  parseeoln(struct texi *p, const char *buf, size_t sz, 
         size_t           end;          size_t           end;
         enum texicmd     cmd;          enum texicmd     cmd;
   
         assert(0 == p->literal);  
   
         while (*pos < sz && '\n' != buf[*pos]) {          while (*pos < sz && '\n' != buf[*pos]) {
                 while (*pos < sz && isws(buf[*pos])) {                  while (*pos < sz && isws(buf[*pos])) {
                         p->seenws = 1;                          p->seenws = 1;
                           if (p->literal)
                                   texiputchar(p, buf[*pos]);
                         advance(p, buf, pos);                          advance(p, buf, pos);
                 }                  }
                 switch (buf[*pos]) {                  switch (buf[*pos]) {
Line 1278  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 1297  doinline(struct texi *p, enum texicmd cmd,
Line 1384  doinline(struct texi *p, enum texicmd cmd,
                 macro = "Va";                  macro = "Va";
                 break;                  break;
         default:          default:
                 abort();                  break;
         }          }
   
         if (p->literal) {          if (NULL == macro || p->literal) {
                 parsebracket(p, buf, sz, pos);                  parsebracket(p, buf, sz, pos);
                 return;                  return;
         }          }
Line 1400  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();  
         }  
   
         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 1447  dodisplay(struct texi *p, enum texicmd cmd, 
Line 1499  dodisplay(struct texi *p, enum texicmd cmd, 
         const char *buf, size_t sz, size_t *pos)          const char *buf, size_t sz, size_t *pos)
 {  {
   
         teximacro(p, "Bd -filled -offset indent");          switch (cmd) {
           case (TEXICMD_FORMAT):
           case (TEXICMD_SMALLFORMAT):
                   teximacro(p, "Bd -filled");
                   break;
           default:
                   teximacro(p, "Bd -filled -offset indent");
                   break;
           }
   
         p->seenvs = 1;          p->seenvs = 1;
         /* FIXME: ignore and parseeoln. */          /* FIXME: ignore and parseeoln. */
         advanceeoln(p, buf, sz, pos, 1);          advanceeoln(p, buf, sz, pos, 1);
Line 1592  dosymbol(struct texi *p, enum texicmd cmd, 
Line 1653  dosymbol(struct texi *p, enum texicmd cmd, 
         case (TEXICMD_ASTERISK):          case (TEXICMD_ASTERISK):
         case (TEXICMD_NEWLINE):          case (TEXICMD_NEWLINE):
         case (TEXICMD_SPACE):          case (TEXICMD_SPACE):
         case (TEXICMD_TAB):          case (TEXICMD_TABSYM):
                 texiputchar(p, ' ');                  texiputchar(p, ' ');
                 break;                  break;
         case (TEXICMD_AT):          case (TEXICMD_AT):
Line 1613  dosymbol(struct texi *p, enum texicmd cmd, 
Line 1674  dosymbol(struct texi *p, enum texicmd cmd, 
         case (TEXICMD_ERROR):          case (TEXICMD_ERROR):
                 texiputchars(p, "error\\(->");                  texiputchars(p, "error\\(->");
                 break;                  break;
           case (TEXICMD_EXPANSION):
                   texiputchars(p, "\\(->");
                   break;
         case (TEXICMD_LATEX):          case (TEXICMD_LATEX):
                 texiputchars(p, "LaTeX");                  texiputchars(p, "LaTeX");
                 break;                  break;
Line 1747  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 1806  dotop(struct texi *p, enum texicmd cmd, 
Line 1871  dotop(struct texi *p, enum texicmd cmd, 
         time_t           t;          time_t           t;
         char             date[32];          char             date[32];
   
           /*
            * Here we print our standard mdoc(7) prologue.
            * We use the title set with @settitle for the `Nd' description
            * and the source document filename (the first one as invoked on
            * the command line) for the title.
            * The date is set to the current date.
            */
         t = time(NULL);          t = time(NULL);
         strftime(date, sizeof(date), "%F", localtime(&t));          strftime(date, sizeof(date), "%F", localtime(&t));
   
Line 1836  doitem(struct texi *p, enum texicmd cmd, 
Line 1908  doitem(struct texi *p, enum texicmd cmd, 
         const char *buf, size_t sz, size_t *pos)          const char *buf, size_t sz, size_t *pos)
 {  {
   
           /* Multitable is using raw tbl(7). */
           if (TEXILIST_TABLE == p->list) {
                   texiputchar(p, '\n');
                   return;
           }
   
         if (p->outmacro)          if (p->outmacro)
                 texierr(p, "item in open line scope!?");                  texierr(p, "item in open line scope!?");
         else if (p->literal)          else if (p->literal)
Line 1852  doitem(struct texi *p, enum texicmd cmd, 
Line 1930  doitem(struct texi *p, enum texicmd cmd, 
                 texivspace(p);                  texivspace(p);
                 break;                  break;
         }          }
         p->seenvs = 1;  
   
           /* Trick so we don't start with Pp. */
           p->seenvs = 1;
         parseeoln(p, buf, sz, pos);          parseeoln(p, buf, sz, pos);
   
         if (TEXILIST_ITEM == p->list)          if (TEXILIST_ITEM == p->list)
Line 1863  doitem(struct texi *p, enum texicmd cmd, 
Line 1942  doitem(struct texi *p, enum texicmd cmd, 
 }  }
   
 static void  static void
   dotab(struct texi *p, enum texicmd cmd,
           const char *buf, size_t sz, size_t *pos)
   {
   
           /* This command is only useful in @multitable. */
           if (TEXILIST_TABLE == p->list)
                   texiputchar(p, '\t');
   }
   
   static void
   domultitable(struct texi *p, enum texicmd cmd,
           const char *buf, size_t sz, size_t *pos)
   {
           enum texilist   sv = p->list;
           enum texicmd    type;
           size_t          i, end, columns;
   
           p->list = TEXILIST_TABLE;
           teximacro(p, "TS");
           columns = 0;
   
           /* Advance to the first argument... */
           while (*pos < sz && isws(buf[*pos]))
                   advance(p, buf, pos);
   
           /* Make sure we don't print anything when scanning. */
           p->ign++;
           if ('@' == buf[*pos]) {
                   /*
                    * Look for @columnfractions.
                    * We ignore these, but we do use the number of
                    * arguments to set the number of columns that we'll
                    * have.
                    */
                   type = texicmd(p, buf, *pos, sz, &end);
                   advanceto(p, buf, pos, end);
                   if (TEXICMD_COLUMNFRACTIONS != type)
                           texierr(p, "unknown multitable type");
                   while (*pos < sz && '\n' != buf[*pos]) {
                           while (*pos < sz && isws(buf[*pos]))
                                   advance(p, buf, pos);
                           while (*pos < sz && ! isws(buf[*pos])) {
                                   if ('\n' == buf[*pos])
                                           break;
                                   advance(p, buf, pos);
                           }
                           columns++;
                   }
           } else
                   /*
                    * We have arguments.
                    * We could parse these, but it's easier to just let
                    * tbl(7) figure it out.
                    * So use this only to count arguments.
                    */
                   while (parselinearg(p, buf, sz, pos) > 0)
                           columns++;
           p->ign--;
   
           /* Left-justify each table entry. */
           for (i = 0; i < columns; i++) {
                   if (i > 0)
                           texiputchar(p, ' ');
                   texiputchar(p, 'l');
           }
           texiputchars(p, ".\n");
           p->outmacro++;
           parseto(p, buf, sz, pos, texitoks[cmd].tok);
           p->outmacro--;
           teximacro(p, "TE");
           p->list = sv;
   }
   
   static void
 dotable(struct texi *p, enum texicmd cmd,  dotable(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 1873  dotable(struct texi *p, enum texicmd cmd, 
Line 2026  dotable(struct texi *p, enum texicmd cmd, 
         /* FIXME: ignore and parseeoln. */          /* FIXME: ignore and parseeoln. */
         advanceeoln(p, buf, sz, pos, 1);          advanceeoln(p, buf, sz, pos, 1);
         p->seenvs = 1;          p->seenvs = 1;
         parseto(p, buf, sz, pos, "table");          parseto(p, buf, sz, pos, texitoks[cmd].tok);
         teximacro(p, "El");          teximacro(p, "El");
         p->list = sv;          p->list = sv;
 }  }
Line 1900  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.16  
changed lines
  Added in v.1.22

CVSweb