From: tomo Date: Tue, 15 Jun 1999 02:09:59 +0000 (+0000) Subject: (BUFBYTE_FIRST_BYTE_P): Modify for UTF-8 in UTF2000. X-Git-Tag: r21-2-15-buf-utf8-1~6 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=92ad1907577d73ab8673611239f9343c9f0cbb94;p=chise%2Fxemacs-chise.git- (BUFBYTE_FIRST_BYTE_P): Modify for UTF-8 in UTF2000. (REP_BYTES_BY_FIRST_BYTE): Likewise. --- diff --git a/src/mule-charset.h b/src/mule-charset.h index 0efe357..b8492d2 100644 --- a/src/mule-charset.h +++ b/src/mule-charset.h @@ -433,7 +433,15 @@ LEADING_BYTE_PREFIX_P (unsigned char lb) /* Does this byte represent the first byte of a character? */ +#ifdef UTF2000 +INLINE int +BUFBYTE_FIRST_BYTE_P(Bufbyte c) +{ + return (c <= 0x7f) || (0xc0 <= c); +} +#else #define BUFBYTE_FIRST_BYTE_P(c) ((c) < 0xA0) +#endif /* Does this byte represent the first byte of a multi-byte character? */ @@ -580,6 +588,25 @@ CHARSET_BY_LEADING_BYTE (int lb) #define CHARSET_BY_ATTRIBUTES(type, final, dir) \ (charset_by_attributes[type][final][dir]) +#ifdef UTF2000 +INLINE int REP_BYTES_BY_FIRST_BYTE (int fb); +INLINE int +REP_BYTES_BY_FIRST_BYTE (int fb) +{ + if ( fb >= 0xfc ) + return 6; + else if ( fb >= 0xf8 ) + return 5; + else if ( fb >= 0xf0 ) + return 4; + else if ( fb >= 0xe0 ) + return 3; + else if ( fb >= 0xc0 ) + return 2; + else + return 1; +} +#else /* MULE */ #ifdef ERROR_CHECK_TYPECHECK /* Number of bytes in the string representation of a character */ @@ -594,6 +621,7 @@ REP_BYTES_BY_FIRST_BYTE (int fb) #else #define REP_BYTES_BY_FIRST_BYTE(fb) (rep_bytes_by_first_byte[fb]) #endif +#endif /* end MULE */ /************************************************************************/