version 1.48, 2015/02/25 15:15:18 |
version 1.53, 2015/02/28 08:41:59 |
Line 296 static const struct texitok __texitoks[TEXICMD__MAX] = |
|
Line 296 static const struct texitok __texitoks[TEXICMD__MAX] = |
|
{ dosubsubsection, "subsubsection", 13 }, /* TEXICMD_SUBSUBSECTION */ |
{ dosubsubsection, "subsubsection", 13 }, /* TEXICMD_SUBSUBSECTION */ |
{ doignline, "subtitle", 8 }, /* TEXICMD_SUBTITLE */ |
{ doignline, "subtitle", 8 }, /* TEXICMD_SUBTITLE */ |
{ doignline, "summarycontents", 15 }, /* TEXICMD_SUMMARYCONTENTS */ |
{ doignline, "summarycontents", 15 }, /* TEXICMD_SUMMARYCONTENTS */ |
{ doignline, "synindex", 8 }, /* TEXICMD_SYNINDEX */ |
{ dodefindex, "synindex", 8 }, /* TEXICMD_SYNINDEX */ |
{ doignline, "syncodeindex", 12 }, /* TEXICMD_SYNCODEINDEX */ |
{ dodefindex, "syncodeindex", 12 }, /* TEXICMD_SYNCODEINDEX */ |
{ doinline, "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 */ |
Line 614 doignblock(struct texi *p, enum texicmd cmd, size_t *p |
|
Line 614 doignblock(struct texi *p, enum texicmd cmd, size_t *p |
|
* Thus, we keep track of scopes for matching "end" blocks. |
* Thus, we keep track of scopes for matching "end" blocks. |
*/ |
*/ |
while (stack > 0 && *pos < BUFSZ(p)) { |
while (stack > 0 && *pos < BUFSZ(p)) { |
if (stack > 10) |
if (stack > 64) |
abort(); |
texierr(p, "run-away nested stack?"); |
endt = memmem(&BUF(p)[*pos], BUFSZ(p) - *pos, end, esz); |
endt = memmem(&BUF(p)[*pos], BUFSZ(p) - *pos, end, esz); |
startt = memmem(&BUF(p)[*pos], BUFSZ(p) - *pos, start, ssz); |
startt = memmem(&BUF(p)[*pos], BUFSZ(p) - *pos, start, ssz); |
if (NULL == endt) { |
if (NULL == endt) { |
Line 690 doinline(struct texi *p, enum texicmd cmd, size_t *pos |
|
Line 690 doinline(struct texi *p, enum texicmd cmd, size_t *pos |
|
} |
} |
|
|
if (NULL == macro || p->literal || TEXILIST_TABLE == p->list) { |
if (NULL == macro || p->literal || TEXILIST_TABLE == p->list) { |
parsebracket(p, pos); |
parsebracket(p, pos, 0); |
return; |
return; |
} |
} |
|
|
teximacroopen(p, macro); |
teximacroopen(p, macro); |
p->seenws = 0; |
p->seenws = 0; |
parsebracket(p, pos); |
parsebracket(p, pos, 0); |
texipunctuate(p, pos); |
texipunctuate(p, pos); |
teximacroclose(p); |
teximacroclose(p); |
} |
} |
Line 728 doverb(struct texi *p, enum texicmd cmd, size_t *pos) |
|
Line 728 doverb(struct texi *p, enum texicmd cmd, size_t *pos) |
|
break; |
break; |
advance(p, pos); |
advance(p, pos); |
} |
} |
if (*pos == BUFSZ(p) - 1) |
if (*pos >= BUFSZ(p) - 1) |
return; |
return; |
texiputbuf(p, start, *pos); |
texiputbuf(p, start, *pos); |
|
|
|
|
dobracket(struct texi *p, enum texicmd cmd, size_t *pos) |
dobracket(struct texi *p, enum texicmd cmd, size_t *pos) |
{ |
{ |
|
|
parsebracket(p, pos); |
parsebracket(p, pos, 0); |
} |
} |
|
|
static void |
static void |
Line 990 doaccent(struct texi *p, enum texicmd cmd, size_t *pos |
|
Line 990 doaccent(struct texi *p, enum texicmd cmd, size_t *pos |
|
if ('{' == BUF(p)[*pos]) { |
if ('{' == BUF(p)[*pos]) { |
brace = 1; |
brace = 1; |
advance(p, pos); |
advance(p, pos); |
} else if (isalpha(texitoks[cmd].tok[0])) |
} else if (isalpha((unsigned char)texitoks[cmd].tok[0])) |
while (*pos < BUFSZ(p) && isws(BUF(p)[*pos])) |
while (*pos < BUFSZ(p) && isws(BUF(p)[*pos])) |
advance(p, pos); |
advance(p, pos); |
|
|
Line 1312 dosymbol(struct texi *p, enum texicmd cmd, size_t *pos |
|
Line 1312 dosymbol(struct texi *p, enum texicmd cmd, size_t *pos |
|
} |
} |
|
|
/* Alphabetic commands have braces we ignore. */ |
/* Alphabetic commands have braces we ignore. */ |
if (isalpha(texitoks[cmd].tok[0])) |
if (isalpha((unsigned char)texitoks[cmd].tok[0])) |
doignbracket(p, cmd, pos); |
doignbracket(p, cmd, pos); |
} |
} |
|
|
Line 1328 doquotation(struct texi *p, enum texicmd cmd, size_t * |
|
Line 1328 doquotation(struct texi *p, enum texicmd cmd, size_t * |
|
static void |
static void |
domath(struct texi *p, enum texicmd cmd, size_t *pos) |
domath(struct texi *p, enum texicmd cmd, size_t *pos) |
{ |
{ |
size_t nest, start; |
|
|
|
/* |
parsebracket(p, pos, 1); |
* Math handling is different from everything else. |
|
* We don't allow any subcomponents, and we ignore the rules in |
|
* terms of @-commands. |
|
* This departs from GNU's rules, but whatever. |
|
*/ |
|
while (*pos < BUFSZ(p) && isws(BUF(p)[*pos])) |
|
advance(p, pos); |
|
if (*pos == BUFSZ(p) || '{' != BUF(p)[*pos]) |
|
return; |
|
advance(p, pos); |
|
if (p->seenws && p->outcol && 0 == p->literal) |
|
texiputchar(p, ' '); |
|
p->seenws = 0; |
|
for (nest = 1, start = *pos; *pos < BUFSZ(p) && nest > 0; ) { |
|
if ('{' == BUF(p)[*pos]) |
|
nest++; |
|
else if ('}' == BUF(p)[*pos]) |
|
if (0 == --nest) |
|
continue; |
|
advance(p, pos); |
|
} |
|
if (*pos == BUFSZ(p)) |
|
return; |
|
assert('}' == BUF(p)[*pos]); |
|
texiputbuf(p, start, *pos); |
|
advance(p, pos); |
|
} |
} |
|
|
static void |
static void |
Line 1608 dotop(struct texi *p, enum texicmd cmd, size_t *pos) |
|
Line 1581 dotop(struct texi *p, enum texicmd cmd, size_t *pos) |
|
teximacroclose(p); |
teximacroclose(p); |
teximacroopen(p, "Dt"); |
teximacroopen(p, "Dt"); |
for (cp = p->title; '\0' != *cp; cp++) |
for (cp = p->title; '\0' != *cp; cp++) |
texiputchar(p, toupper(*cp)); |
texiputchar(p, toupper((unsigned int)*cp)); |
texiputchars(p, " 7"); |
texiputchars(p, " 7"); |
teximacroclose(p); |
teximacroclose(p); |
teximacro(p, "Os"); |
teximacro(p, "Os"); |
Line 1809 doignbracket(struct texi *p, enum texicmd cmd, size_t |
|
Line 1782 doignbracket(struct texi *p, enum texicmd cmd, size_t |
|
{ |
{ |
|
|
p->ign++; |
p->ign++; |
parsebracket(p, pos); |
parsebracket(p, pos, 0); |
p->ign--; |
p->ign--; |
} |
} |
|
|