diff options
| author | Kenichi Handa | 2000-07-27 06:02:29 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2000-07-27 06:02:29 +0000 |
| commit | 2f729392ecb74812b10b3caa126866f21f4a9b4c (patch) | |
| tree | 7fb82044eb5d7277117277302980eceb930f46f2 /src | |
| parent | 05e6f5dcf672b220bd759beded0cae38ceb8a10b (diff) | |
| download | emacs-2f729392ecb74812b10b3caa126866f21f4a9b4c.tar.gz emacs-2f729392ecb74812b10b3caa126866f21f4a9b4c.zip | |
(char_table_ref_and_index): New function.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fns.c | 35 |
1 files changed, 35 insertions, 0 deletions
| @@ -2427,6 +2427,41 @@ The key is always a possible IDX argument to `aref'.") | |||
| 2427 | map_char_table (NULL, function, char_table, char_table, 0, indices); | 2427 | map_char_table (NULL, function, char_table, char_table, 0, indices); |
| 2428 | return Qnil; | 2428 | return Qnil; |
| 2429 | } | 2429 | } |
| 2430 | |||
| 2431 | /* Return a value for character C in char-table TABLE. Store the | ||
| 2432 | actual index for that value in *IDX. Ignore the default value of | ||
| 2433 | TABLE. */ | ||
| 2434 | |||
| 2435 | Lisp_Object | ||
| 2436 | char_table_ref_and_index (table, c, idx) | ||
| 2437 | Lisp_Object table; | ||
| 2438 | int c, *idx; | ||
| 2439 | { | ||
| 2440 | int charset, c1, c2; | ||
| 2441 | Lisp_Object elt; | ||
| 2442 | |||
| 2443 | if (SINGLE_BYTE_CHAR_P (c)) | ||
| 2444 | { | ||
| 2445 | *idx = c; | ||
| 2446 | return XCHAR_TABLE (table)->contents[c]; | ||
| 2447 | } | ||
| 2448 | SPLIT_CHAR (c, charset, c1, c2); | ||
| 2449 | elt = XCHAR_TABLE (table)->contents[charset + 128]; | ||
| 2450 | *idx = MAKE_CHAR (charset, 0, 0); | ||
| 2451 | if (!SUB_CHAR_TABLE_P (elt)) | ||
| 2452 | return elt; | ||
| 2453 | if (c1 < 32 || NILP (XCHAR_TABLE (elt)->contents[c1])) | ||
| 2454 | return XCHAR_TABLE (elt)->defalt; | ||
| 2455 | elt = XCHAR_TABLE (elt)->contents[c1]; | ||
| 2456 | *idx = MAKE_CHAR (charset, c1, 0); | ||
| 2457 | if (!SUB_CHAR_TABLE_P (elt)) | ||
| 2458 | return elt; | ||
| 2459 | if (c2 < 32 || NILP (XCHAR_TABLE (elt)->contents[c2])) | ||
| 2460 | return XCHAR_TABLE (elt)->defalt; | ||
| 2461 | *idx = c; | ||
| 2462 | return XCHAR_TABLE (elt)->contents[c2]; | ||
| 2463 | } | ||
| 2464 | |||
| 2430 | 2465 | ||
| 2431 | /* ARGSUSED */ | 2466 | /* ARGSUSED */ |
| 2432 | Lisp_Object | 2467 | Lisp_Object |