comparison src/fns.c @ 21339:91933098b4ae

(char_table_translate): New function.
author Richard M. Stallman <rms@gnu.org>
date Thu, 02 Apr 1998 08:10:56 +0000
parents 4ac9ba6e745d
children efdf4fe4875b
comparison
equal deleted inserted replaced
21338:f94e2fdb6617 21339:91933098b4ae
1872 if (SUB_CHAR_TABLE_P (temp)) 1872 if (SUB_CHAR_TABLE_P (temp))
1873 XCHAR_TABLE (temp)->defalt = value; 1873 XCHAR_TABLE (temp)->defalt = value;
1874 else 1874 else
1875 XCHAR_TABLE (char_table)->contents[code1] = value; 1875 XCHAR_TABLE (char_table)->contents[code1] = value;
1876 return value; 1876 return value;
1877 }
1878
1879 /* Look up the element in TABLE at index CH,
1880 and return it as an integer.
1881 If the element is nil, return CH itself.
1882 (Actually we do that for any non-integer.) */
1883
1884 int
1885 char_table_translate (table, ch)
1886 Lisp_Object table;
1887 int ch;
1888 {
1889 Lisp_Object value;
1890 value = Faref (table, make_number (ch));
1891 if (! INTEGERP (value))
1892 return ch;
1893 return XINT (value);
1877 } 1894 }
1878 1895
1879 /* Map C_FUNCTION or FUNCTION over SUBTABLE, calling it for each 1896 /* Map C_FUNCTION or FUNCTION over SUBTABLE, calling it for each
1880 character or group of characters that share a value. 1897 character or group of characters that share a value.
1881 DEPTH is the current depth in the originally specified 1898 DEPTH is the current depth in the originally specified