version 1.59, 2015/03/03 15:04:24 |
version 1.60, 2015/03/05 08:18:56 |
Line 342 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 350 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 358 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 |