(get_translation_table): Declare it as Lisp_Object.
(LOOKUP_TRANSLATION_TABLE): New macro. (produce_chars): Use LOOKUP_TRANSLATION_TABLE instead of CHAR_TABLE_REF. (consume_chars): Likewise.
This commit is contained in:
parent
502ed9fb33
commit
e6a54062d3
1 changed files with 32 additions and 5 deletions
37
src/coding.c
37
src/coding.c
|
@ -5507,7 +5507,7 @@ decode_eol (coding)
|
|||
attribute vector ATTRS for encoding (ENCODEP is nonzero) or
|
||||
decoding (ENCODEP is zero). */
|
||||
|
||||
static INLINE
|
||||
static Lisp_Object
|
||||
get_translation_table (attrs, encodep)
|
||||
{
|
||||
Lisp_Object standard, translation_table;
|
||||
|
@ -5541,6 +5541,30 @@ get_translation_table (attrs, encodep)
|
|||
return translation_table;
|
||||
}
|
||||
|
||||
#define LOOKUP_TRANSLATION_TABLE(table, c, trans) \
|
||||
do { \
|
||||
if (CHAR_TABLE_P (table)) \
|
||||
{ \
|
||||
trans = CHAR_TABLE_REF (table, c); \
|
||||
if (CHARACTERP (trans)) \
|
||||
c = XFASTINT (trans), trans = Qnil; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
Lisp_Object tail = table; \
|
||||
\
|
||||
for (; CONSP (tail); tail = XCDR (tail)) \
|
||||
if (CHAR_TABLE_P (XCAR (tail))) \
|
||||
{ \
|
||||
trans = CHAR_TABLE_REF (table, c); \
|
||||
if (CHARACTERP (trans)) \
|
||||
c = XFASTINT (trans), trans = Qnil; \
|
||||
else if (! NILP (trans)) \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
static Lisp_Object
|
||||
get_translation (val, buf, buf_end, last_block, from_nchars, to_nchars)
|
||||
|
@ -5621,8 +5645,9 @@ produce_chars (coding, translation_table, last_block)
|
|||
int from_nchars = 1, to_nchars = 1;
|
||||
Lisp_Object trans = Qnil;
|
||||
|
||||
if (! NILP (translation_table)
|
||||
&& ! NILP (trans = CHAR_TABLE_REF (translation_table, c)))
|
||||
if (! NILP (translation_table))
|
||||
LOOKUP_TRANSLATION_TABLE (translation_table, c, trans);
|
||||
if (! NILP (trans))
|
||||
{
|
||||
trans = get_translation (trans, buf, buf_end, last_block,
|
||||
&from_nchars, &to_nchars);
|
||||
|
@ -6264,8 +6289,10 @@ consume_chars (coding, translation_table)
|
|||
}
|
||||
}
|
||||
|
||||
if (NILP (translation_table)
|
||||
|| NILP (trans = CHAR_TABLE_REF (translation_table, c)))
|
||||
trans = Qnil;
|
||||
if (! NILP (translation_table))
|
||||
LOOKUP_TRANSLATION_TABLE (translation_table, c, trans);
|
||||
if (NILP (trans))
|
||||
*buf++ = c;
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue