version 1.57, 2015/03/01 16:57:39 |
version 1.60, 2015/03/05 08:18:56 |
Line 94 static const struct texitok __texitoks[TEXICMD__MAX] = |
|
Line 94 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 */ |
{ doinline, "b", 1 }, /* TEXICMD_BOLD */ |
{ doinline, "b", 1 }, /* TEXICMD_B */ |
|
{ dosymbol, "\\", 1 }, /* TEXICMD_BACKSLASH */ |
{ 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 268 static const struct texitok __texitoks[TEXICMD__MAX] = |
|
Line 269 static const struct texitok __texitoks[TEXICMD__MAX] = |
|
{ doaccent, "ringaccent", 10 }, /* TEXICMD_RINGACCENT */ |
{ doaccent, "ringaccent", 10 }, /* TEXICMD_RINGACCENT */ |
{ doinline, "samp", 4 }, /* TEXICMD_SAMP */ |
{ doinline, "samp", 4 }, /* TEXICMD_SAMP */ |
{ doinline, "sansserif", 9 }, /* TEXICMD_SANSSERIF */ |
{ doinline, "sansserif", 9 }, /* TEXICMD_SANSSERIF */ |
{ dobracket, "sc", 2 }, /* TEXICMD_SC */ |
{ doinline, "sc", 2 }, /* TEXICMD_SC */ |
{ dosection, "section", 7 }, /* TEXICMD_SECTION */ |
{ dosection, "section", 7 }, /* TEXICMD_SECTION */ |
{ dovalue, "set", 3 }, /* TEXICMD_SET */ |
{ dovalue, "set", 3 }, /* TEXICMD_SET */ |
{ doignline, "setchapternewpage", 17 }, /* TEXICMD_SETCHAPNEWPAGE */ |
{ doignline, "setchapternewpage", 17 }, /* TEXICMD_SETCHAPNEWPAGE */ |
Line 341 static const struct texitok __texitoks[TEXICMD__MAX] = |
|
Line 342 static const struct texitok __texitoks[TEXICMD__MAX] = |
|
|
|
const struct texitok *const texitoks = __texitoks; |
const struct texitok *const texitoks = __texitoks; |
|
|
|
/* |
|
* Texinfo has lots of indexes. |
|
* You can add new ones in a variety of ways. |
|
* We maintain an array of all of these index names (usually a few |
|
* letters) and pass unknown commands through the array list. |
|
*/ |
static void |
static void |
dodefindex(struct texi *p, enum texicmd cmd, size_t *pos) |
dodefindex(struct texi *p, enum texicmd cmd, size_t *pos) |
{ |
{ |
Line 349 dodefindex(struct texi *p, enum texicmd cmd, size_t *p |
|
Line 356 dodefindex(struct texi *p, enum texicmd cmd, size_t *p |
|
|
|
while (*pos < BUFSZ(p) && isws(BUF(p)[*pos])) |
while (*pos < BUFSZ(p) && isws(BUF(p)[*pos])) |
advance(p, pos); |
advance(p, pos); |
|
|
start = end = *pos; |
start = end = *pos; |
while (end < BUFSZ(p) && ! ismspace(BUF(p)[end])) |
while (end < BUFSZ(p) && ! ismspace(BUF(p)[end])) |
end++; |
end++; |
Line 357 dodefindex(struct texi *p, enum texicmd cmd, size_t *p |
|
Line 363 dodefindex(struct texi *p, enum texicmd cmd, size_t *p |
|
if (start == end) { |
if (start == end) { |
advanceeoln(p, pos, 1); |
advanceeoln(p, pos, 1); |
return; |
return; |
} else if (NULL == (cp = malloc(end - start + 1))) |
} |
|
|
|
if (NULL == (cp = malloc(end - start + 1))) |
texiabort(p, NULL); |
texiabort(p, NULL); |
|
|
memcpy(cp, &BUF(p)[start], end - start); |
memcpy(cp, &BUF(p)[start], end - start); |
cp[end - start] = '\0'; |
cp[end - start] = '\0'; |
|
|
|
/* FIXME: use reallocarray(). */ |
p->indexs = realloc(p->indexs, |
p->indexs = realloc(p->indexs, |
sizeof(char *) * (p->indexsz + 1)); |
sizeof(char *) * (p->indexsz + 1)); |
|
|
if (NULL == p->indexs) |
if (NULL == p->indexs) |
texiabort(p, NULL); |
texiabort(p, NULL); |
p->indexs[p->indexsz++] = cp; |
p->indexs[p->indexsz++] = cp; |
|
|
|
advanceeoln(p, pos, 1); |
} |
} |
|
|
static void |
static void |
Line 725 doinline(struct texi *p, enum texicmd cmd, size_t *pos |
|
Line 734 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) { |
|
if (TEXICMD_SC == cmd) |
|
p->uppercase++; |
parsebracket(p, pos, 0); |
parsebracket(p, pos, 0); |
|
if (TEXICMD_SC == cmd) |
|
p->uppercase--; |
return; |
return; |
} |
} |
|
|
|
/* |
|
* If we haven't seen any whitespace, then we don't want the |
|
* subsequent macro to insert any whitespace. |
|
*/ |
|
if (p->outmacro && 0 == p->seenws) { |
|
teximacroopen(p, "Ns"); |
|
teximacroclose(p); |
|
} |
|
|
teximacroopen(p, macro); |
teximacroopen(p, macro); |
p->seenws = 0; |
p->seenws = 0; |
|
if (TEXICMD_SC == cmd) |
|
p->uppercase++; |
parsebracket(p, pos, 0); |
parsebracket(p, pos, 0); |
|
if (TEXICMD_SC == cmd) |
|
p->uppercase--; |
texipunctuate(p, pos); |
texipunctuate(p, pos); |
teximacroclose(p); |
teximacroclose(p); |
} |
} |
Line 1195 dosymbol(struct texi *p, enum texicmd cmd, size_t *pos |
|
Line 1221 dosymbol(struct texi *p, enum texicmd cmd, size_t *pos |
|
break; |
break; |
case (TEXICMD_AT): |
case (TEXICMD_AT): |
texiputchar(p, '@'); |
texiputchar(p, '@'); |
|
break; |
|
case (TEXICMD_BACKSLASH): |
|
texiputchar(p, '\\'); |
break; |
break; |
case (TEXICMD_BANG): |
case (TEXICMD_BANG): |
texiputchar(p, '!'); |
texiputchar(p, '!'); |