/*
******************************************************************************
*
-* Copyright (C) 1999-2004, International Business Machines
+* Copyright (C) 1999-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
/**
* \file
- * \brief Basic types and constants for UTF
- *
+ * \brief Basic types and constants for UTF
+ *
* <h2> Basic types and constants for UTF </h2>
* This file defines basic types and constants for utf.h to be
* platform-independent. umachine.h and utf.h are included into
* utypes.h to provide all the general definitions for ICU.
* All of these definitions used to be in utypes.h before
* the UTF-handling macros made this unmaintainable.
- *
+ *
*/
/*==========================================================================*/
/* Include platform-dependent definitions */
/* which are contained in the platform-specific file platform.h */
/*==========================================================================*/
-#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
+#if defined(U_PALMOS)
+# include "unicode/ppalmos.h"
+#elif !defined(__MINGW32__) && (defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64))
+#ifdef CYGWINMSVC
+# include "unicode/platform.h"
+#endif
# include "unicode/pwin32.h"
#else
-# include "unicode/platform.h"
+# include "unicode/ptypes.h" /* platform.h is included in ptypes.h */
#endif
/*
/**
* \def U_CDECL_END
- * This is used to end a declaration of a library private ICU C API
+ * This is used to end a declaration of a library private ICU C API
* @stable ICU 2.4
*/
#endif
/**
- * \def U_NAMESPACE_BEGIN
- * This is used to begin a declaration of a public ICU C++ API.
- * If the compiler doesn't support namespaces, this does nothing.
- * @stable ICU 2.4
- */
-
-/**
- * \def U_NAMESPACE_END
- * This is used to end a declaration of a public ICU C++ API
- * If the compiler doesn't support namespaces, this does nothing.
- * @stable ICU 2.4
- */
-
-/**
- * \def U_NAMESPACE_USE
- * This is used to specify that the rest of the code uses the
- * public ICU C++ API namespace.
- * If the compiler doesn't support namespaces, this does nothing.
- * @stable ICU 2.4
+ * \def U_ATTRIBUTE_DEPRECATED
+ * This is used for GCC specific attributes
+ * @internal
*/
-
+#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2))
+# define U_ATTRIBUTE_DEPRECATED __attribute__ ((deprecated))
/**
- * \def U_NAMESPACE_QUALIFIER
- * This is used to qualify that a function or class is part of
- * the public ICU C++ API namespace.
- * If the compiler doesn't support namespaces, this does nothing.
- * @stable ICU 2.4
+ * \def U_ATTRIBUTE_DEPRECATED
+ * This is used for Visual C++ specific attributes
+ * @internal
*/
-
-/* Define namespace symbols if the compiler supports it. */
-#if U_HAVE_NAMESPACE
-# define U_NAMESPACE_BEGIN namespace U_ICU_NAMESPACE {
-# define U_NAMESPACE_END }
-# define U_NAMESPACE_USE using namespace U_ICU_NAMESPACE;
-# define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE::
+#elif defined(U_WINDOWS) && defined(_MSC_VER) && (_MSC_VER >= 1400)
+# define U_ATTRIBUTE_DEPRECATED __declspec(deprecated)
#else
-# define U_NAMESPACE_BEGIN
-# define U_NAMESPACE_END
-# define U_NAMESPACE_USE
-# define U_NAMESPACE_QUALIFIER
+# define U_ATTRIBUTE_DEPRECATED
#endif
-
/** This is used to declare a function as a public ICU C API @stable ICU 2.0*/
#define U_CAPI U_CFUNC U_EXPORT
+/** This is used to declare a function as a stable public ICU C API*/
#define U_STABLE U_CAPI
+/** This is used to declare a function as a draft public ICU C API */
#define U_DRAFT U_CAPI
-#define U_DEPRECATED U_CAPI
+/** This is used to declare a function as a deprecated public ICU C API */
+#define U_DEPRECATED U_CAPI U_ATTRIBUTE_DEPRECATED
+/** This is used to declare a function as an obsolete public ICU C API */
#define U_OBSOLETE U_CAPI
+/** This is used to declare a function as an internal ICU C API */
#define U_INTERNAL U_CAPI
/*==========================================================================*/
/**
* Provides a platform independent way to specify a signed 64-bit integer constant.
* note: may be wrong for some 64 bit platforms - ensure your compiler provides INT64_C
- * @draft ICU 2.8
+ * @stable ICU 2.8
*/
# define INT64_C(c) c ## LL
# endif
/**
* Provides a platform independent way to specify an unsigned 64-bit integer constant.
* note: may be wrong for some 64 bit platforms - ensure your compiler provides UINT64_C
- * @draft ICU 2.8
+ * @stable ICU 2.8
*/
# define UINT64_C(c) c ## ULL
# endif
* @stable ICU 2.0
*/
#if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32)
-# ifdef __STDC_ISO_10646__
+# ifdef __STDC_ISO_10646__
# if (U_SIZEOF_WCHAR_T==2)
# define U_WCHAR_IS_UTF16
# elif (U_SIZEOF_WCHAR_T==4)
# if (U_SIZEOF_WCHAR_T==4)
# define U_WCHAR_IS_UTF32
# endif
-# elif defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
-# define U_WCHAR_IS_UTF16
+# elif defined(U_WINDOWS)
+# define U_WCHAR_IS_UTF16
# endif
#endif
/**
* \var UChar
* Define UChar to be wchar_t if that is 16 bits wide; always assumed to be unsigned.
- * If wchar_t is not 16 bits wide, then define UChar to be uint16_t.
+ * If wchar_t is not 16 bits wide, then define UChar to be uint16_t or char16_t because GCC >=4.4
+ * can handle UTF16 string literals.
* This makes the definition of UChar platform-dependent
* but allows direct string type compatibility with platforms with
* 16-bit wchar_t types.
*
- * @stable ICU 2.0
+ * @draft ICU 4.4
*/
/* Define UChar to be compatible with wchar_t if possible. */
#if U_SIZEOF_WCHAR_T==2
typedef wchar_t UChar;
+#elif U_GNUC_UTF16_STRING
+#if defined _GCC_
+ typedef __CHAR16_TYPE__ char16_t;
+#endif
+ typedef char16_t UChar;
#else
typedef uint16_t UChar;
#endif
/* the OS in use. */
/*==========================================================================*/
+#ifndef U_HIDE_INTERNAL_API
+
/**
* \def U_ALIGN_CODE
* This is used to align code fragments to a specific byte boundary.
# define U_ALIGN_CODE(n)
#endif
+#endif /* U_HIDE_INTERNAL_API */
+
+/**
+ * \def U_INLINE
+ * This is used to request inlining of a function, on platforms and languages which support it.
+ */
+
#ifndef U_INLINE
-# define U_INLINE
+# ifdef XP_CPLUSPLUS
+# define U_INLINE inline
+# else
+# define U_INLINE
+# endif
#endif
#include "unicode/urename.h"