changeset 89757:482c15940000

(translate_char): Accept list of translation tables.
author Kenichi Handa <handa@m17n.org>
date Tue, 27 Jan 2004 02:16:25 +0000
parents db16b8663114
children b07ce3d8fc4e
files src/character.c
diffstat 1 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/character.c	Tue Jan 27 02:15:13 2004 +0000
+++ b/src/character.c	Tue Jan 27 02:16:25 2004 +0000
@@ -210,21 +210,28 @@
 /* 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))
+    {
+      Lisp_Object ch;
 
-  if (! CHAR_TABLE_P (table))
-    return c;
-  ch = CHAR_TABLE_REF (table, c);
-  if (! CHARACTERP (ch))
-    return c;
-  return XINT (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