1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/public/LegacyIntTypes.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,59 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- 1.5 + * vim: set ts=8 sts=4 et sw=4 tw=99: 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +/* 1.11 + * This section typedefs the old 'native' types to the new <stdint.h> types. 1.12 + * These redefinitions are provided solely to allow JSAPI users to more easily 1.13 + * transition to <stdint.h> types. They are not to be used in the JSAPI, and 1.14 + * new JSAPI user code should not use them. This mapping file may eventually 1.15 + * be removed from SpiderMonkey, so don't depend on it in the long run. 1.16 + */ 1.17 + 1.18 +/* 1.19 + * BEWARE: Comity with other implementers of these types is not guaranteed. 1.20 + * Indeed, if you use this header and third-party code defining these 1.21 + * types, *expect* to encounter either compile errors or link errors, 1.22 + * depending how these types are used and on the order of inclusion. 1.23 + * It is safest to use only the <stdint.h> types. 1.24 + */ 1.25 +#ifndef js_LegacyIntTypes_h 1.26 +#define js_LegacyIntTypes_h 1.27 + 1.28 +#include <stdint.h> 1.29 + 1.30 +#include "js-config.h" 1.31 + 1.32 +typedef uint8_t uint8; 1.33 +typedef uint16_t uint16; 1.34 +typedef uint32_t uint32; 1.35 +typedef uint64_t uint64; 1.36 + 1.37 +/* 1.38 + * On AIX 4.3, sys/inttypes.h (which is included by sys/types.h, a very 1.39 + * common header file) defines the types int8, int16, int32, and int64. 1.40 + * So we don't define these four types here to avoid conflicts in case 1.41 + * the code also includes sys/types.h. 1.42 + */ 1.43 +#if defined(AIX) && defined(HAVE_SYS_INTTYPES_H) 1.44 +#include <sys/inttypes.h> 1.45 +#else 1.46 +typedef int8_t int8; 1.47 +typedef int16_t int16; 1.48 +typedef int32_t int32; 1.49 +typedef int64_t int64; 1.50 +#endif /* AIX && HAVE_SYS_INTTYPES_H */ 1.51 + 1.52 +typedef uint8_t JSUint8; 1.53 +typedef uint16_t JSUint16; 1.54 +typedef uint32_t JSUint32; 1.55 +typedef uint64_t JSUint64; 1.56 + 1.57 +typedef int8_t JSInt8; 1.58 +typedef int16_t JSInt16; 1.59 +typedef int32_t JSInt32; 1.60 +typedef int64_t JSInt64; 1.61 + 1.62 +#endif /* js_LegacyIntTypes_h */