From 92ad1907577d73ab8673611239f9343c9f0cbb94 Mon Sep 17 00:00:00 2001 From: tomo Date: Tue, 15 Jun 1999 02:09:59 +0000 Subject: [PATCH] (BUFBYTE_FIRST_BYTE_P): Modify for UTF-8 in UTF2000. (REP_BYTES_BY_FIRST_BYTE): Likewise. --- src/mule-charset.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) 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 */ /************************************************************************/ -- 1.7.10.4