os/textandloc/fontservices/textshaperplugin/IcuSource/common/unicode/umachine.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
******************************************************************************
sl@0
     3
*
sl@0
     4
*   Copyright (C) 1999-2005, International Business Machines
sl@0
     5
*   Corporation and others.  All Rights Reserved.
sl@0
     6
*
sl@0
     7
******************************************************************************
sl@0
     8
*   file name:  umachine.h
sl@0
     9
*   encoding:   US-ASCII
sl@0
    10
*   tab size:   8 (not used)
sl@0
    11
*   indentation:4
sl@0
    12
*
sl@0
    13
*   created on: 1999sep13
sl@0
    14
*   created by: Markus W. Scherer
sl@0
    15
*
sl@0
    16
*   This file defines basic types and constants for utf.h to be
sl@0
    17
*   platform-independent. umachine.h and utf.h are included into
sl@0
    18
*   utypes.h to provide all the general definitions for ICU.
sl@0
    19
*   All of these definitions used to be in utypes.h before
sl@0
    20
*   the UTF-handling macros made this unmaintainable.
sl@0
    21
*/
sl@0
    22
sl@0
    23
#ifndef __UMACHINE_H__
sl@0
    24
#define __UMACHINE_H__
sl@0
    25
sl@0
    26
sl@0
    27
/**
sl@0
    28
 * \file
sl@0
    29
 * \brief Basic types and constants for UTF 
sl@0
    30
 * 
sl@0
    31
 * <h2> Basic types and constants for UTF </h2>
sl@0
    32
 *   This file defines basic types and constants for utf.h to be
sl@0
    33
 *   platform-independent. umachine.h and utf.h are included into
sl@0
    34
 *   utypes.h to provide all the general definitions for ICU.
sl@0
    35
 *   All of these definitions used to be in utypes.h before
sl@0
    36
 *   the UTF-handling macros made this unmaintainable.
sl@0
    37
 * 
sl@0
    38
 */
sl@0
    39
/*==========================================================================*/
sl@0
    40
/* Include platform-dependent definitions                                   */
sl@0
    41
/* which are contained in the platform-specific file platform.h             */
sl@0
    42
/*==========================================================================*/
sl@0
    43
sl@0
    44
#if defined(__SYMBIAN32__)
sl@0
    45
#include "SymbianPlatform.h"
sl@0
    46
#elif defined(U_PALMOS)
sl@0
    47
#   include "unicode/ppalmos.h"
sl@0
    48
#elif defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
sl@0
    49
#   include "unicode/pwin32.h"
sl@0
    50
#else
sl@0
    51
#   include "unicode/platform.h"
sl@0
    52
#endif
sl@0
    53
sl@0
    54
/*
sl@0
    55
 * ANSI C headers:
sl@0
    56
 * stddef.h defines wchar_t
sl@0
    57
 */
sl@0
    58
#include <stddef.h>
sl@0
    59
sl@0
    60
/*==========================================================================*/
sl@0
    61
/* XP_CPLUSPLUS is a cross-platform symbol which should be defined when     */
sl@0
    62
/* using C++.  It should not be defined when compiling under C.             */
sl@0
    63
/*==========================================================================*/
sl@0
    64
sl@0
    65
#ifdef __cplusplus
sl@0
    66
#   ifndef XP_CPLUSPLUS
sl@0
    67
#       define XP_CPLUSPLUS
sl@0
    68
#   endif
sl@0
    69
#else
sl@0
    70
#   undef XP_CPLUSPLUS
sl@0
    71
#endif
sl@0
    72
sl@0
    73
/*==========================================================================*/
sl@0
    74
/* For C wrappers, we use the symbol U_STABLE.                                */
sl@0
    75
/* This works properly if the includer is C or C++.                         */
sl@0
    76
/* Functions are declared   U_STABLE return-type U_EXPORT2 function-name()... */
sl@0
    77
/*==========================================================================*/
sl@0
    78
sl@0
    79
/**
sl@0
    80
 * \def U_CFUNC
sl@0
    81
 * This is used in a declaration of a library private ICU C function.
sl@0
    82
 * @stable ICU 2.4
sl@0
    83
 */
sl@0
    84
sl@0
    85
/**
sl@0
    86
 * \def U_CDECL_BEGIN
sl@0
    87
 * This is used to begin a declaration of a library private ICU C API.
sl@0
    88
 * @stable ICU 2.4
sl@0
    89
 */
sl@0
    90
sl@0
    91
/**
sl@0
    92
 * \def U_CDECL_END
sl@0
    93
 * This is used to end a declaration of a library private ICU C API 
sl@0
    94
 * @stable ICU 2.4
sl@0
    95
 */
sl@0
    96
sl@0
    97
#ifdef XP_CPLUSPLUS
sl@0
    98
#   define U_CFUNC extern "C"
sl@0
    99
#   define U_CDECL_BEGIN extern "C" {
sl@0
   100
#   define U_CDECL_END   }
sl@0
   101
#else
sl@0
   102
#   define U_CFUNC extern
sl@0
   103
#   define U_CDECL_BEGIN
sl@0
   104
#   define U_CDECL_END
sl@0
   105
#endif
sl@0
   106
sl@0
   107
/**
sl@0
   108
 * \def U_NAMESPACE_BEGIN
sl@0
   109
 * This is used to begin a declaration of a public ICU C++ API.
sl@0
   110
 * If the compiler doesn't support namespaces, this does nothing.
sl@0
   111
 * @stable ICU 2.4
sl@0
   112
 */
sl@0
   113
sl@0
   114
/**
sl@0
   115
 * \def U_NAMESPACE_END
sl@0
   116
 * This is used to end a declaration of a public ICU C++ API 
sl@0
   117
 * If the compiler doesn't support namespaces, this does nothing.
sl@0
   118
 * @stable ICU 2.4
sl@0
   119
 */
sl@0
   120
sl@0
   121
/**
sl@0
   122
 * \def U_NAMESPACE_USE
sl@0
   123
 * This is used to specify that the rest of the code uses the
sl@0
   124
 * public ICU C++ API namespace.
sl@0
   125
 * If the compiler doesn't support namespaces, this does nothing.
sl@0
   126
 * @stable ICU 2.4
sl@0
   127
 */
sl@0
   128
sl@0
   129
/**
sl@0
   130
 * \def U_NAMESPACE_QUALIFIER
sl@0
   131
 * This is used to qualify that a function or class is part of
sl@0
   132
 * the public ICU C++ API namespace.
sl@0
   133
 * If the compiler doesn't support namespaces, this does nothing.
sl@0
   134
 * @stable ICU 2.4
sl@0
   135
 */
sl@0
   136
sl@0
   137
/* Define namespace symbols if the compiler supports it. */
sl@0
   138
#if U_HAVE_NAMESPACE
sl@0
   139
#   define U_NAMESPACE_BEGIN namespace U_ICU_NAMESPACE {
sl@0
   140
#   define U_NAMESPACE_END  }
sl@0
   141
#   define U_NAMESPACE_USE using namespace U_ICU_NAMESPACE;
sl@0
   142
#   define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE::
sl@0
   143
#else
sl@0
   144
#   define U_NAMESPACE_BEGIN
sl@0
   145
#   define U_NAMESPACE_END
sl@0
   146
#   define U_NAMESPACE_USE
sl@0
   147
#   define U_NAMESPACE_QUALIFIER
sl@0
   148
#endif
sl@0
   149
sl@0
   150
/** This is used to declare a function as a public ICU C API @stable ICU 2.0*/
sl@0
   151
#define U_CAPI U_CFUNC U_EXPORT
sl@0
   152
#define U_STABLE U_CAPI
sl@0
   153
#define U_DRAFT  U_CAPI
sl@0
   154
#define U_DEPRECATED U_CAPI
sl@0
   155
#define U_OBSOLETE U_CAPI
sl@0
   156
#define U_INTERNAL U_CAPI
sl@0
   157
sl@0
   158
/*==========================================================================*/
sl@0
   159
/* limits for int32_t etc., like in POSIX inttypes.h                        */
sl@0
   160
/*==========================================================================*/
sl@0
   161
sl@0
   162
#ifndef INT8_MIN
sl@0
   163
/** The smallest value an 8 bit signed integer can hold @stable ICU 2.0 */
sl@0
   164
#   define INT8_MIN        ((int8_t)(-128))
sl@0
   165
#endif
sl@0
   166
#ifndef INT16_MIN
sl@0
   167
/** The smallest value a 16 bit signed integer can hold @stable ICU 2.0 */
sl@0
   168
#   define INT16_MIN       ((int16_t)(-32767-1))
sl@0
   169
#endif
sl@0
   170
#ifndef INT32_MIN
sl@0
   171
/** The smallest value a 32 bit signed integer can hold @stable ICU 2.0 */
sl@0
   172
#   define INT32_MIN       ((int32_t)(-2147483647-1))
sl@0
   173
#endif
sl@0
   174
sl@0
   175
#ifndef INT8_MAX
sl@0
   176
/** The largest value an 8 bit signed integer can hold @stable ICU 2.0 */
sl@0
   177
#   define INT8_MAX        ((int8_t)(127))
sl@0
   178
#endif
sl@0
   179
#ifndef INT16_MAX
sl@0
   180
/** The largest value a 16 bit signed integer can hold @stable ICU 2.0 */
sl@0
   181
#   define INT16_MAX       ((int16_t)(32767))
sl@0
   182
#endif
sl@0
   183
#ifndef INT32_MAX
sl@0
   184
/** The largest value a 32 bit signed integer can hold @stable ICU 2.0 */
sl@0
   185
#   define INT32_MAX       ((int32_t)(2147483647))
sl@0
   186
#endif
sl@0
   187
sl@0
   188
#ifndef UINT8_MAX
sl@0
   189
/** The largest value an 8 bit unsigned integer can hold @stable ICU 2.0 */
sl@0
   190
#   define UINT8_MAX       ((uint8_t)(255U))
sl@0
   191
#endif
sl@0
   192
#ifndef UINT16_MAX
sl@0
   193
/** The largest value a 16 bit unsigned integer can hold @stable ICU 2.0 */
sl@0
   194
#   define UINT16_MAX      ((uint16_t)(65535U))
sl@0
   195
#endif
sl@0
   196
#ifndef UINT32_MAX
sl@0
   197
/** The largest value a 32 bit unsigned integer can hold @stable ICU 2.0 */
sl@0
   198
#   define UINT32_MAX      ((uint32_t)(4294967295U))
sl@0
   199
#endif
sl@0
   200
sl@0
   201
#if defined(U_INT64_T_UNAVAILABLE)
sl@0
   202
# error int64_t is required for decimal format and rule-based number format.
sl@0
   203
#else
sl@0
   204
# ifndef INT64_C
sl@0
   205
/**
sl@0
   206
 * Provides a platform independent way to specify a signed 64-bit integer constant.
sl@0
   207
 * note: may be wrong for some 64 bit platforms - ensure your compiler provides INT64_C
sl@0
   208
 * @stable ICU 2.8
sl@0
   209
 */
sl@0
   210
#   define INT64_C(c) c ## LL
sl@0
   211
# endif
sl@0
   212
# ifndef UINT64_C
sl@0
   213
/**
sl@0
   214
 * Provides a platform independent way to specify an unsigned 64-bit integer constant.
sl@0
   215
 * note: may be wrong for some 64 bit platforms - ensure your compiler provides UINT64_C
sl@0
   216
 * @stable ICU 2.8
sl@0
   217
 */
sl@0
   218
#   define UINT64_C(c) c ## ULL
sl@0
   219
# endif
sl@0
   220
# ifndef U_INT64_MIN
sl@0
   221
/** The smallest value a 64 bit signed integer can hold @stable ICU 2.8 */
sl@0
   222
#     define U_INT64_MIN       ((int64_t)(INT64_C(-9223372036854775807)-1))
sl@0
   223
# endif
sl@0
   224
# ifndef U_INT64_MAX
sl@0
   225
/** The largest value a 64 bit signed integer can hold @stable ICU 2.8 */
sl@0
   226
#     define U_INT64_MAX       ((int64_t)(INT64_C(9223372036854775807)))
sl@0
   227
# endif
sl@0
   228
# ifndef U_UINT64_MAX
sl@0
   229
/** The largest value a 64 bit unsigned integer can hold @stable ICU 2.8 */
sl@0
   230
#     define U_UINT64_MAX      ((uint64_t)(UINT64_C(18446744073709551615)))
sl@0
   231
# endif
sl@0
   232
#endif
sl@0
   233
sl@0
   234
/*==========================================================================*/
sl@0
   235
/* Boolean data type                                                        */
sl@0
   236
/*==========================================================================*/
sl@0
   237
sl@0
   238
/** The ICU boolean type @stable ICU 2.0 */
sl@0
   239
typedef int8_t UBool;
sl@0
   240
sl@0
   241
#ifndef TRUE
sl@0
   242
/** The TRUE value of a UBool @stable ICU 2.0 */
sl@0
   243
#   define TRUE  1
sl@0
   244
#endif
sl@0
   245
#ifndef FALSE
sl@0
   246
/** The FALSE value of a UBool @stable ICU 2.0 */
sl@0
   247
#   define FALSE 0
sl@0
   248
#endif
sl@0
   249
sl@0
   250
sl@0
   251
/*==========================================================================*/
sl@0
   252
/* Unicode data types                                                       */
sl@0
   253
/*==========================================================================*/
sl@0
   254
sl@0
   255
/* wchar_t-related definitions -------------------------------------------- */
sl@0
   256
sl@0
   257
/**
sl@0
   258
 * \def U_HAVE_WCHAR_H
sl@0
   259
 * Indicates whether <wchar.h> is available (1) or not (0). Set to 1 by default.
sl@0
   260
 *
sl@0
   261
 * @stable ICU 2.0
sl@0
   262
 */
sl@0
   263
#ifndef U_HAVE_WCHAR_H
sl@0
   264
#   define U_HAVE_WCHAR_H 1
sl@0
   265
#endif
sl@0
   266
sl@0
   267
/**
sl@0
   268
 * \def U_SIZEOF_WCHAR_T
sl@0
   269
 * U_SIZEOF_WCHAR_T==sizeof(wchar_t) (0 means it is not defined or autoconf could not set it)
sl@0
   270
 *
sl@0
   271
 * @stable ICU 2.0
sl@0
   272
 */
sl@0
   273
#if U_SIZEOF_WCHAR_T==0
sl@0
   274
#   undef U_SIZEOF_WCHAR_T
sl@0
   275
#   define U_SIZEOF_WCHAR_T 4
sl@0
   276
#endif
sl@0
   277
sl@0
   278
/*
sl@0
   279
 * \def U_WCHAR_IS_UTF16
sl@0
   280
 * Defined if wchar_t uses UTF-16.
sl@0
   281
 *
sl@0
   282
 * @stable ICU 2.0
sl@0
   283
 */
sl@0
   284
/*
sl@0
   285
 * \def U_WCHAR_IS_UTF32
sl@0
   286
 * Defined if wchar_t uses UTF-32.
sl@0
   287
 *
sl@0
   288
 * @stable ICU 2.0
sl@0
   289
 */
sl@0
   290
#if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32)
sl@0
   291
#   ifdef __STDC_ISO_10646__ 
sl@0
   292
#       if (U_SIZEOF_WCHAR_T==2)
sl@0
   293
#           define U_WCHAR_IS_UTF16
sl@0
   294
#       elif (U_SIZEOF_WCHAR_T==4)
sl@0
   295
#           define  U_WCHAR_IS_UTF32
sl@0
   296
#       endif
sl@0
   297
#   elif defined __UCS2__
sl@0
   298
#       if (__OS390__ || __OS400__) && (U_SIZEOF_WCHAR_T==2)
sl@0
   299
#           define U_WCHAR_IS_UTF16
sl@0
   300
#       endif
sl@0
   301
#   elif defined __UCS4__
sl@0
   302
#       if (U_SIZEOF_WCHAR_T==4)
sl@0
   303
#           define U_WCHAR_IS_UTF32
sl@0
   304
#       endif
sl@0
   305
#   elif defined(U_WINDOWS)
sl@0
   306
#       define U_WCHAR_IS_UTF16    
sl@0
   307
#   endif
sl@0
   308
#endif
sl@0
   309
sl@0
   310
/* UChar and UChar32 definitions -------------------------------------------- */
sl@0
   311
sl@0
   312
/** Number of bytes in a UChar. @stable ICU 2.0 */
sl@0
   313
#define U_SIZEOF_UCHAR 2
sl@0
   314
sl@0
   315
/**
sl@0
   316
 * \var UChar
sl@0
   317
 * Define UChar to be wchar_t if that is 16 bits wide; always assumed to be unsigned.
sl@0
   318
 * If wchar_t is not 16 bits wide, then define UChar to be uint16_t.
sl@0
   319
 * This makes the definition of UChar platform-dependent
sl@0
   320
 * but allows direct string type compatibility with platforms with
sl@0
   321
 * 16-bit wchar_t types.
sl@0
   322
 *
sl@0
   323
 * @stable ICU 2.0
sl@0
   324
 */
sl@0
   325
sl@0
   326
/* Define UChar to be compatible with wchar_t if possible. */
sl@0
   327
#if U_SIZEOF_WCHAR_T==2
sl@0
   328
    typedef wchar_t UChar;
sl@0
   329
#else
sl@0
   330
    typedef uint16_t UChar;
sl@0
   331
#endif
sl@0
   332
sl@0
   333
/**
sl@0
   334
 * Define UChar32 as a type for single Unicode code points.
sl@0
   335
 * UChar32 is a signed 32-bit integer (same as int32_t).
sl@0
   336
 *
sl@0
   337
 * The Unicode code point range is 0..0x10ffff.
sl@0
   338
 * All other values (negative or >=0x110000) are illegal as Unicode code points.
sl@0
   339
 * They may be used as sentinel values to indicate "done", "error"
sl@0
   340
 * or similar non-code point conditions.
sl@0
   341
 *
sl@0
   342
 * Before ICU 2.4 (Jitterbug 2146), UChar32 was defined
sl@0
   343
 * to be wchar_t if that is 32 bits wide (wchar_t may be signed or unsigned)
sl@0
   344
 * or else to be uint32_t.
sl@0
   345
 * That is, the definition of UChar32 was platform-dependent.
sl@0
   346
 *
sl@0
   347
 * @see U_SENTINEL
sl@0
   348
 * @stable ICU 2.4
sl@0
   349
 */
sl@0
   350
typedef int32_t UChar32;
sl@0
   351
sl@0
   352
/*==========================================================================*/
sl@0
   353
/* U_INLINE and U_ALIGN_CODE   Set default values if these are not already  */
sl@0
   354
/*                             defined.  Definitions normally are in        */
sl@0
   355
/*                             platform.h or the corresponding file for     */
sl@0
   356
/*                             the OS in use.                               */
sl@0
   357
/*==========================================================================*/
sl@0
   358
sl@0
   359
/**
sl@0
   360
 * \def U_ALIGN_CODE
sl@0
   361
 * This is used to align code fragments to a specific byte boundary.
sl@0
   362
 * This is useful for getting consistent performance test results.
sl@0
   363
 * @internal
sl@0
   364
 */
sl@0
   365
#ifndef U_ALIGN_CODE
sl@0
   366
#   define U_ALIGN_CODE(n)
sl@0
   367
#endif
sl@0
   368
sl@0
   369
#ifndef U_INLINE
sl@0
   370
#   ifdef XP_CPLUSPLUS
sl@0
   371
#       define U_INLINE inline
sl@0
   372
#   else
sl@0
   373
#       define U_INLINE
sl@0
   374
#   endif
sl@0
   375
#endif
sl@0
   376
sl@0
   377
#include "unicode/urename.h"
sl@0
   378
sl@0
   379
#endif