1 /* Header for UCS-4 character representation.
2 Copyright (C) 1999 Electrotechnical Laboratory, JAPAN.
3 Licensed to the Free Software Foundation.
5 This file is part of XEmacs.
7 XEmacs is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 2, or (at your option) any
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with XEmacs; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 /* Rewritten by MORIOKA Tomohiko <tomo@m17n.org>. */
24 #ifndef _XEMACS_CHARACTER_H
25 #define _XEMACS_CHARACTER_H
27 #if !defined(MULE) /* unibyte representation */
28 # include "char-1byte.h"
29 #elif !defined(CHAR_IS_UCS4) /* leading-byte representation */
31 #else /* CHAR_IS_UCS4 */
32 # include "char-ucs.h"
33 #endif /* CHAR_IS_UCS4 */
36 #define CHAR_INTP(x) (INTP (x) && valid_char_p (XINT (x)))
38 #define CHAR_OR_CHAR_INTP(x) (CHARP (x) || CHAR_INTP (x))
40 #ifdef ERROR_CHECK_TYPECHECK
42 INLINE Emchar XCHAR_OR_CHAR_INT (Lisp_Object obj);
44 XCHAR_OR_CHAR_INT (Lisp_Object obj)
46 assert (CHAR_OR_CHAR_INTP (obj));
47 return CHARP (obj) ? XCHAR (obj) : XINT (obj);
52 #define XCHAR_OR_CHAR_INT(obj) (CHARP ((obj)) ? XCHAR ((obj)) : XINT ((obj)))
56 #define CHECK_CHAR_COERCE_INT(x) do { \
59 else if (CHAR_INTP (x)) \
60 x = make_char (XINT (x)); \
62 x = wrong_type_argument (Qcharacterp, x); \
65 #endif /* _XEMACS_CHARACTER_H */