version 1.16, 2015/02/19 10:20:31 |
version 1.19, 2015/02/19 15:40:44 |
|
|
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, |
|
|
TEXICMD_ENV, |
TEXICMD_ENV, |
TEXICMD_ERROR, |
TEXICMD_ERROR, |
TEXICMD_EXAMPLE, |
TEXICMD_EXAMPLE, |
|
TEXICMD_EXPANSION, |
TEXICMD_FILE, |
TEXICMD_FILE, |
|
TEXICMD_FINALOUT, |
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, |
|
|
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_KEY, |
TEXICMD_KBD, |
TEXICMD_KBD, |
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, |
|
|
TEXICMD_SLANTED, |
TEXICMD_SLANTED, |
TEXICMD_SP, |
TEXICMD_SP, |
TEXICMD_SPACE, |
TEXICMD_SPACE, |
|
TEXICMD_SMALLBOOK, |
TEXICMD_SMALLDISPLAY, |
TEXICMD_SMALLDISPLAY, |
TEXICMD_SMALLEXAMPLE, |
TEXICMD_SMALLEXAMPLE, |
TEXICMD_SMALLINDENTBLOCK, |
TEXICMD_SMALLINDENTBLOCK, |
|
|
TEXICMD_SUBTITLE, |
TEXICMD_SUBTITLE, |
TEXICMD_T, |
TEXICMD_T, |
TEXICMD_TAB, |
TEXICMD_TAB, |
|
TEXICMD_TABSYM, |
TEXICMD_TABLE, |
TEXICMD_TABLE, |
TEXICMD_TEX, |
TEXICMD_TEX, |
TEXICMD_TEXSYM, |
TEXICMD_TEXSYM, |
|
|
TEXICMD_URL, |
TEXICMD_URL, |
TEXICMD_VAR, |
TEXICMD_VAR, |
TEXICMD_VERBATIMINCLUDE, |
TEXICMD_VERBATIMINCLUDE, |
|
TEXICMD_VINDEX, |
TEXICMD_VSKIP, |
TEXICMD_VSKIP, |
TEXICMD_W, |
TEXICMD_W, |
TEXICMD_XREF, |
TEXICMD_XREF, |
|
|
TEXILIST_NONE = 0, |
TEXILIST_NONE = 0, |
TEXILIST_ITEM, |
TEXILIST_ITEM, |
TEXILIST_NOITEM, |
TEXILIST_NOITEM, |
|
TEXILIST_TABLE |
}; |
}; |
|
|
/* |
/* |
Line 266 static void doitem(struct texi *, enum texicmd, const |
|
Line 277 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 285 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 *); |
|
|
Line 297 static const struct texitok texitoks[TEXICMD__MAX] = { |
|
Line 310 static const struct texitok texitoks[TEXICMD__MAX] = { |
|
{ dofont, "code", 4 }, /* TEXICMD_CODE */ |
{ dofont, "code", 4 }, /* TEXICMD_CODE */ |
{ dofont, "cite", 4 }, /* TEXICMD_CITE */ |
{ dofont, "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 336 static const struct texitok texitoks[TEXICMD__MAX] = { |
|
Line 350 static const struct texitok texitoks[TEXICMD__MAX] = { |
|
{ 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 */ |
{ 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 */ |
{ dofont, "i", 1 }, /* TEXICMD_I */ |
{ doignblock, "ifclear", 7 }, /* TEXICMD_IFCLEAR */ |
{ doignblock, "ifclear", 7 }, /* TEXICMD_IFCLEAR */ |
Line 357 static const struct texitok texitoks[TEXICMD__MAX] = { |
|
Line 374 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 */ |
|
{ dobracket, "key", 3 }, /* TEXICMD_KEY */ |
{ dofont, "kbd", 3 }, /* TEXICMD_KBD */ |
{ dofont, "kbd", 3 }, /* TEXICMD_KBD */ |
{ 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 392 static const struct texitok texitoks[TEXICMD__MAX] = { |
|
Line 412 static const struct texitok texitoks[TEXICMD__MAX] = { |
|
{ dofont, "slanted", 7 }, /* TEXICMD_SLANTED */ |
{ dofont, "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, "smallindentblock", 16 }, /* TEXICMD_SMALLINDENTBLOCK */ |
{ dodisplay, "smallindentblock", 16 }, /* TEXICMD_SMALLINDENTBLOCK */ |
Line 401 static const struct texitok texitoks[TEXICMD__MAX] = { |
|
Line 422 static const struct texitok texitoks[TEXICMD__MAX] = { |
|
{ 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 */ |
{ dofont, "t", 1 }, /* TEXICMD_T */ |
{ dosymbol, "\t", 1 }, /* TEXICMD_TAB */ |
{ 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 417 static const struct texitok texitoks[TEXICMD__MAX] = { |
|
Line 439 static const struct texitok texitoks[TEXICMD__MAX] = { |
|
{ 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 */ |
{ dobracket, "w", 1 }, /* TEXICMD_W */ |
{ dobracket, "w", 1 }, /* TEXICMD_W */ |
{ dolink, "xref", 4 }, /* TEXICMD_XREF */ |
{ dolink, "xref", 4 }, /* TEXICMD_XREF */ |
Line 515 texierr(struct texi *p, const char *fmt, ...) |
|
Line 538 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 546 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 561 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) |
|
|
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 596 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; |
} |
} |
|
|
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 776 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 964 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 1429 dofont(struct texi *p, enum texicmd cmd, |
|
Line 1476 dofont(struct texi *p, enum texicmd cmd, |
|
abort(); |
abort(); |
} |
} |
|
|
|
if (p->seenws) { |
|
texiputchar(p, ' '); |
|
p->seenws = 0; |
|
} |
texiputchars(p, font); |
texiputchars(p, font); |
parsebracket(p, buf, sz, pos); |
parsebracket(p, buf, sz, pos); |
texiputchars(p, "\\fP"); |
texiputchars(p, "\\fP"); |
Line 1592 dosymbol(struct texi *p, enum texicmd cmd, |
|
Line 1643 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 1664 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 1806 dotop(struct texi *p, enum texicmd cmd, |
|
Line 1860 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 1897 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 1919 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) |
teximacroclose(p); |
teximacroclose(p); |
else if (p->outcol > 0) |
else if (p->outcol > 0) |
texiputchar(p, '\n'); |
texiputchar(p, '\n'); |
|
} |
|
|
|
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 |
static void |