From b4d955483022bc3c0ece07a69878a93c86c2634e Mon Sep 17 00:00:00 2001 From: tomo Date: Thu, 2 Sep 1999 22:15:34 +0000 Subject: [PATCH] (CHAR_INTP): Moved from buffer.h (CHAR_OR_CHAR_INTP): Likewise. (XCHAR_OR_CHAR_INT): Likewise. (CHECK_CHAR_COERCE_INT): Likewise. --- src/character.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/character.h b/src/character.h index f7befb4..ef43177 100644 --- a/src/character.h +++ b/src/character.h @@ -32,4 +32,34 @@ Boston, MA 02111-1307, USA. */ # include "char-ucs.h" #endif /* CHAR_IS_UCS4 */ + +#define CHAR_INTP(x) (INTP (x) && valid_char_p (XINT (x))) + +#define CHAR_OR_CHAR_INTP(x) (CHARP (x) || CHAR_INTP (x)) + +#ifdef ERROR_CHECK_TYPECHECK + +INLINE Emchar XCHAR_OR_CHAR_INT (Lisp_Object obj); +INLINE Emchar +XCHAR_OR_CHAR_INT (Lisp_Object obj) +{ + assert (CHAR_OR_CHAR_INTP (obj)); + return CHARP (obj) ? XCHAR (obj) : XINT (obj); +} + +#else + +#define XCHAR_OR_CHAR_INT(obj) (CHARP ((obj)) ? XCHAR ((obj)) : XINT ((obj))) + +#endif + +#define CHECK_CHAR_COERCE_INT(x) do { \ + if (CHARP (x)) \ + ; \ + else if (CHAR_INTP (x)) \ + x = make_char (XINT (x)); \ + else \ + x = wrong_type_argument (Qcharacterp, x); \ +} while (0) + #endif /* _XEMACS_CHARACTER_H */ -- 1.7.10.4