ICU 49.1.1  49.1.1
ptypes.h
1 /*
2 ******************************************************************************
3 *
4 * Copyright (C) 1997-2011, International Business Machines
5 * Corporation and others. All Rights Reserved.
6 *
7 ******************************************************************************
8 *
9 * FILE NAME : ptypes.h
10 *
11 * Date Name Description
12 * 05/13/98 nos Creation (content moved here from ptypes.h).
13 * 03/02/99 stephen Added AS400 support.
14 * 03/30/99 stephen Added Linux support.
15 * 04/13/99 stephen Reworked for autoconf.
16 * 09/18/08 srl Moved basic types back to ptypes.h from platform.h
17 ******************************************************************************
18 */
19 
20 #ifndef _PTYPES_H
21 #define _PTYPES_H
22 
31 #ifndef __STDC_LIMIT_MACROS
32 #define __STDC_LIMIT_MACROS
33 #endif
34 
35 /* NULL, size_t, wchar_t */
36 #include <stddef.h>
37 
38 /*
39  * If all compilers provided all of the C99 headers and types,
40  * we would just unconditionally #include <stdint.h> here
41  * and not need any of the stuff after including platform.h.
42  */
43 
44 /* Find out if we have stdint.h etc. */
45 #include "unicode/platform.h"
46 
47 /*===========================================================================*/
48 /* Generic data types */
49 /*===========================================================================*/
50 
51 /* If your platform does not have the <stdint.h> header, you may
52  need to edit the typedefs in the #else section below.
53  Use #if...#else...#endif with predefined compiler macros if possible. */
54 #if U_HAVE_STDINT_H
55 
56 /*
57  * We mostly need <stdint.h> (which defines the standard integer types) but not <inttypes.h>.
58  * <inttypes.h> includes <stdint.h> and adds the printf/scanf helpers PRId32, SCNx16 etc.
59  * which we almost never use, plus stuff like imaxabs() which we never use.
60  */
61 #include <stdint.h>
62 
63 #if U_PLATFORM == U_PF_OS390
64 /* The features header is needed to get (u)int64_t sometimes. */
65 #include <features.h>
66 /* z/OS has <stdint.h>, but some versions are missing uint8_t (APAR PK62248). */
67 #if !defined(__uint8_t)
68 #define __uint8_t 1
69 typedef unsigned char uint8_t;
70 #endif
71 #endif /* U_PLATFORM == U_PF_OS390 */
72 
73 #elif U_HAVE_INTTYPES_H
74 
75 # include <inttypes.h>
76 
77 #else /* neither U_HAVE_STDINT_H nor U_HAVE_INTTYPES_H */
78 
79 #if ! U_HAVE_INT8_T
80 typedef signed char int8_t;
81 #endif
82 
83 #if ! U_HAVE_UINT8_T
84 typedef unsigned char uint8_t;
85 #endif
86 
87 #if ! U_HAVE_INT16_T
88 typedef signed short int16_t;
89 #endif
90 
91 #if ! U_HAVE_UINT16_T
92 typedef unsigned short uint16_t;
93 #endif
94 
95 #if ! U_HAVE_INT32_T
96 typedef signed int int32_t;
97 #endif
98 
99 #if ! U_HAVE_UINT32_T
100 typedef unsigned int uint32_t;
101 #endif
102 
103 #if ! U_HAVE_INT64_T
104 #ifdef _MSC_VER
105  typedef signed __int64 int64_t;
106 #else
107  typedef signed long long int64_t;
108 #endif
109 #endif
110 
111 #if ! U_HAVE_UINT64_T
112 #ifdef _MSC_VER
113  typedef unsigned __int64 uint64_t;
114 #else
115  typedef unsigned long long uint64_t;
116 #endif
117 #endif
118 
119 #endif /* U_HAVE_STDINT_H / U_HAVE_INTTYPES_H */
120 
121 #endif /* _PTYPES_H */