~ubuntu-branches/ubuntu/quantal/icu/quantal

« back to all changes in this revision

Viewing changes to source/common/unicode/umachine.h

  • Committer: Package Import Robot
  • Author(s): Yves Arrouye
  • Date: 2002-03-03 15:31:13 UTC
  • Revision ID: package-import@ubuntu.com-20020303153113-3ssceqlq45xbmbnc
Tags: upstream-2.0-2.1pre20020303
ImportĀ upstreamĀ versionĀ 2.0-2.1pre20020303

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
******************************************************************************
 
3
*
 
4
*   Copyright (C) 1999-2001, International Business Machines
 
5
*   Corporation and others.  All Rights Reserved.
 
6
*
 
7
******************************************************************************
 
8
*   file name:  umachine.h
 
9
*   encoding:   US-ASCII
 
10
*   tab size:   8 (not used)
 
11
*   indentation:4
 
12
*
 
13
*   created on: 1999sep13
 
14
*   created by: Markus W. Scherer
 
15
*
 
16
*   This file defines basic types and constants for utf.h to be
 
17
*   platform-independent. umachine.h and utf.h are included into
 
18
*   utypes.h to provide all the general definitions for ICU.
 
19
*   All of these definitions used to be in utypes.h before
 
20
*   the UTF-handling macros made this unmaintainable.
 
21
*/
 
22
 
 
23
#ifndef __UMACHINE_H__
 
24
#define __UMACHINE_H__
 
25
 
 
26
 
 
27
/**
 
28
 * \file
 
29
 * \brief Basic types and constants for UTF 
 
30
 * 
 
31
 * <h2> Basic types and constants for UTF </h2>
 
32
 *   This file defines basic types and constants for utf.h to be
 
33
 *   platform-independent. umachine.h and utf.h are included into
 
34
 *   utypes.h to provide all the general definitions for ICU.
 
35
 *   All of these definitions used to be in utypes.h before
 
36
 *   the UTF-handling macros made this unmaintainable.
 
37
 * 
 
38
 */
 
39
/*==========================================================================*/
 
40
/* Include platform-dependent definitions                                   */
 
41
/* which are contained in the platform-specific file platform.h             */
 
42
/*==========================================================================*/
 
43
 
 
44
#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
 
45
#   include "unicode/pwin32.h"
 
46
#elif defined(__OS2__)
 
47
#   include "unicode/pos2.h"
 
48
#elif defined(__OS400__)
 
49
#   include "unicode/pos400.h"
 
50
#elif defined(__MWERKS__)
 
51
#   include "unicode/pmacos.h"
 
52
#else
 
53
#   include "unicode/platform.h"
 
54
#endif
 
55
 
 
56
/*===========================================================================*/
 
57
/* XP_CPLUSPLUS is a cross-platform symbol which should be defined when      */
 
58
/* using C++.  It should not be defined when compiling under C.              */
 
59
/*===========================================================================*/
 
60
 
 
61
#ifdef __cplusplus
 
62
#   ifndef XP_CPLUSPLUS
 
63
#       define XP_CPLUSPLUS
 
64
#   endif
 
65
#else
 
66
#   undef XP_CPLUSPLUS
 
67
#endif
 
68
 
 
69
/*===========================================================================*/
 
70
/* For C wrappers, we use the symbol U_CAPI.                                 */
 
71
/* This works properly if the includer is C or C++.                          */
 
72
/* Functions are declared   U_CAPI return-type U_EXPORT2 function-name() ... */
 
73
/*===========================================================================*/
 
74
 
 
75
#ifdef XP_CPLUSPLUS
 
76
#   define U_CFUNC extern "C"
 
77
#   define U_CDECL_BEGIN extern "C" {
 
78
#   define U_CDECL_END   }
 
79
#else
 
80
#   define U_CFUNC extern
 
81
#   define U_CDECL_BEGIN
 
82
#   define U_CDECL_END
 
83
#endif
 
84
 
 
85
/* Define namespace symbols if the compiler supports it. */
 
86
#if U_HAVE_NAMESPACE
 
87
#   define U_NAMESPACE_BEGIN namespace U_ICU_NAMESPACE {
 
88
#   define U_NAMESPACE_END  }
 
89
#   define U_NAMESPACE_USE using namespace U_ICU_NAMESPACE;
 
90
#   define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE::
 
91
#else
 
92
#   define U_NAMESPACE_BEGIN
 
93
#   define U_NAMESPACE_END
 
94
#   define U_NAMESPACE_USE
 
95
#   define U_NAMESPACE_QUALIFIER
 
96
#endif
 
97
#define U_CAPI U_CFUNC U_EXPORT
 
98
/*===========================================================================*/
 
99
/* limits for int32_t etc., like in POSIX inttypes.h                         */
 
100
/*===========================================================================*/
 
101
 
 
102
#ifndef INT8_MIN
 
103
#   define INT8_MIN        ((int8_t)(-128))
 
104
#endif
 
105
#ifndef INT16_MIN
 
106
#   define INT16_MIN       ((int16_t)(-32767-1))
 
107
#endif
 
108
#ifndef INT32_MIN
 
109
#   define INT32_MIN       ((int32_t)(-2147483647-1))
 
110
#endif
 
111
 
 
112
#ifndef INT8_MAX
 
113
#   define INT8_MAX        ((int8_t)(127))
 
114
#endif
 
115
#ifndef INT16_MAX
 
116
#   define INT16_MAX       ((int16_t)(32767))
 
117
#endif
 
118
#ifndef INT32_MAX
 
119
#   define INT32_MAX       ((int32_t)(2147483647))
 
120
#endif
 
121
 
 
122
#ifndef UINT8_MAX
 
123
#   define UINT8_MAX       ((uint8_t)(255U))
 
124
#endif
 
125
#ifndef UINT16_MAX
 
126
#   define UINT16_MAX      ((uint16_t)(65535U))
 
127
#endif
 
128
#ifndef UINT32_MAX
 
129
#   define UINT32_MAX      ((uint32_t)(4294967295U))
 
130
#endif
 
131
 
 
132
#if defined(__64BIT__) || defined(_LONG_LONG) || defined(_LP64) || defined(WIN64) || defined(_WIN64)
 
133
#   ifndef INT64_MIN
 
134
#       define INT64_MIN       ((int64_t)(-9223372036854775807-1))
 
135
#   endif
 
136
#   ifndef INT64_MAX
 
137
#       define INT64_MAX       ((int64_t)(9223372036854775807))
 
138
#   endif
 
139
#   ifndef UINT64_MAX
 
140
#       define UINT64_MAX      ((uint64_t)(18446744073709551615))
 
141
#   endif
 
142
#   ifndef INTMAX_MIN
 
143
#       define INTMAX_MIN      INT64_MIN
 
144
#   endif
 
145
#   ifndef INTMAX_MAX
 
146
#       define INTMAX_MAX      INT64_MAX
 
147
#   endif
 
148
#   ifndef UINTMAX_MAX
 
149
#       define UINTMAX_MAX     UINT64_MAX
 
150
#   endif
 
151
#else
 
152
#   ifndef INTMAX_MIN
 
153
#       define INTMAX_MIN      INT32_MIN
 
154
#   endif
 
155
#   ifndef INTMAX_MAX
 
156
#       define INTMAX_MAX      INT32_MAX
 
157
#   endif
 
158
#   ifndef UINTMAX_MAX
 
159
#       define UINTMAX_MAX     UINT32_MAX
 
160
#   endif
 
161
#endif
 
162
 
 
163
/*===========================================================================*/
 
164
/* Boolean data type                                                         */
 
165
/*===========================================================================*/
 
166
 
 
167
typedef int8_t UBool;
 
168
 
 
169
#ifndef TRUE
 
170
#   define TRUE  1
 
171
#endif
 
172
#ifndef FALSE
 
173
#   define FALSE 0
 
174
#endif
 
175
 
 
176
 
 
177
/*===========================================================================*/
 
178
/* U_INLINE and U_ALIGN_CODE   Set default vaues if these are not already    */
 
179
/*                             defined.  Definitions normally are in         */
 
180
/*                             platform.h or the corresponding file for      */
 
181
/*                             the OS in use.                                */
 
182
/*===========================================================================*/
 
183
#ifndef U_ALIGN_CODE
 
184
#   define U_ALIGN_CODE(n)
 
185
#endif
 
186
 
 
187
#ifndef U_INLINE
 
188
#   define U_INLINE
 
189
#endif
 
190
 
 
191
#include "unicode/urename.h"
 
192
 
 
193
#endif