aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2004-01-27 02:16:25 +0000
committerKenichi Handa2004-01-27 02:16:25 +0000
commit10453be959b3656f9ed57336eab4e3ca77613304 (patch)
tree9b754792bb31dbd9a0fe5694d45e904c97b4b04e /src
parent20e78000cb2ac5cf4f26bd13c8298bc345efc322 (diff)
downloademacs-10453be959b3656f9ed57336eab4e3ca77613304.tar.gz
emacs-10453be959b3656f9ed57336eab4e3ca77613304.zip
(translate_char): Accept list of translation tables.
Diffstat (limited to 'src')
-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)
210/* Translate character C by translation table TABLE. If C is 210/* Translate character C by translation table TABLE. If C is
211 negative, translate a character specified by CHARSET and CODE. If 211 negative, translate a character specified by CHARSET and CODE. If
212 no translation is found in TABLE, return the untranslated 212 no translation is found in TABLE, return the untranslated
213 character. */ 213 character. If TABLE is a list, elements are char tables. In this
214 case, translace C by all tables. */
214 215
215int 216int
216translate_char (table, c) 217translate_char (table, c)
217 Lisp_Object table; 218 Lisp_Object table;
218 int c; 219 int c;
219{ 220{
220 Lisp_Object ch; 221 if (CHAR_TABLE_P (table))
221 222 {
222 if (! CHAR_TABLE_P (table)) 223 Lisp_Object ch;
223 return c; 224
224 ch = CHAR_TABLE_REF (table, c); 225 ch = CHAR_TABLE_REF (table, c);
225 if (! CHARACTERP (ch)) 226 if (CHARACTERP (ch))
226 return c; 227 c = XINT (ch);
227 return XINT (ch); 228 }
229 else
230 {
231 for (; CONSP (table); table = XCDR (table))
232 c = translate_char (XCAR (table), c);
233 }
234 return c;
228} 235}
229 236
230/* Convert the multibyte character C to unibyte 8-bit character based 237/* Convert the multibyte character C to unibyte 8-bit character based