/*  DO NOT EDIT THIS FILE.

    It has been auto-edited by fixincludes from:

	"/usr/include/inttypes.h"

    This had to be done to correct non-standard usages in the
    original, manufacturer supplied header file.  */

/* @(#) $Revision: ../hdr/inttypes.h@@/main/r11ros/cup_ros-cpe/cup_libc-ros-cpe/1 $ */
/*
 * (c) Copyright 1995 Hewlett-Packard Co., All Rights Reserved.
 */
/*********************** Basic integer types *****************************
**
** The following defines the basic fixed-size integer types. 
** 
** intmax_t and uintmax_t are to be the largest signed and unsigned integer
** types supported by the implementation. 
**
** intptr_t and uintptr_t are signed and unsigned integer types large enough
** to hold a pointer; that is, pointers can be assigned into or from 
** these integer types without losing precision.
**
** intfast_t and uintfast_t are the most efficient signed and unsigned 
** integer types of the implementation. 
**
** When compiling in ILP32 mode long long will be used for the 64-bit data
** types. This will cause compilation errors if 64-bit data types are
** requested and the compiler in use does not support them.
**
*/

#ifndef _INTTYPES_INCLUDED
#define _INTTYPES_INCLUDED

#ifdef _KERNEL_BUILD
#include "../h/_inttypes.h"
#else /* ! _KERNEL_BUILD */
#include <sys/_inttypes.h>
#endif /* ! _KERNEL_BUILD */


/* ************************ CONSTANTS ********************************
**
** The following macros create constants of the above types. The intent is
** that:
**	Constants defined using these macros have a specific length and
**	signedness. 
**
*/
/* handle ANSI C, aC++ and C++ with -Aa */
#if defined(__STDC__) || __cplusplus >= 199707L || defined(__STDCPP__)
#define __CONCAT__(_A,_B) _A ## _B
#define __CONCAT_U__(_A) _A ## u
/* handle C -Ae and aC++ & C++ with -ext */
/* LP64 takes precedence */
#if (defined(__STDC_EXT__) || defined(_INCLUDE_LONGLONG)) && !defined(__LP64__)
#define __CONCAT_L__(_A,_B) _A ## _B ## l        /* extra l for long long  */
#else
#define __CONCAT_L__(_A,_B) _A ## _B
#endif
#else   /* K&R cpp */
#define __CONCAT__(_A,_B) _A/**/_B
#ifdef __cplusplus
#define __CONCAT_U__(_A) _A/**/u
#else
#define __CONCAT_U__(_A) _A                      /* K&R C does not support u */
#endif
#define __CONCAT_L__(_A,_B) _A/**/_B/**/l
#endif

#define INT8_C(__c) 			 (__c) 
#define UINT8_C(__c)			 __CONCAT_U__(__c) 

#define INT16_C(__c)			 (__c) 
#define UINT16_C(__c)			 __CONCAT_U__(__c)

#ifdef __LP64__
#define INT32_C(__c)			 (__c)
#define UINT32_C(__c)			 __CONCAT_U__(__c)
#else /* __LP64 */
#define INT32_C(__c)			 __CONCAT__(__c,l)
#define UINT32_C(__c) __CONCAT__(__c,ul)
#endif /* __LP64 */

#define INT64_C(__c) 			 __CONCAT_L__(__c,l) 
#define UINT64_C(__c)			 __CONCAT_L__(__c,ul)

#define INTMAX_C(__c)			 __CONCAT_L__(__c,l)
#define UINTMAX_C(__c)			 __CONCAT_L__(__c,ul)

/* ************************** limits ***********************************
**
** The following defines the limits for the above types.
**
** INTMAX_MIN (minimum value of the largest supported integer type),
** INTMAX_MAX (maximum value of the largest supported integer type),
** and UINTMAX_MAX (maximum value of the largest supported unsigned integer
** type) can be set to implementation defined limits. 
**
** NOTE : A programmer can test to see whether an implementation supports
** a particular size of integer by testing if the macro that gives the
** maximum for that datatype is defined. For example, if #ifdef UINT64_MAX
** tests false, the implementation does not support unsigned 64 bit integers.
**
** The values used below are merely examples using the 2's complement
** numbering system. Actual limits for an implementation may vary.
**
*/

#define INT8_MAX       INT8_C(127)
#define INT16_MAX      INT16_C(32767)
#define INT32_MAX      INT32_C(2147483647)
#define INT64_MAX INT64_C(9223372036854775807) 

#define INT8_MIN  (-INT8_MAX - 1)
#define INT16_MIN (-INT16_MAX - 1)
#define INT32_MIN (-INT32_MAX - 1)
#define INT64_MIN (-INT64_MAX - 1)

#define INT_LEAST8_MIN  INT8_MIN
#define INT_LEAST16_MIN INT16_MIN
#define INT_LEAST32_MIN INT32_MIN
#define INT_LEAST64_MIN INT64_MIN

#define INT_FAST8_MIN  INT_MIN
#define INT_FAST16_MIN INT_MIN
#define INT_FAST32_MIN INT_MIN
#define INT_FAST64_MIN INT64_MIN

#define UINT8_MAX      UINT8_C(255)
#define UINT16_MAX     UINT16_C(65535)
#if defined(__STDC__) || defined(__cplusplus)
#  define UINT32_MAX     UINT32_C(4294967295)
#else /* defined(__STDC__) || defined(__cplusplus) */
#  define UINT32_MAX     037777777777
#endif /* defined(__STDC__) || defined(__cplusplus) */
#define UINT64_MAX     UINT64_C(18446744073709551615)

#if !defined(__STDC_32_MODE__)
#define INTMAX_MIN INT_LEAST64_MIN
#define INTMAX_MAX INT64_MAX		
#define UINTMAX_MAX UINT64_MAX		

#else /* __STDC_32_MODE__ */
#define INTMAX_MIN INT_LEAST32_MIN
#define INTMAX_MAX INT32_MAX		
#define UINTMAX_MAX UINT32_MAX		

#endif /* __STDC_32_MODE__ */

#define INTFAST_MIN INT_LEAST32_MIN 	
#define INTFAST_MAX INT32_MAX		
#define UINTFAST_MAX UINT32_MAX		

#define INT_LEAST8_MAX  INT8_MAX	
#define INT_LEAST16_MAX INT16_MAX 	
#define INT_LEAST32_MAX INT32_MAX 	
#define INT_LEAST64_MAX INT64_MAX	

#define INT_FAST8_MAX  INT_MAX
#define INT_FAST16_MAX INT_MAX
#define INT_FAST32_MAX INT_MAX
#define INT_FAST64_MAX INT64_MAX


/* The following 2 macros are provided for testing whether the types
** intptr_t and uintptr_t (integers large enough to hold a void *) are
** defined in this header. They are needed in case the architecture can't
** represent a pointer in any standard integral type.
*/

#define INTPTR_MAX    
#define UINTPTR_MAX



/************************* FORMATTED I/O ******************************** 
**
** The following macros can be used even when an implementation has not
** extended the printf/scanf family of functions. 
**
** The form of the names of the macros is either "PRI" for printf specifiers
** or "SCN" for scanf specifiers followed by the conversion specifier letter
** followed by the datatype size. For example, PRId32 is the macro for
** the printf d conversion specifier with the flags for 32 bit datatype.
**
** Separate printf versus scanf macros are given because typically different
** size flags must prefix the conversion specifier letter.
**
*** An example using one of these macros:
**
** 	uint64_t u;
** 	printf("u = %016" PRIx64 "\n", u);
**
** For the purpose of example, the definitions of the printf/scanf macros
** below have the values appropriate for a machine with distinct 8, 16, 32 
** and 64 bit datatypes.
**
*/

/* For signed integers */
#define PRId8			"d" 
#define PRId16			"d"
#ifndef __L64_MODE__
#define PRId32			"ld"
#else
#define PRId32			"d"
#endif
#ifdef __LL_MODE__
#define PRId64			"lld"
#else
#define PRId64			"ld"
#endif

#define PRIdFAST8			"d" 
#define PRIdFAST16			"d"
#define PRIdFAST32			"d"
#ifdef __LL_MODE__
#define PRIdFAST64			"lld"
#else
#define PRIdFAST64			"ld"
#endif

#define PRIdLEAST8			"d" 
#define PRIdLEAST16			"d"
#define PRIdLEAST32			"d"
#ifdef __LL_MODE__
#define PRIdLEAST64			"lld"
#else
#define PRIdLEAST64			"ld"
#endif

#define PRIi8			"i"
#define PRIi16			"i"
#ifndef __L64_MODE__
#define PRIi32			"li"
#else
#define PRIi32			"i"
#endif
#ifdef __LL_MODE__
#define PRIi64			"lli"
#else
#define PRIi64			"li"
#endif

#define PRIiFAST8			"i"
#define PRIiFAST16			"i"
#define PRIiFAST32			"i"
#ifdef __LL_MODE__
#define PRIiFAST64			"lli"
#else
#define PRIiFAST64			"li"
#endif

#define PRIiLEAST8			"i"
#define PRIiLEAST16			"i"
#ifndef __L64_MODE__
#define PRIiLEAST32			"li"
#else
#define PRIiLEAST32			"i"
#endif
#ifdef __LL_MODE__
#define PRIiLEAST64			"lli"
#else
#define PRIiLEAST64			"li"
#endif

#define PRIo8				"o"
#define PRIo16				"o"
#ifndef __L64_MODE__
#define PRIo32				"lo"
#else
#define PRIo32				"o"
#endif
#ifdef __LL_MODE__
#define PRIo64				"llo"
#else
#define PRIo64				"lo"
#endif

#define PRIoFAST8			"o"
#define PRIo1FAST6			"o"
#define PRIo3FAST2			"o"
#ifdef __LL_MODE__
#define PRIoFAST64			"llo"
#else
#define PRIoFAST64			"lo"
#endif

#define PRIoLEAST8			"o"
#define PRIoLEAST16			"o"
#define PRIoLEAST32			"o"
#ifdef __LL_MODE__
#define PRIoLEAST64			"llo"
#else
#define PRIoLEAST64			"lo"
#endif

#define PRIx8				"x"
#define PRIx16				"x"
#ifndef __L64_MODE__
#define PRIx32				"lx"
#else
#define PRIx32				"x"
#endif
#ifdef __LL_MODE__
#define PRIx64				"llx"
#else
#define PRIx64				"lx"
#endif

#define PRIxFAST8			"x"
#define PRIxFAST16			"x"
#define PRIxFAST32			"x"
#ifdef __LL_MODE__
#define PRIxFAST64			"llx"
#else
#define PRIxFAST64			"lx"
#endif

#define PRIxLEAST8			"x"
#define PRIxLEAST16			"x"
#define PRIxLEAST32			"x"
#ifdef __LL_MODE__
#define PRIxLEAST64			"llx"
#else
#define PRIxLEAST64			"lx"
#endif

#define PRIX8				"X"
#define PRIX16				"X"
#ifndef __L64_MODE__
#define PRIX32				"lX"
#else
#define PRIX32				"X"
#endif
#ifdef __LL_MODE__
#define PRIX64				"llX"
#else
#define PRIX64				"lX"
#endif

#define PRIXFAST8			"X"
#define PRIXFAST16			"X"
#define PRIXFAST32			"X"
#ifdef __LL_MODE__
#define PRIXFAST64			"llX"
#else
#define PRIXFAST64			"lX"
#endif

#define PRIXLEAST8			"X"
#define PRIXLEAST16			"X"
#define PRIXLEAST32			"X"
#ifdef __LL_MODE__
#define PRIXLEAST64			"llX"
#else
#define PRIXLEAST64			"lX"
#endif


/* For unsigned integers */
#define PRIu8				"u"
#define PRIu16				"u"
#ifndef __L64_MODE__
#define PRIu32				"lu"
#else
#define PRIu32				"u"
#endif
#ifdef __LL_MODE__
#define PRIu64				"llu"
#else
#define PRIu64				"lu"
#endif

#define PRIuFAST8			"u"
#define PRIuFAST16			"u"
#define PRIuFAST32			"u"
#ifdef __LL_MODE__
#define PRIuFAST64			"llu"
#else
#define PRIuFAST64			"lu"
#endif

#define PRIuLEAST8			"u"
#define PRIuLEAST16			"u"
#define PRIuLEAST32			"u"
#ifdef __LL_MODE__
#define PRIuLEAST64			"llu"
#else
#define PRIuLEAST64			"lu"
#endif

#ifndef __LP64__
/* scanf macros */
#define SCNd16			"hd"
#define SCNd32			"ld"
#define SCNd64			"lld"

#define SCNi16			"hi"
#define SCNi32			"li"
#define SCNi64			"lli"

#define SCNo16			"ho"
#define SCNo32			"lo"
#define SCNo64			"llo"

#define SCNu16			"hu"
#define SCNu32			"lu"
#define SCNu64			"llu"

#define SCNx16			"hx"
#define SCNx32			"lx"
#define SCNx64			"llx"

#else  /* __LP64__ */

/* scanf macros */
#define SCNd16			"hd"
#define SCNd32			"d"
#define SCNd64			"ld"

#define SCNi16			"hi"
#define SCNi32			"i"
#define SCNi64			"li"

#define SCNo16			"ho"
#define SCNo32			"o"
#define SCNo64			"lo"

#define SCNu16			"hu"
#define SCNu32			"u"
#define SCNu64			"lu"

#define SCNx16			"hx"
#define SCNx32			"x"
#define SCNx64			"lx"

#endif /* __LP64__ */

/* The following macros define I/O formats for intmax_t and uintmax_t.
** Their particular values are implementation defined.
*/
#ifndef __STDC_32_MODE__
#define PRIdMAX	 	 PRId64
#define PRIoMAX	 	 PRIo64
#define PRIxMAX	 	 PRIx64
#define PRIuMAX 	 PRIu64

#define SCNiMAX 	 SCNi64
#define SCNdMAX	 	 SCNd64
#define SCNoMAX	 	 SCNo64
#define SCNxMAX	 	 SCNx64

#else

#define PRIdMAX	 	 PRId32
#define PRIoMAX	 	 PRIo32
#define PRIxMAX	 	 PRIx32
#define PRIuMAX 	 PRIu32

#define SCNiMAX 	 SCNi32
#define SCNdMAX	 	 SCNd32
#define SCNoMAX	 	 SCNo32
#define SCNxMAX	 	 SCNx32

#endif

/* The following macros define I/O formats for intfast_t and uintfast_t.
** Their particular values are implementation defined.
*/

#ifndef __STDC_32_MODE__

#define PRIdFAST 	 PRId64
#define PRIoFAST 	 PRIo64
#define PRIxFAST 	 PRIx64
#define PRIuFAST 	 PRIu64

#define SCNiFAST 	 SCNd64
#define SCNdFAST 	 SCNo64
#define SCNoFAST 	 SCNx64
#define SCNxFAST 	 SCNu64

#else
#define PRIdFAST 	 PRId32
#define PRIoFAST 	 PRIo32
#define PRIxFAST 	 PRIx32
#define PRIuFAST 	 PRIu32

#define SCNiFAST 	 SCNd32
#define SCNdFAST 	 SCNo32
#define SCNoFAST 	 SCNx32
#define SCNxFAST 	 SCNu32

#endif

/*************** conversion functions ******************************** 
** 
** The following routines are proposed to do conversions from strings to the
** largest supported integer types. They parallel the ISO C strto* functions. 
** Implementations are free to equate them to any existing functions 
** they may have.
*/

#ifndef __STDC_32_MODE__

#ifdef __cplusplus
extern "C" { 
#endif

#if defined(__STDC__) || defined(__cplusplus)
extern intmax_t __strtoll (const char *, char**, int);
extern uintmax_t __strtoull (const char *, char**, int);
#ifdef _HPUX_SOURCE
#include <wchar.h>
extern intmax_t __wcstoll(const wchar_t *, wchar_t **, int);
extern uintmax_t __wcstoull(const wchar_t *, wchar_t **, int);
#endif
#else /* defined(__STDC__) || defined(__cplusplus) */
extern intmax_t __strtoll ();
extern uintmax_t __strtoull ();
#ifdef _HPUX_SOURCE
extern intmax_t __wcstoll();
extern uintmax_t __wcstoull();
#endif
#endif /* defined(__STDC__) || defined(__cplusplus) */

#ifdef __cplusplus
}
#endif




#define strtoimax(__a, __b, __c) __strtoll(__a, __b, __c)
#define strtoumax(__a, __b, __c) __strtoull(__a, __b, __c)

#ifdef _HPUX_SOURCE
#define wcstoimax(__a, __b, __c) __wcstoll(__a, __b, __c)
#define wcstoumax(__a, __b, __c) __wcstoull(__a, __b, __c)
#endif
#else
#include <stdlib.h>

#define strtoimax(__a, __b, __c) (intmax_t)strtol(__a, __b, __c)
#define strtoumax(__a, __b, __c) (uintmax_t)strtoul(__a, __b, __c)

#ifdef _HPUX_SOURCE
#include <wchar.h>
#define wcstoimax(__a, __b, __c) (intmax_t)wcstol(__a, __b, __c)
#define wcstoumax(__a, __b, __c) (uintmax_t)wcstoul(__a, __b, __c)
#endif

#endif




#endif /* _INTTYPES_INCLUDED */
/* end of inttypes.h */

