version 1.184, 2011/04/09 15:29:40 |
version 1.187, 2011/05/14 17:54:42 |
Line 47 term_free(struct termp *p) |
|
Line 47 term_free(struct termp *p) |
|
if (p->buf) |
if (p->buf) |
free(p->buf); |
free(p->buf); |
if (p->symtab) |
if (p->symtab) |
chars_free(p->symtab); |
mchars_free(p->symtab); |
|
|
free(p); |
free(p); |
} |
} |
Line 348 term_vspace(struct termp *p) |
|
Line 348 term_vspace(struct termp *p) |
|
static void |
static void |
numbered(struct termp *p, const char *word, size_t len) |
numbered(struct termp *p, const char *word, size_t len) |
{ |
{ |
const char *rhs; |
char c; |
|
|
rhs = chars_num2char(word, len); |
if ('\0' != (c = mchars_num2char(word, len))) |
if (rhs) |
encode(p, &c, 1); |
encode(p, rhs, 1); |
|
} |
} |
|
|
|
|
Line 362 spec(struct termp *p, const char *word, size_t len) |
|
Line 361 spec(struct termp *p, const char *word, size_t len) |
|
const char *rhs; |
const char *rhs; |
size_t sz; |
size_t sz; |
|
|
rhs = chars_spec2str(p->symtab, word, len, &sz); |
rhs = mchars_spec2str(p->symtab, word, len, &sz); |
if (rhs) |
if (rhs) |
encode(p, rhs, sz); |
encode(p, rhs, sz); |
else if (1 == len) |
else if (1 == len) |
Line 376 res(struct termp *p, const char *word, size_t len) |
|
Line 375 res(struct termp *p, const char *word, size_t len) |
|
const char *rhs; |
const char *rhs; |
size_t sz; |
size_t sz; |
|
|
rhs = chars_res2str(p->symtab, word, len, &sz); |
rhs = mchars_res2str(p->symtab, word, len, &sz); |
if (rhs) |
if (rhs) |
encode(p, rhs, sz); |
encode(p, rhs, sz); |
} |
} |
Line 533 adjbuf(struct termp *p, size_t sz) |
|
Line 532 adjbuf(struct termp *p, size_t sz) |
|
while (sz >= p->maxcols) |
while (sz >= p->maxcols) |
p->maxcols <<= 2; |
p->maxcols <<= 2; |
|
|
p->buf = mandoc_realloc(p->buf, p->maxcols); |
p->buf = mandoc_realloc(p->buf, sizeof(int) * p->maxcols); |
} |
} |
|
|
|
|
Line 563 encode(struct termp *p, const char *word, size_t sz) |
|
Line 562 encode(struct termp *p, const char *word, size_t sz) |
|
if (TERMFONT_NONE == (f = term_fonttop(p))) { |
if (TERMFONT_NONE == (f = term_fonttop(p))) { |
if (p->col + sz >= p->maxcols) |
if (p->col + sz >= p->maxcols) |
adjbuf(p, p->col + sz); |
adjbuf(p, p->col + sz); |
memcpy(&p->buf[(int)p->col], word, sz); |
for (i = 0; i < (int)sz; i++) |
p->col += sz; |
p->buf[(int)p->col++] = word[i]; |
return; |
return; |
} |
} |
|
|
Line 623 term_strlen(const struct termp *p, const char *cp) |
|
Line 622 term_strlen(const struct termp *p, const char *cp) |
|
|
|
switch (esc) { |
switch (esc) { |
case (ESCAPE_PREDEF): |
case (ESCAPE_PREDEF): |
rhs = chars_res2str |
rhs = mchars_res2str |
(p->symtab, seq, ssz, &rsz); |
(p->symtab, seq, ssz, &rsz); |
break; |
break; |
case (ESCAPE_SPECIAL): |
case (ESCAPE_SPECIAL): |
rhs = chars_spec2str |
rhs = mchars_spec2str |
(p->symtab, seq, ssz, &rsz); |
(p->symtab, seq, ssz, &rsz); |
|
|
if (ssz != 1 || rhs) |
if (ssz != 1 || rhs) |