Mercurial > emacs
comparison src/fns.c @ 18000:2873e0dabbc1
(map_char_table): For sub char-table, index should be
start from 0 (not from 32) considering a composite character.
(Fmap_char_table): Doc-string adjusted. The variable indices is
declared as an array of Lisp_Object.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Wed, 28 May 1997 04:36:22 +0000 |
parents | 7e6a77408020 |
children | edf54f605b36 |
comparison
equal
deleted
inserted
replaced
17999:5e325c8057c8 | 18000:2873e0dabbc1 |
---|---|
1437 } | 1437 } |
1438 to = CHAR_TABLE_ORDINARY_SLOTS; | 1438 to = CHAR_TABLE_ORDINARY_SLOTS; |
1439 } | 1439 } |
1440 else | 1440 else |
1441 { | 1441 { |
1442 i = 32; | 1442 i = 0; |
1443 to = SUB_CHAR_TABLE_ORDINARY_SLOTS; | 1443 to = SUB_CHAR_TABLE_ORDINARY_SLOTS; |
1444 } | 1444 } |
1445 | 1445 |
1446 for (i; i < to; i++) | 1446 for (; i < to; i++) |
1447 { | 1447 { |
1448 Lisp_Object elt = XCHAR_TABLE (subtable)->contents[i]; | 1448 Lisp_Object elt = XCHAR_TABLE (subtable)->contents[i]; |
1449 | 1449 |
1450 indices[depth] = i; | 1450 indices[depth] = i; |
1451 | 1451 |
1452 if (SUB_CHAR_TABLE_P (elt)) | 1452 if (SUB_CHAR_TABLE_P (elt)) |
1453 { | 1453 { |
1454 if (depth >= 3) | 1454 if (depth >= 3) |
1455 error ("Too deep char table"); | 1455 error ("Too deep char table"); |
1456 map_char_table (c_function, function, elt, arg, | 1456 map_char_table (c_function, function, elt, arg, depth + 1, indices); |
1457 depth + 1, indices); | |
1458 } | 1457 } |
1459 else | 1458 else |
1460 { | 1459 { |
1461 int charset = XFASTINT (indices[0]) - 128, c1, c2, c; | 1460 int charset = XFASTINT (indices[0]) - 128, c1, c2, c; |
1462 | 1461 |
1474 } | 1473 } |
1475 } | 1474 } |
1476 | 1475 |
1477 DEFUN ("map-char-table", Fmap_char_table, Smap_char_table, | 1476 DEFUN ("map-char-table", Fmap_char_table, Smap_char_table, |
1478 2, 2, 0, | 1477 2, 2, 0, |
1479 "Call FUNCTION for each range of like characters in CHAR-TABLE.\n\ | 1478 "Call FUNCTION for each (normal and generic) characters in CHAR-TABLE.\n\ |
1480 FUNCTION is called with two arguments--a key and a value.\n\ | 1479 FUNCTION is called with two arguments--a key and a value.\n\ |
1481 The key is always a possible RANGE argument to `set-char-table-range'.") | 1480 The key is always a possible IDX argument to `aref'.") |
1482 (function, char_table) | 1481 (function, char_table) |
1483 Lisp_Object function, char_table; | 1482 Lisp_Object function, char_table; |
1484 { | 1483 { |
1485 Lisp_Object keyvec; | |
1486 /* The depth of char table is at most 3. */ | 1484 /* The depth of char table is at most 3. */ |
1487 Lisp_Object *indices = (Lisp_Object *) alloca (3 * sizeof (Lisp_Object)); | 1485 Lisp_Object indices[3]; |
1486 | |
1487 CHECK_CHAR_TABLE (char_table, 1); | |
1488 | 1488 |
1489 map_char_table (NULL, function, char_table, char_table, 0, indices); | 1489 map_char_table (NULL, function, char_table, char_table, 0, indices); |
1490 return Qnil; | 1490 return Qnil; |
1491 } | 1491 } |
1492 | 1492 |