summaryrefslogtreecommitdiff
path: root/src/character.c
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>2004-01-27 02:16:25 +0000
committerKenichi Handa <handa@m17n.org>2004-01-27 02:16:25 +0000
commit10453be959b3656f9ed57336eab4e3ca77613304 (patch)
tree9b754792bb31dbd9a0fe5694d45e904c97b4b04e /src/character.c
parent20e78000cb2ac5cf4f26bd13c8298bc345efc322 (diff)
downloademacs-10453be959b3656f9ed57336eab4e3ca77613304.tar.gz
(translate_char): Accept list of translation tables.
Diffstat (limited to 'src/character.c')
-rw-r--r--src/character.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/character.c b/src/character.c
index 70b7c476019..13a2da0ddbd 100644
--- a/src/character.c
+++ b/src/character.c
@@ -210,21 +210,28 @@ string_char (p, advanced, len)
/* Translate character C by translation table TABLE. If C is
negative, translate a character specified by CHARSET and CODE. If
no translation is found in TABLE, return the untranslated
- character. */
+ character. If TABLE is a list, elements are char tables. In this
+ case, translace C by all tables. */
int
translate_char (table, c)
Lisp_Object table;
int c;
{
- Lisp_Object ch;
-
- if (! CHAR_TABLE_P (table))
- return c;
- ch = CHAR_TABLE_REF (table, c);
- if (! CHARACTERP (ch))
- return c;
- return XINT (ch);
+ if (CHAR_TABLE_P (table))
+ {
+ Lisp_Object ch;
+
+ ch = CHAR_TABLE_REF (table, c);
+ if (CHARACTERP (ch))
+ c = XINT (ch);
+ }
+ else
+ {
+ for (; CONSP (table); table = XCDR (table))
+ c = translate_char (XCAR (table), c);
+ }
+ return c;
}
/* Convert the multibyte character C to unibyte 8-bit character based