version 1.20, 2015/02/19 16:15:17 |
version 1.23, 2015/02/19 20:55:56 |
|
|
TEXICMD_APPENDIX, |
TEXICMD_APPENDIX, |
TEXICMD_APPENDIXSEC, |
TEXICMD_APPENDIXSEC, |
TEXICMD_APPENDIXSUBSEC, |
TEXICMD_APPENDIXSUBSEC, |
|
TEXICMD_APPENDIXSUBSUBSEC, |
TEXICMD_ASTERISK, |
TEXICMD_ASTERISK, |
TEXICMD_AT, |
TEXICMD_AT, |
TEXICMD_AUTHOR, |
TEXICMD_AUTHOR, |
|
|
TEXICMD_KEY, |
TEXICMD_KEY, |
TEXICMD_KINDEX, |
TEXICMD_KINDEX, |
TEXICMD_LATEX, |
TEXICMD_LATEX, |
|
TEXICMD_LOWERSECTIONS, |
TEXICMD_MATH, |
TEXICMD_MATH, |
TEXICMD_MENU, |
TEXICMD_MENU, |
TEXICMD_MULTITABLE, |
TEXICMD_MULTITABLE, |
|
|
TEXICMD_PARINDENT, |
TEXICMD_PARINDENT, |
TEXICMD_PRINTINDEX, |
TEXICMD_PRINTINDEX, |
TEXICMD_R, |
TEXICMD_R, |
|
TEXICMD_RAISESECTIONS, |
TEXICMD_REF, |
TEXICMD_REF, |
TEXICMD_RESULT, |
TEXICMD_RESULT, |
TEXICMD_SAMP, |
TEXICMD_SAMP, |
|
|
TEXICMD_STRONG, |
TEXICMD_STRONG, |
TEXICMD_SUBHEADING, |
TEXICMD_SUBHEADING, |
TEXICMD_SUBSECTION, |
TEXICMD_SUBSECTION, |
|
TEXICMD_SUBSUBSECTION, |
TEXICMD_SUBTITLE, |
TEXICMD_SUBTITLE, |
TEXICMD_SYNCODEINDEX, |
TEXICMD_SYNCODEINDEX, |
TEXICMD_T, |
TEXICMD_T, |
|
|
TEXICMD_UNNUMBERED, |
TEXICMD_UNNUMBERED, |
TEXICMD_UNNUMBEREDSEC, |
TEXICMD_UNNUMBEREDSEC, |
TEXICMD_UNNUMBEREDSUBSEC, |
TEXICMD_UNNUMBEREDSUBSEC, |
|
TEXICMD_UNNUMBEREDSUBSUBSEC, |
TEXICMD_UREF, |
TEXICMD_UREF, |
TEXICMD_URL, |
TEXICMD_URL, |
TEXICMD_VAR, |
TEXICMD_VAR, |
|
|
TEXICMD__MAX |
TEXICMD__MAX |
}; |
}; |
|
|
|
#define SECTSZ 4 |
|
static const char *const sects[SECTSZ] = { |
|
"Sh", |
|
"Ss", |
|
"Em", |
|
"No", |
|
}; |
|
|
/* |
/* |
* The file currently being parsed. |
* The file currently being parsed. |
* This keeps track of our location within that file. |
* This keeps track of our location within that file. |
|
|
size_t dirsz; /* number of texi directories */ |
size_t dirsz; /* number of texi directories */ |
char *title; /* title of document */ |
char *title; /* title of document */ |
char *subtitle; /* subtitle of document */ |
char *subtitle; /* subtitle of document */ |
|
int secoffs; /* see sectioner() */ |
/* |
/* |
* The following control what we output to the screen. |
* The following control what we output to the screen. |
* The complexity is required to accomodate for mdoc(7). |
* The complexity is required to accomodate for mdoc(7). |
Line 277 static void dodefn(struct texi *, enum texicmd, const |
|
Line 291 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 292 static void domultitable(struct texi *, enum texicmd, |
|
Line 305 static void domultitable(struct texi *, enum texicmd, |
|
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 *); |
|
static void dosecoffs(struct texi *, enum texicmd, const char *, size_t, size_t *); |
static void dosection(struct texi *, enum texicmd, const char *, size_t, size_t *); |
static void dosection(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 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 dosubsubsection(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 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 *); |
Line 309 static const struct texitok texitoks[TEXICMD__MAX] = { |
|
Line 324 static const struct texitok texitoks[TEXICMD__MAX] = { |
|
{ 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 */ |
{ dosubsection, "appendixsubsec", 14 }, /* TEXICMD_APPENDIXSUBSEC */ |
|
{ dosubsubsection, "appendixsubsubsec", 17 }, /* TEXICMD_APPENDIXSUBSUBSEC */ |
{ 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 336 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 367 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 391 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 414 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 */ |
|
{ dosecoffs, "lowersections", 13 }, /* TEXICMD_LOWERSECTIONS */ |
{ 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 */ |
{ domultitable, "multitable", 10 }, /* TEXICMD_MULTITABLE */ |
Line 416 static const struct texitok texitoks[TEXICMD__MAX] = { |
|
Line 433 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 */ |
|
{ dosecoffs, "raisesections", 13 }, /* TEXICMD_RAISESECTIONS */ |
{ 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 455 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 */ |
|
{ dosubsubsection, "subsubsection", 13 }, /* TEXICMD_SUBSUBSECTION */ |
{ 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 457 static const struct texitok texitoks[TEXICMD__MAX] = { |
|
Line 476 static const struct texitok texitoks[TEXICMD__MAX] = { |
|
{ 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 */ |
{ dosubsection, "unnumberedsubsec", 16 }, /* TEXICMD_UNNUMBEREDSUBSEC */ |
|
{ dosubsubsection, "unnumberedsubsubsec", 19 }, /* TEXICMD_UNNUMBEREDSUBSUBSEC */ |
{ 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 */ |
|
|
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 1368 doinline(struct texi *p, enum texicmd cmd, |
|
Line 1405 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 1471 doinclude(struct texi *p, enum texicmd cmd, |
|
Line 1508 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 1824 doignargn(struct texi *p, enum texicmd cmd, |
|
Line 1822 doignargn(struct texi *p, enum texicmd cmd, |
|
p->ign--; |
p->ign--; |
} |
} |
|
|
|
/* |
|
* Sections can be made subsections and so on by way of the |
|
* @raiseections and @lowersections commands. |
|
* Perform this check here and return the actual section number adjusted |
|
* to the raise level. |
|
*/ |
|
static int |
|
sectioner(struct texi *p, int sec) |
|
{ |
|
|
|
if ((sec -= p->secoffs) < 0) { |
|
texiwarn(p, "section below minimum, clamping"); |
|
return(0); |
|
} else if (sec >= SECTSZ) { |
|
texiwarn(p, "section above maximum, clamping"); |
|
return(SECTSZ - 1); |
|
} |
|
return(sec); |
|
} |
|
|
static void |
static void |
|
dosubsubsection(struct texi *p, enum texicmd cmd, |
|
const char *buf, size_t sz, size_t *pos) |
|
{ |
|
int sec; |
|
|
|
sec = sectioner(p, 3); |
|
|
|
/* We don't have a subsubsubsection, so make one up. */ |
|
texivspace(p); |
|
teximacroopen(p, sects[sec]); |
|
parseeoln(p, buf, sz, pos); |
|
teximacroclose(p); |
|
texivspace(p); |
|
} |
|
|
|
static void |
dosubsection(struct texi *p, enum texicmd cmd, |
dosubsection(struct texi *p, enum texicmd cmd, |
const char *buf, size_t sz, size_t *pos) |
const char *buf, size_t sz, size_t *pos) |
{ |
{ |
|
int sec; |
|
|
|
sec = sectioner(p, 2); |
|
|
if (p->outmacro) |
if (p->outmacro) |
texierr(p, "\"Em\" in open line scope!?"); |
texierr(p, "\"%s\" in open line scope!?", sects[sec]); |
else if (p->literal) |
else if (p->literal) |
texierr(p, "\"Em\" in a literal scope!?"); |
texierr(p, "\"%s\" in a literal scope!?", sects[sec]); |
|
|
|
/* We don't have a subsubsection, so make one up. */ |
texivspace(p); |
texivspace(p); |
teximacroopen(p, "Em"); |
teximacroopen(p, sects[sec]); |
parseeoln(p, buf, sz, pos); |
parseeoln(p, buf, sz, pos); |
teximacroclose(p); |
teximacroclose(p); |
texivspace(p); |
texivspace(p); |
} |
} |
|
|
static void |
static void |
|
dosecoffs(struct texi *p, enum texicmd cmd, |
|
const char *buf, size_t sz, size_t *pos) |
|
{ |
|
|
|
if (TEXICMD_RAISESECTIONS == cmd) |
|
p->secoffs++; |
|
else |
|
p->secoffs--; |
|
} |
|
|
|
static void |
dosection(struct texi *p, enum texicmd cmd, |
dosection(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 *blk; |
int sec; |
|
|
switch (cmd) { |
switch (cmd) { |
case (TEXICMD_APPENDIX): |
case (TEXICMD_APPENDIX): |
case (TEXICMD_CHAPTER): |
case (TEXICMD_CHAPTER): |
case (TEXICMD_TOP): |
case (TEXICMD_TOP): |
case (TEXICMD_UNNUMBERED): |
case (TEXICMD_UNNUMBERED): |
blk = "Sh"; |
sec = sectioner(p, 0); |
break; |
break; |
case (TEXICMD_APPENDIXSEC): |
case (TEXICMD_APPENDIXSEC): |
case (TEXICMD_HEADING): |
case (TEXICMD_HEADING): |
case (TEXICMD_SECTION): |
case (TEXICMD_SECTION): |
case (TEXICMD_UNNUMBEREDSEC): |
case (TEXICMD_UNNUMBEREDSEC): |
blk = "Ss"; |
sec = sectioner(p, 1); |
break; |
break; |
default: |
default: |
abort(); |
abort(); |
} |
} |
|
|
if (p->outmacro) |
if (p->outmacro) |
texierr(p, "%s in open line scope!?", blk); |
texierr(p, "\"%s\" in open line scope!?", sects[sec]); |
else if (p->literal) |
else if (p->literal) |
texierr(p, "%s in a literal scope!?", blk); |
texierr(p, "\"%s\" in a literal scope!?", sects[sec]); |
|
|
teximacroopen(p, blk); |
teximacroopen(p, sects[sec]); |
parseeoln(p, buf, sz, pos); |
parseeoln(p, buf, sz, pos); |
teximacroclose(p); |
teximacroclose(p); |
p->seenvs = 1; |
p->seenvs = 1; |
Line 2075 doitemize(struct texi *p, enum texicmd cmd, |
|
Line 2124 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. */ |