aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa1997-03-18 23:31:34 +0000
committerKenichi Handa1997-03-18 23:31:34 +0000
commita8283a4a985441890328e69970e55779583ed8ac (patch)
tree0d9d20238a8dcec3a1f9bfbb4d67a3e8efd2a768 /src
parent9ca6ab7d307bfca22ff20459cb7e61e4ab9eb9f0 (diff)
downloademacs-a8283a4a985441890328e69970e55779583ed8ac.tar.gz
emacs-a8283a4a985441890328e69970e55779583ed8ac.zip
(map_char_table): Handle multibyte characters.
Diffstat (limited to 'src')
-rw-r--r--src/fns.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/fns.c b/src/fns.c
index f145f8110a0..65521b239a9 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -28,6 +28,7 @@ Boston, MA 02111-1307, USA. */
28 28
29#include "lisp.h" 29#include "lisp.h"
30#include "commands.h" 30#include "commands.h"
31#include "charset.h"
31 32
32#include "buffer.h" 33#include "buffer.h"
33#include "keyboard.h" 34#include "keyboard.h"
@@ -1367,8 +1368,12 @@ map_char_table (c_function, function, chartable, depth, indices)
1367 int depth; 1368 int depth;
1368{ 1369{
1369 int i; 1370 int i;
1370 int size = CHAR_TABLE_ORDINARY_SLOTS; 1371 int from, to;
1371 1372
1373 if (depth == 0)
1374 from = 0, to = CHAR_TABLE_ORDINARY_SLOTS;
1375 else
1376 from = 32, to = 128;
1372 /* Make INDICES longer if we are about to fill it up. */ 1377 /* Make INDICES longer if we are about to fill it up. */
1373 if ((depth % 10) == 9) 1378 if ((depth % 10) == 9)
1374 { 1379 {
@@ -1378,22 +1383,30 @@ map_char_table (c_function, function, chartable, depth, indices)
1378 indices = new_indices; 1383 indices = new_indices;
1379 } 1384 }
1380 1385
1381 for (i = 0; i < size; i++) 1386 for (i = from; i < to; i++)
1382 { 1387 {
1383 Lisp_Object elt; 1388 Lisp_Object elt;
1384 indices[depth] = i; 1389 indices[depth] = i;
1385 elt = XCHAR_TABLE (chartable)->contents[i]; 1390 elt = XCHAR_TABLE (chartable)->contents[i];
1386 if (CHAR_TABLE_P (elt)) 1391 if (CHAR_TABLE_P (elt))
1387 map_char_table (c_function, function, chartable, depth + 1, indices); 1392 map_char_table (c_function, function, elt, depth + 1, indices);
1388 else if (c_function) 1393 else if (c_function)
1389 (*c_function) (depth + 1, indices, elt); 1394 (*c_function) (depth + 1, indices, elt);
1390 /* Here we should handle all cases where the range is a single character 1395 else if (depth == 0 && i < 256)
1391 by passing that character as a number. Currently, that is 1396 /* This is an ASCII or 8-bit European character. */
1392 all the time, but with the MULE code this will have to be changed. */
1393 else if (depth == 0)
1394 call2 (function, make_number (i), elt); 1397 call2 (function, make_number (i), elt);
1395 else 1398 else
1396 call2 (function, Fvector (depth + 1, indices), elt); 1399 {
1400 /* This is an entry for multibyte characters. */
1401 unsigned int charset = XFASTINT (indices[0]) - 128, c1, c2, c;
1402 if (CHARSET_DEFINED_P (charset))
1403 {
1404 c1 = depth < 1 ? 0 : XFASTINT (indices[1]);
1405 c2 = depth < 2 ? 0 : XFASTINT (indices[2]);
1406 c = MAKE_NON_ASCII_CHAR (charset, c1, c2);
1407 call2 (function, make_number (c), elt);
1408 }
1409 }
1397 } 1410 }
1398} 1411}
1399 1412