# HG changeset patch # User Richard M. Stallman # Date 891504656 0 # Node ID 91933098b4aed28da229b77d36b9f89a5eb28bb2 # Parent f94e2fdb6617e5c3886ddbaa58a1fe44cf9255ad (char_table_translate): New function. diff -r f94e2fdb6617 -r 91933098b4ae src/fns.c --- a/src/fns.c Thu Apr 02 06:41:37 1998 +0000 +++ b/src/fns.c Thu Apr 02 08:10:56 1998 +0000 @@ -1875,6 +1875,23 @@ XCHAR_TABLE (char_table)->contents[code1] = value; return value; } + +/* Look up the element in TABLE at index CH, + and return it as an integer. + If the element is nil, return CH itself. + (Actually we do that for any non-integer.) */ + +int +char_table_translate (table, ch) + Lisp_Object table; + int ch; +{ + Lisp_Object value; + value = Faref (table, make_number (ch)); + if (! INTEGERP (value)) + return ch; + return XINT (value); +} /* Map C_FUNCTION or FUNCTION over SUBTABLE, calling it for each character or group of characters that share a value.