Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

utf.h

Go to the documentation of this file.
00001 /*
00002 *******************************************************************************
00003 *
00004 *   Copyright (C) 1999-2003, International Business Machines
00005 *   Corporation and others.  All Rights Reserved.
00006 *
00007 *******************************************************************************
00008 *   file name:  utf.h
00009 *   encoding:   US-ASCII
00010 *   tab size:   8 (not used)
00011 *   indentation:4
00012 *
00013 *   created on: 1999sep09
00014 *   created by: Markus W. Scherer
00015 */
00016 
00096 #ifndef __UTF_H__
00097 #define __UTF_H__
00098 
00099 /* wchar_t-related definitions ---------------------------------------------- */
00100 
00101 /*
00102  * ANSI C headers:
00103  * stddef.h defines wchar_t
00104  */
00105 #include "unicode/umachine.h"
00106 #include <stddef.h>
00107 /* include the utfXX.h after the following definitions */
00108 
00115 #ifndef U_HAVE_WCHAR_H
00116 #   define U_HAVE_WCHAR_H 1
00117 #endif
00118 
00125 #if U_SIZEOF_WCHAR_T==0
00126 #   undef U_SIZEOF_WCHAR_T
00127 #   define U_SIZEOF_WCHAR_T 4
00128 #endif
00129 
00130 /*
00131  * \def U_WCHAR_IS_UTF16
00132  * Defined if wchar_t uses UTF-16.
00133  *
00134  * @stable ICU 2.0
00135  */
00136 /*
00137  * \def U_WCHAR_IS_UTF32
00138  * Defined if wchar_t uses UTF-32.
00139  *
00140  * @stable ICU 2.0
00141  */
00142 #if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32)
00143 #   ifdef __STDC_ISO_10646__ 
00144 #       if (U_SIZEOF_WCHAR_T==2)
00145 #           define U_WCHAR_IS_UTF16
00146 #       elif (U_SIZEOF_WCHAR_T==4)
00147 #           define  U_WCHAR_IS_UTF32
00148 #       endif
00149 #   elif defined __UCS2__
00150 #       if (__OS390__ || __OS400__) && (U_SIZEOF_WCHAR_T==2)
00151 #           define U_WCHAR_IS_UTF16
00152 #       endif
00153 #   elif defined __UCS4__
00154 #       if (U_SIZEOF_WCHAR_T==4)
00155 #           define U_WCHAR_IS_UTF32
00156 #       endif
00157 #   elif defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
00158 #       define U_WCHAR_IS_UTF16    
00159 #   endif
00160 #endif
00161 
00162 /* UChar and UChar32 definitions -------------------------------------------- */
00163 
00165 #define U_SIZEOF_UCHAR 2
00166 
00178 /* Define UChar to be compatible with wchar_t if possible. */
00179 #if U_SIZEOF_WCHAR_T==2
00180     typedef wchar_t UChar;
00181 #else
00182     typedef uint16_t UChar;
00183 #endif
00184 
00202 typedef int32_t UChar32;
00203 
00204 /* single-code point definitions -------------------------------------------- */
00205 
00224 #define U_SENTINEL (-1)
00225 
00232 #define U_IS_UNICODE_NONCHAR(c) \
00233     ((c)>=0xfdd0 && \
00234      ((uint32_t)(c)<=0xfdef || ((c)&0xfffe)==0xfffe) && \
00235      (uint32_t)(c)<=0x10ffff)
00236 
00254 #define U_IS_UNICODE_CHAR(c) \
00255     ((uint32_t)(c)<0xd800 || \
00256         ((uint32_t)(c)>0xdfff && \
00257          (uint32_t)(c)<=0x10ffff && \
00258          !U_IS_UNICODE_NONCHAR(c)))
00259 
00266 #define U_IS_BMP(c) ((uint32_t)(c)<=0xffff)
00267 
00274 #define U_IS_SUPPLEMENTARY(c) ((uint32_t)((c)-0x10000)<=0xfffff)
00275 
00282 #define U_IS_LEAD(c) (((c)&0xfffffc00)==0xd800)
00283 
00290 #define U_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00)
00291 
00298 #define U_IS_SURROGATE(c) (((c)&0xfffff800)==0xd800)
00299 
00307 #define U_IS_SURROGATE_LEAD(c) (((c)&0x400)==0)
00308 
00309 /* include the utfXX.h ------------------------------------------------------ */
00310 
00311 #include "unicode/utf8.h"
00312 #include "unicode/utf16.h"
00313 
00314 /* utf_old.h contains deprecated, pre-ICU 2.4 definitions */
00315 #include "unicode/utf_old.h"
00316 
00317 #endif

Generated on Mon Nov 24 14:35:45 2003 for ICU 2.8 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001