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;
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)
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);
}
}
- 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
{