michael@0: /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nptypes_h_ michael@0: #define nptypes_h_ michael@0: michael@0: /* michael@0: * Header file for ensuring that C99 types ([u]int32_t, [u]int64_t and bool) and michael@0: * true/false macros are available. michael@0: */ michael@0: michael@0: #if defined(WIN32) michael@0: /* michael@0: * Win32 and OS/2 don't know C99, so define [u]int_16/32/64 here. The bool michael@0: * is predefined tho, both in C and C++. michael@0: */ michael@0: typedef short int16_t; michael@0: typedef unsigned short uint16_t; michael@0: typedef int int32_t; michael@0: typedef unsigned int uint32_t; michael@0: typedef long long int64_t; michael@0: typedef unsigned long long uint64_t; michael@0: #elif defined(_AIX) || defined(__sun) || defined(__osf__) || defined(IRIX) || defined(HPUX) michael@0: /* michael@0: * AIX and SunOS ship a inttypes.h header that defines [u]int32_t, michael@0: * but not bool for C. michael@0: */ michael@0: #include michael@0: michael@0: #ifndef __cplusplus michael@0: typedef int bool; michael@0: #define true 1 michael@0: #define false 0 michael@0: #endif michael@0: #elif defined(bsdi) || defined(FREEBSD) || defined(OPENBSD) michael@0: /* michael@0: * BSD/OS, FreeBSD, and OpenBSD ship sys/types.h that define int32_t and michael@0: * u_int32_t. michael@0: */ michael@0: #include michael@0: michael@0: /* michael@0: * BSD/OS ships no header that defines uint32_t, nor bool (for C) michael@0: */ michael@0: #if defined(bsdi) michael@0: typedef u_int32_t uint32_t; michael@0: typedef u_int64_t uint64_t; michael@0: michael@0: #if !defined(__cplusplus) michael@0: typedef int bool; michael@0: #define true 1 michael@0: #define false 0 michael@0: #endif michael@0: #else michael@0: /* michael@0: * FreeBSD and OpenBSD define uint32_t and bool. michael@0: */ michael@0: #include michael@0: #include michael@0: #endif michael@0: #elif defined(BEOS) michael@0: #include michael@0: #else michael@0: /* michael@0: * For those that ship a standard C99 stdint.h header file, include michael@0: * it. Can't do the same for stdbool.h tho, since some systems ship michael@0: * with a stdbool.h file that doesn't compile! michael@0: */ michael@0: #include michael@0: michael@0: #ifndef __cplusplus michael@0: #if !defined(__GNUC__) || (__GNUC__ > 2 || __GNUC_MINOR__ > 95) michael@0: #include michael@0: #else michael@0: /* michael@0: * GCC 2.91 can't deal with a typedef for bool, but a #define michael@0: * works. michael@0: */ michael@0: #define bool int michael@0: #define true 1 michael@0: #define false 0 michael@0: #endif michael@0: #endif michael@0: #endif michael@0: michael@0: #endif /* nptypes_h_ */