00001 /* 00002 ******************************************************************************* 00003 * 00004 * Copyright (C) 1999-2000, International Business Machines 00005 * Corporation and others. All Rights Reserved. 00006 * 00007 ******************************************************************************* 00008 * file name: umachine.h 00009 * encoding: US-ASCII 00010 * tab size: 8 (not used) 00011 * indentation:4 00012 * 00013 * created on: 1999sep13 00014 * created by: Markus W. Scherer 00015 * 00016 * This file defines basic types and constants for utf.h to be 00017 * platform-independent. umachine.h and utf.h are included into 00018 * utypes.h to provide all the general definitions for ICU. 00019 * All of these definitions used to be in utypes.h before 00020 * the UTF-handling macros made this unmaintainable. 00021 */ 00022 00023 #ifndef __UMACHINE_H__ 00024 #define __UMACHINE_H__ 00025 00026 /*===========================================================================*/ 00027 /* Include platform-dependent definitions */ 00028 /* which are contained in the platform-specific file platform.h */ 00029 /*===========================================================================*/ 00030 00031 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) 00032 # include "unicode/pwin32.h" 00033 #elif defined(__OS2__) 00034 # include "unicode/pos2.h" 00035 #elif defined(__OS400__) 00036 # include "unicode/pos400.h" 00037 #else 00038 # include "unicode/platform.h" 00039 #endif 00040 00041 /*===========================================================================*/ 00042 /* XP_CPLUSPLUS is a cross-platform symbol which should be defined when */ 00043 /* using C++. It should not be defined when compiling under C. */ 00044 /*===========================================================================*/ 00045 00046 #ifdef __cplusplus 00047 # ifndef XP_CPLUSPLUS 00048 # define XP_CPLUSPLUS 00049 # endif 00050 #else 00051 # undef XP_CPLUSPLUS 00052 #endif 00053 00054 /*===========================================================================*/ 00055 /* For C wrappers, we use the symbol U_CAPI. */ 00056 /* This works properly if the includer is C or C++. */ 00057 /* Functions are declared U_CAPI return-type U_EXPORT2 function-name() ... */ 00058 /*===========================================================================*/ 00059 00060 #ifdef XP_CPLUSPLUS 00061 # define U_CFUNC extern "C" 00062 # define U_CDECL_BEGIN extern "C" { 00063 # define U_CDECL_END } 00064 #else 00065 # define U_CFUNC extern 00066 # define U_CDECL_BEGIN 00067 # define U_CDECL_END 00068 #endif 00069 #define U_CAPI U_CFUNC U_EXPORT 00070 00071 /*===========================================================================*/ 00072 /* limits for int32_t etc., like in POSIX inttypes.h */ 00073 /*===========================================================================*/ 00074 00075 #ifndef INT8_MIN 00076 # define INT8_MIN (-128) 00077 #endif 00078 #ifndef INT16_MIN 00079 # define INT16_MIN (-32767-1) 00080 #endif 00081 #ifndef INT32_MIN 00082 # define INT32_MIN (-2147483647-1) 00083 #endif 00084 00085 #ifndef INT8_MAX 00086 # define INT8_MAX (127) 00087 #endif 00088 #ifndef INT16_MAX 00089 # define INT16_MAX (32767) 00090 #endif 00091 #ifndef INT32_MAX 00092 # define INT32_MAX (2147483647) 00093 #endif 00094 00095 #ifndef UINT8_MAX 00096 # define UINT8_MAX (255U) 00097 #endif 00098 #ifndef UINT16_MAX 00099 # define UINT16_MAX (65535U) 00100 #endif 00101 #ifndef UINT32_MAX 00102 # define UINT32_MAX (4294967295U)... 00103 #endif 00104 00105 #if defined(__64BIT__) || defined(_LONG_LONG) || defined(_LP64) || defined(WIN64) || defined(_WIN64) 00106 # ifndef INT64_MIN 00107 # define INT64_MIN (-9223372036854775807-1) 00108 # endif 00109 # ifndef INT64_MAX 00110 # define INT64_MAX (9223372036854775807) 00111 # endif 00112 # ifndef UINT64_MAX 00113 # define UINT64_MAX (18446744073709551615) 00114 # endif 00115 # ifndef INTMAX_MIN 00116 # define INTMAX_MIN INT64_MIN 00117 # endif 00118 # ifndef INTMAX_MAX 00119 # define INTMAX_MAX INT64_MAX 00120 # endif 00121 # ifndef UINTMAX_MAX 00122 # define UINTMAX_MAX UINT64_MAX 00123 # endif 00124 #else 00125 # ifndef INTMAX_MIN 00126 # define INTMAX_MIN INT32_MIN 00127 # endif 00128 # ifndef INTMAX_MAX 00129 # define INTMAX_MAX INT32_MAX 00130 # endif 00131 # ifndef UINTMAX_MAX 00132 # define UINTMAX_MAX UINT32_MAX 00133 # endif 00134 #endif 00135 00136 /*===========================================================================*/ 00137 /* Boolean data type */ 00138 /*===========================================================================*/ 00139 00140 #if !HAVE_BOOL_T 00141 typedef int8_t bool_t; 00142 #endif 00143 00144 typedef int8_t UBool; 00145 00146 #ifndef TRUE 00147 # define TRUE 1 00148 #endif 00149 #ifndef FALSE 00150 # define FALSE 0 00151 #endif 00152 00153 #endif