ICU 49.1.1  49.1.1
ptypes.h
00001 /*
00002 ******************************************************************************
00003 *
00004 *   Copyright (C) 1997-2011, 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 
00020 #ifndef _PTYPES_H
00021 #define _PTYPES_H
00022 
00031 #ifndef __STDC_LIMIT_MACROS
00032 #define __STDC_LIMIT_MACROS
00033 #endif
00034 
00035 /* NULL, size_t, wchar_t */
00036 #include <stddef.h>
00037 
00038 /*
00039  * If all compilers provided all of the C99 headers and types,
00040  * we would just unconditionally #include <stdint.h> here
00041  * and not need any of the stuff after including platform.h.
00042  */
00043 
00044 /* Find out if we have stdint.h etc. */
00045 #include "unicode/platform.h"
00046 
00047 /*===========================================================================*/
00048 /* Generic data types                                                        */
00049 /*===========================================================================*/
00050 
00051 /* If your platform does not have the <stdint.h> header, you may
00052    need to edit the typedefs in the #else section below.
00053    Use #if...#else...#endif with predefined compiler macros if possible. */
00054 #if U_HAVE_STDINT_H
00055 
00056 /*
00057  * We mostly need <stdint.h> (which defines the standard integer types) but not <inttypes.h>.
00058  * <inttypes.h> includes <stdint.h> and adds the printf/scanf helpers PRId32, SCNx16 etc.
00059  * which we almost never use, plus stuff like imaxabs() which we never use.
00060  */
00061 #include <stdint.h>
00062 
00063 #if U_PLATFORM == U_PF_OS390
00064 /* The features header is needed to get (u)int64_t sometimes. */
00065 #include <features.h>
00066 /* z/OS has <stdint.h>, but some versions are missing uint8_t (APAR PK62248). */
00067 #if !defined(__uint8_t)
00068 #define __uint8_t 1
00069 typedef unsigned char uint8_t;
00070 #endif
00071 #endif /* U_PLATFORM == U_PF_OS390 */
00072 
00073 #elif U_HAVE_INTTYPES_H
00074 
00075 #   include <inttypes.h>
00076 
00077 #else /* neither U_HAVE_STDINT_H nor U_HAVE_INTTYPES_H */
00078 
00079 #if ! U_HAVE_INT8_T
00080 typedef signed char int8_t;
00081 #endif
00082 
00083 #if ! U_HAVE_UINT8_T
00084 typedef unsigned char uint8_t;
00085 #endif
00086 
00087 #if ! U_HAVE_INT16_T
00088 typedef signed short int16_t;
00089 #endif
00090 
00091 #if ! U_HAVE_UINT16_T
00092 typedef unsigned short uint16_t;
00093 #endif
00094 
00095 #if ! U_HAVE_INT32_T
00096 typedef signed int int32_t;
00097 #endif
00098 
00099 #if ! U_HAVE_UINT32_T
00100 typedef unsigned int uint32_t;
00101 #endif
00102 
00103 #if ! U_HAVE_INT64_T
00104 #ifdef _MSC_VER
00105     typedef signed __int64 int64_t;
00106 #else
00107     typedef signed long long int64_t;
00108 #endif
00109 #endif
00110 
00111 #if ! U_HAVE_UINT64_T
00112 #ifdef _MSC_VER
00113     typedef unsigned __int64 uint64_t;
00114 #else
00115     typedef unsigned long long uint64_t;
00116 #endif
00117 #endif
00118 
00119 #endif /* U_HAVE_STDINT_H / U_HAVE_INTTYPES_H */
00120 
00121 #endif /* _PTYPES_H */