00001 /* 00002 ****************************************************************************** 00003 * 00004 * Copyright (C) 1997-2012, International Business Machines 00005 * Corporation and others. All Rights Reserved. 00006 * 00007 ****************************************************************************** 00008 * 00009 * FILE NAME : ptypes.h 00010 * 00011 * Date Name Description 00012 * 05/13/98 nos Creation (content moved here from ptypes.h). 00013 * 03/02/99 stephen Added AS400 support. 00014 * 03/30/99 stephen Added Linux support. 00015 * 04/13/99 stephen Reworked for autoconf. 00016 * 09/18/08 srl Moved basic types back to ptypes.h from platform.h 00017 ****************************************************************************** 00018 */ 00019 00025 #ifndef _PTYPES_H 00026 #define _PTYPES_H 00027 00036 #ifndef __STDC_LIMIT_MACROS 00037 #define __STDC_LIMIT_MACROS 00038 #endif 00039 00040 /* NULL, size_t, wchar_t */ 00041 #include <stddef.h> 00042 00043 /* 00044 * If all compilers provided all of the C99 headers and types, 00045 * we would just unconditionally #include <stdint.h> here 00046 * and not need any of the stuff after including platform.h. 00047 */ 00048 00049 /* Find out if we have stdint.h etc. */ 00050 #include "unicode/platform.h" 00051 00052 /*===========================================================================*/ 00053 /* Generic data types */ 00054 /*===========================================================================*/ 00055 00056 /* If your platform does not have the <stdint.h> header, you may 00057 need to edit the typedefs in the #else section below. 00058 Use #if...#else...#endif with predefined compiler macros if possible. */ 00059 #if U_HAVE_STDINT_H 00060 00061 /* 00062 * We mostly need <stdint.h> (which defines the standard integer types) but not <inttypes.h>. 00063 * <inttypes.h> includes <stdint.h> and adds the printf/scanf helpers PRId32, SCNx16 etc. 00064 * which we almost never use, plus stuff like imaxabs() which we never use. 00065 */ 00066 #include <stdint.h> 00067 00068 #if U_PLATFORM == U_PF_OS390 00069 /* The features header is needed to get (u)int64_t sometimes. */ 00070 #include <features.h> 00071 /* z/OS has <stdint.h>, but some versions are missing uint8_t (APAR PK62248). */ 00072 #if !defined(__uint8_t) 00073 #define __uint8_t 1 00074 typedef unsigned char uint8_t; 00075 #endif 00076 #endif /* U_PLATFORM == U_PF_OS390 */ 00077 00078 #elif U_HAVE_INTTYPES_H 00079 00080 # include <inttypes.h> 00081 00082 #else /* neither U_HAVE_STDINT_H nor U_HAVE_INTTYPES_H */ 00083 00084 #if ! U_HAVE_INT8_T 00085 typedef signed char int8_t; 00086 #endif 00087 00088 #if ! U_HAVE_UINT8_T 00089 typedef unsigned char uint8_t; 00090 #endif 00091 00092 #if ! U_HAVE_INT16_T 00093 typedef signed short int16_t; 00094 #endif 00095 00096 #if ! U_HAVE_UINT16_T 00097 typedef unsigned short uint16_t; 00098 #endif 00099 00100 #if ! U_HAVE_INT32_T 00101 typedef signed int int32_t; 00102 #endif 00103 00104 #if ! U_HAVE_UINT32_T 00105 typedef unsigned int uint32_t; 00106 #endif 00107 00108 #if ! U_HAVE_INT64_T 00109 #ifdef _MSC_VER 00110 typedef signed __int64 int64_t; 00111 #else 00112 typedef signed long long int64_t; 00113 #endif 00114 #endif 00115 00116 #if ! U_HAVE_UINT64_T 00117 #ifdef _MSC_VER 00118 typedef unsigned __int64 uint64_t; 00119 #else 00120 typedef unsigned long long uint64_t; 00121 #endif 00122 #endif 00123 00124 #endif /* U_HAVE_STDINT_H / U_HAVE_INTTYPES_H */ 00125 00126 #endif /* _PTYPES_H */