From: tomo Date: Mon, 12 Jun 2000 08:14:39 +0000 (+0000) Subject: (CHARC_CHARSET): New macro. X-Git-Tag: r21-2-34-utf-2000-0_16-1~43 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=585641bc3de282c563c0ff4c9d22719682bf5f1a;p=chise%2Fxemacs-chise.git (CHARC_CHARSET): New macro. (CHARC_CHARSET_ID): New macro. (CHARC_CODE_POINT): New macro. (CHARC_COLUMNS): New macro. (CHARC_TO_CHAR): New inline function. (CHARC_EQ): New inline function. (CHARC_ASCII_EQ): New inline function. (CHARC_IS_SPACE): New inline function. (ASCII_TO_CHARC): New inline function. --- diff --git a/src/character.h b/src/character.h index 41aff97..26bf1cc 100644 --- a/src/character.h +++ b/src/character.h @@ -98,6 +98,54 @@ XCHAR_OR_CHAR_INT (Lisp_Object obj) } while (0) +#define CHARC_CHARSET(cc) ((cc).charset) +#define CHARC_CHARSET_ID(cc) XCHARSET_ID (CHARC_CHARSET (cc)) +#define CHARC_CODE_POINT(cc) ((cc).code_point) +#define CHARC_COLUMNS(cc) CHARSET_COLUMNS (XCHARSET (CHARC_CHARSET (cc))) + +INLINE_HEADER Emchar CHARC_TO_CHAR (Charc cc); +INLINE_HEADER Emchar +CHARC_TO_CHAR (Charc cc) +{ + return DECODE_CHAR (cc.charset, cc.code_point); +} + +INLINE_HEADER int CHARC_EQ (Charc cc1, Charc cc2); +INLINE_HEADER int +CHARC_EQ (Charc cc1, Charc cc2) +{ + return EQ (cc1.charset, cc2.charset) && (cc1.code_point == cc2.code_point); +} + +INLINE_HEADER int CHARC_ASCII_EQ (Charc cc, int ch); +INLINE_HEADER int +CHARC_ASCII_EQ (Charc cc, int ch) +{ + return EQ (cc.charset, Vcharset_ascii) && (cc.code_point == ch); +} + +INLINE_HEADER int CHARC_IS_SPACE (Charc cc); +INLINE_HEADER int +CHARC_IS_SPACE (Charc cc) +{ + return (EQ (cc.charset, Vcharset_ascii) || + EQ (cc.charset, Vcharset_control_1) || + EQ (cc.charset, Vcharset_latin_iso8859_1)) + && isspace (cc.code_point); +} + +INLINE_HEADER Charc ASCII_TO_CHARC (int ch); +INLINE_HEADER Charc +ASCII_TO_CHARC (int ch) +{ + Charc cc; + + cc.charset = Vcharset_ascii; + cc.code_point = ch; + return cc; +} + + typedef struct { Dynarr_declare (Charc);