From: tomo Date: Thu, 2 Sep 1999 22:15:34 +0000 (+0000) Subject: (CHAR_INTP): Moved from buffer.h X-Git-Tag: r21-2-19-utf-2000-0_6-0~29 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=b4d955483022bc3c0ece07a69878a93c86c2634e;p=chise%2Fxemacs-chise.git (CHAR_INTP): Moved from buffer.h (CHAR_OR_CHAR_INTP): Likewise. (XCHAR_OR_CHAR_INT): Likewise. (CHECK_CHAR_COERCE_INT): Likewise. --- 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 */