Mercurial > emacs
changeset 17182:47bfc66eb7f1
(map_char_table): Handle multibyte characters.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Tue, 18 Mar 1997 23:31:34 +0000 |
parents | 156896ccc86e |
children | 00252a78ce4f |
files | src/fns.c |
diffstat | 1 files changed, 21 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/fns.c Tue Mar 18 23:31:34 1997 +0000 +++ b/src/fns.c Tue Mar 18 23:31:34 1997 +0000 @@ -28,6 +28,7 @@ #include "lisp.h" #include "commands.h" +#include "charset.h" #include "buffer.h" #include "keyboard.h" @@ -1367,8 +1368,12 @@ int depth; { int i; - int size = CHAR_TABLE_ORDINARY_SLOTS; + int from, to; + if (depth == 0) + from = 0, to = CHAR_TABLE_ORDINARY_SLOTS; + else + from = 32, to = 128; /* Make INDICES longer if we are about to fill it up. */ if ((depth % 10) == 9) { @@ -1378,22 +1383,30 @@ indices = new_indices; } - for (i = 0; i < size; i++) + for (i = from; i < to; i++) { Lisp_Object elt; indices[depth] = i; elt = XCHAR_TABLE (chartable)->contents[i]; if (CHAR_TABLE_P (elt)) - map_char_table (c_function, function, chartable, depth + 1, indices); + map_char_table (c_function, function, elt, depth + 1, indices); else if (c_function) (*c_function) (depth + 1, indices, elt); - /* Here we should handle all cases where the range is a single character - by passing that character as a number. Currently, that is - all the time, but with the MULE code this will have to be changed. */ - else if (depth == 0) + else if (depth == 0 && i < 256) + /* This is an ASCII or 8-bit European character. */ call2 (function, make_number (i), elt); else - call2 (function, Fvector (depth + 1, indices), elt); + { + /* This is an entry for multibyte characters. */ + unsigned int charset = XFASTINT (indices[0]) - 128, c1, c2, c; + if (CHARSET_DEFINED_P (charset)) + { + c1 = depth < 1 ? 0 : XFASTINT (indices[1]); + c2 = depth < 2 ? 0 : XFASTINT (indices[2]); + c = MAKE_NON_ASCII_CHAR (charset, c1, c2); + call2 (function, make_number (c), elt); + } + } } }