aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2000-07-27 06:02:29 +0000
committerKenichi Handa2000-07-27 06:02:29 +0000
commit2f729392ecb74812b10b3caa126866f21f4a9b4c (patch)
tree7fb82044eb5d7277117277302980eceb930f46f2 /src
parent05e6f5dcf672b220bd759beded0cae38ceb8a10b (diff)
downloademacs-2f729392ecb74812b10b3caa126866f21f4a9b4c.tar.gz
emacs-2f729392ecb74812b10b3caa126866f21f4a9b4c.zip
(char_table_ref_and_index): New function.
Diffstat (limited to 'src')
-rw-r--r--src/fns.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/fns.c b/src/fns.c
index 6106599a6ba..542a613a418 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -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
2435Lisp_Object
2436char_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 */
2432Lisp_Object 2467Lisp_Object