summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1998-04-02 08:10:56 +0000
committerRichard M. Stallman <rms@gnu.org>1998-04-02 08:10:56 +0000
commit1d969a233975ea3283a54545d419ffd9d7b7e8e9 (patch)
treee1f46873b0ff2dde4a55af513b819f7239b8bb91 /src
parent17030183307147ca954f4346fb2b71a2bd8d1d4b (diff)
(char_table_translate): New function.
Diffstat (limited to 'src')
-rw-r--r--src/fns.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/fns.c b/src/fns.c
index 3b74db33ca2..6d30c09c45b 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -1875,6 +1875,23 @@ See also the documentation of make-char.")
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.