From: tomo Date: Fri, 3 Sep 1999 22:59:10 +0000 (+0000) Subject: (MULTIBYTE): New macro. X-Git-Tag: r21-2-19-utf-2000-0_6-0~17 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=af463765dbddb93f2b19556e02a745ec39550266;p=chise%2Fxemacs-chise.git.1 (MULTIBYTE): New macro. (MAX_EMCHAR_LEN): Moved from buffer.h. (REP_BYTES_BY_FIRST_BYTE): Moved from char-ucs.h. --- diff --git a/src/mb-utf-8.h b/src/mb-utf-8.h index 73d8454..1bd1a80 100644 --- a/src/mb-utf-8.h +++ b/src/mb-utf-8.h @@ -24,6 +24,11 @@ Boston, MA 02111-1307, USA. */ #ifndef _XEMACS_MB_UTF_8_H #define _XEMACS_MB_UTF_8_H +#define MULTIBYTE + +/* Maximum number of buffer bytes per Emacs character. */ +#define MAX_EMCHAR_LEN 6 + /************************************************************************/ /* Operations on individual bytes */ /* in a Mule-formatted string */ @@ -46,4 +51,23 @@ BUFBYTE_FIRST_BYTE_P(Bufbyte c) #define CHAR_MULTIBYTE_P(c) ((c) >= 0x80) + +INLINE int REP_BYTES_BY_FIRST_BYTE (int fb); +INLINE int +REP_BYTES_BY_FIRST_BYTE (int fb) +{ + if ( fb < 0xc0 ) + return 1; + else if ( fb < 0xe0 ) + return 2; + else if ( fb < 0xf0 ) + return 3; + else if ( fb < 0xf8 ) + return 4; + else if ( fb < 0xfc ) + return 5; + else + return 6; +} + #endif /* _XEMACS_MB_UTF_8_H */