]> code.delx.au - gnu-emacs/blobdiff - src/character.h
Fix typo in previous change's ChangeLog.
[gnu-emacs] / src / character.h
index 18aad5b8f414cbe346b50c54945840c86ca34685..66cd4e47ef858f4f995026e7a5993d267e7953bb 100644 (file)
@@ -667,6 +667,20 @@ extern Lisp_Object string_escape_byte8 (Lisp_Object);
 #define GET_TRANSLATION_TABLE(id) \
   (XCDR (XVECTOR (Vtranslation_table_vector)->contents[(id)]))
 
+/* Look up the element in char table OBJ at index CH, and return it as
+   an integer.  If the element is not a character, return CH itself.  */
+
+INLINE int
+char_table_translate (Lisp_Object obj, int ch)
+{
+  /* This internal function is expected to be called with valid arguments,
+     so there is a eassert instead of CHECK_xxx for the sake of speed.  */
+  eassert (CHAR_VALID_P (ch));
+  eassert (CHAR_TABLE_P (obj));
+  obj = CHAR_TABLE_REF (obj, ch);
+  return CHARACTERP (obj) ? XINT (obj) : ch;
+}
+
 INLINE_HEADER_END
 
 #endif /* EMACS_CHARACTER_H */