16f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org/*
26f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org******************************************************************************
36f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org*
46f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org*   Copyright (C) 1997-2012, International Business Machines
56f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org*   Corporation and others.  All Rights Reserved.
66f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org*
76f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org******************************************************************************
86f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org*
96f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org*  FILE NAME : ptypes.h
106f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org*
116f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org*   Date        Name        Description
126f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org*   05/13/98    nos         Creation (content moved here from ptypes.h).
136f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org*   03/02/99    stephen     Added AS400 support.
146f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org*   03/30/99    stephen     Added Linux support.
156f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org*   04/13/99    stephen     Reworked for autoconf.
166f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org*   09/18/08    srl         Moved basic types back to ptypes.h from platform.h
176f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org******************************************************************************
186f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org*/
196f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
206f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org/**
216f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org * \file
226f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org * \brief C API: Definitions of integer types of various widths
236f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org */
246f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
256f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#ifndef _PTYPES_H
266f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#define _PTYPES_H
276f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
286f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org/**
296f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org * \def __STDC_LIMIT_MACROS
306f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org * According to the Linux stdint.h, the ISO C99 standard specifies that in C++ implementations
316f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org * macros like INT32_MIN and UINTPTR_MAX should only be defined if explicitly requested.
326f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org * We need to define __STDC_LIMIT_MACROS before including stdint.h in C++ code
336f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org * that uses such limit macros.
346f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org * @internal
356f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org */
366f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#ifndef __STDC_LIMIT_MACROS
376f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#define __STDC_LIMIT_MACROS
386f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#endif
396f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
406f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org/* NULL, size_t, wchar_t */
416f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#include <stddef.h>
426f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
436f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org/*
446f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org * If all compilers provided all of the C99 headers and types,
456f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org * we would just unconditionally #include <stdint.h> here
466f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org * and not need any of the stuff after including platform.h.
476f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org */
486f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
496f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org/* Find out if we have stdint.h etc. */
506f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#include "unicode/platform.h"
516f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
526f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org/*===========================================================================*/
536f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org/* Generic data types                                                        */
546f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org/*===========================================================================*/
556f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
566f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org/* If your platform does not have the <stdint.h> header, you may
576f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org   need to edit the typedefs in the #else section below.
586f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org   Use #if...#else...#endif with predefined compiler macros if possible. */
596f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#if U_HAVE_STDINT_H
606f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
616f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org/*
626f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org * We mostly need <stdint.h> (which defines the standard integer types) but not <inttypes.h>.
636f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org * <inttypes.h> includes <stdint.h> and adds the printf/scanf helpers PRId32, SCNx16 etc.
646f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org * which we almost never use, plus stuff like imaxabs() which we never use.
656f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org */
666f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#include <stdint.h>
676f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
686f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#if U_PLATFORM == U_PF_OS390
696f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org/* The features header is needed to get (u)int64_t sometimes. */
706f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#include <features.h>
716f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org/* z/OS has <stdint.h>, but some versions are missing uint8_t (APAR PK62248). */
726f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#if !defined(__uint8_t)
736f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#define __uint8_t 1
746f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgtypedef unsigned char uint8_t;
756f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#endif
766f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#endif /* U_PLATFORM == U_PF_OS390 */
776f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
786f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#elif U_HAVE_INTTYPES_H
796f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
806f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#   include <inttypes.h>
816f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
826f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#else /* neither U_HAVE_STDINT_H nor U_HAVE_INTTYPES_H */
836f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
846f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#if ! U_HAVE_INT8_T
856f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgtypedef signed char int8_t;
866f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#endif
876f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
886f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#if ! U_HAVE_UINT8_T
896f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgtypedef unsigned char uint8_t;
906f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#endif
916f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
926f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#if ! U_HAVE_INT16_T
936f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgtypedef signed short int16_t;
946f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#endif
956f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
966f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#if ! U_HAVE_UINT16_T
976f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgtypedef unsigned short uint16_t;
986f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#endif
996f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
1006f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#if ! U_HAVE_INT32_T
1016f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgtypedef signed int int32_t;
1026f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#endif
1036f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
1046f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#if ! U_HAVE_UINT32_T
1056f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgtypedef unsigned int uint32_t;
1066f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#endif
1076f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
1086f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#if ! U_HAVE_INT64_T
1096f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#ifdef _MSC_VER
1106f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org    typedef signed __int64 int64_t;
1116f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#else
1126f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org    typedef signed long long int64_t;
1136f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#endif
1146f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#endif
1156f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
1166f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#if ! U_HAVE_UINT64_T
1176f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#ifdef _MSC_VER
1186f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org    typedef unsigned __int64 uint64_t;
1196f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#else
1206f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org    typedef unsigned long long uint64_t;
1216f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#endif
1226f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#endif
1236f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
1246f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#endif /* U_HAVE_STDINT_H / U_HAVE_INTTYPES_H */
1256f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
1266f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#endif /* _PTYPES_H */
127