nsprpub/pr/include/prtypes.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/nsprpub/pr/include/prtypes.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,565 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +/*
    1.10 +** File:                prtypes.h
    1.11 +** Description: Definitions of NSPR's basic types
    1.12 +**
    1.13 +** Prototypes and macros used to make up for deficiencies that we have found
    1.14 +** in ANSI environments.
    1.15 +**
    1.16 +** Since we do not wrap <stdlib.h> and all the other standard headers, authors
    1.17 +** of portable code will not know in general that they need these definitions.
    1.18 +** Instead of requiring these authors to find the dependent uses in their code
    1.19 +** and take the following steps only in those C files, we take steps once here
    1.20 +** for all C files.
    1.21 +**/
    1.22 +
    1.23 +#ifndef prtypes_h___
    1.24 +#define prtypes_h___
    1.25 +
    1.26 +#ifdef MDCPUCFG
    1.27 +#include MDCPUCFG
    1.28 +#else
    1.29 +#include "prcpucfg.h"
    1.30 +#endif
    1.31 +
    1.32 +#include <stddef.h>
    1.33 +
    1.34 +/***********************************************************************
    1.35 +** MACROS:      PR_EXTERN
    1.36 +**              PR_IMPLEMENT
    1.37 +** DESCRIPTION:
    1.38 +**      These are only for externally visible routines and globals.  For
    1.39 +**      internal routines, just use "extern" for type checking and that
    1.40 +**      will not export internal cross-file or forward-declared symbols.
    1.41 +**      Define a macro for declaring procedures return types. We use this to
    1.42 +**      deal with windoze specific type hackery for DLL definitions. Use
    1.43 +**      PR_EXTERN when the prototype for the method is declared. Use
    1.44 +**      PR_IMPLEMENT for the implementation of the method.
    1.45 +**
    1.46 +** Example:
    1.47 +**   in dowhim.h
    1.48 +**     PR_EXTERN( void ) DoWhatIMean( void );
    1.49 +**   in dowhim.c
    1.50 +**     PR_IMPLEMENT( void ) DoWhatIMean( void ) { return; }
    1.51 +**
    1.52 +**
    1.53 +***********************************************************************/
    1.54 +#if defined(WIN32)
    1.55 +
    1.56 +#define PR_EXPORT(__type) extern __declspec(dllexport) __type
    1.57 +#define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
    1.58 +#define PR_IMPORT(__type) __declspec(dllimport) __type
    1.59 +#define PR_IMPORT_DATA(__type) __declspec(dllimport) __type
    1.60 +
    1.61 +#define PR_EXTERN(__type) extern __declspec(dllexport) __type
    1.62 +#define PR_IMPLEMENT(__type) __declspec(dllexport) __type
    1.63 +#define PR_EXTERN_DATA(__type) extern __declspec(dllexport) __type
    1.64 +#define PR_IMPLEMENT_DATA(__type) __declspec(dllexport) __type
    1.65 +
    1.66 +#define PR_CALLBACK
    1.67 +#define PR_CALLBACK_DECL
    1.68 +#define PR_STATIC_CALLBACK(__x) static __x
    1.69 +
    1.70 +#elif defined(XP_BEOS)
    1.71 +
    1.72 +#define PR_EXPORT(__type) extern __declspec(dllexport) __type
    1.73 +#define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
    1.74 +#define PR_IMPORT(__type) extern __declspec(dllexport) __type
    1.75 +#define PR_IMPORT_DATA(__type) extern __declspec(dllexport) __type
    1.76 +
    1.77 +#define PR_EXTERN(__type) extern __declspec(dllexport) __type
    1.78 +#define PR_IMPLEMENT(__type) __declspec(dllexport) __type
    1.79 +#define PR_EXTERN_DATA(__type) extern __declspec(dllexport) __type
    1.80 +#define PR_IMPLEMENT_DATA(__type) __declspec(dllexport) __type
    1.81 +
    1.82 +#define PR_CALLBACK
    1.83 +#define PR_CALLBACK_DECL
    1.84 +#define PR_STATIC_CALLBACK(__x) static __x
    1.85 +
    1.86 +#elif defined(XP_OS2) && defined(__declspec)
    1.87 +
    1.88 +#define PR_EXPORT(__type) extern __declspec(dllexport) __type
    1.89 +#define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
    1.90 +#define PR_IMPORT(__type) extern  __declspec(dllimport) __type
    1.91 +#define PR_IMPORT_DATA(__type) extern __declspec(dllimport) __type
    1.92 +
    1.93 +#define PR_EXTERN(__type) extern __declspec(dllexport) __type
    1.94 +#define PR_IMPLEMENT(__type) __declspec(dllexport) __type
    1.95 +#define PR_EXTERN_DATA(__type) extern __declspec(dllexport) __type
    1.96 +#define PR_IMPLEMENT_DATA(__type) __declspec(dllexport) __type
    1.97 +
    1.98 +#define PR_CALLBACK
    1.99 +#define PR_CALLBACK_DECL
   1.100 +#define PR_STATIC_CALLBACK(__x) static __x
   1.101 +
   1.102 +#elif defined(SYMBIAN)
   1.103 +
   1.104 +#define PR_EXPORT(__type) extern __declspec(dllexport) __type
   1.105 +#define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
   1.106 +#ifdef __WINS__
   1.107 +#define PR_IMPORT(__type) extern __declspec(dllexport) __type
   1.108 +#define PR_IMPORT_DATA(__type) extern __declspec(dllexport) __type
   1.109 +#else
   1.110 +#define PR_IMPORT(__type) extern __declspec(dllimport) __type
   1.111 +#define PR_IMPORT_DATA(__type) extern __declspec(dllimport) __type
   1.112 +#endif
   1.113 +
   1.114 +#define PR_EXTERN(__type) extern __type
   1.115 +#define PR_IMPLEMENT(__type) __type
   1.116 +#define PR_EXTERN_DATA(__type) extern __type
   1.117 +#define PR_IMPLEMENT_DATA(__type) __type
   1.118 +
   1.119 +#define PR_CALLBACK
   1.120 +#define PR_CALLBACK_DECL
   1.121 +#define PR_STATIC_CALLBACK(__x) static __x
   1.122 +
   1.123 +#else /* Unix */
   1.124 +
   1.125 +/* GCC 3.3 and later support the visibility attribute. */
   1.126 +#if (__GNUC__ >= 4) || \
   1.127 +    (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
   1.128 +#define PR_VISIBILITY_DEFAULT __attribute__((visibility("default")))
   1.129 +#else
   1.130 +#define PR_VISIBILITY_DEFAULT
   1.131 +#endif
   1.132 +
   1.133 +#define PR_EXPORT(__type) extern PR_VISIBILITY_DEFAULT __type
   1.134 +#define PR_EXPORT_DATA(__type) extern PR_VISIBILITY_DEFAULT __type
   1.135 +#define PR_IMPORT(__type) extern PR_VISIBILITY_DEFAULT __type
   1.136 +#define PR_IMPORT_DATA(__type) extern PR_VISIBILITY_DEFAULT __type
   1.137 +
   1.138 +#define PR_EXTERN(__type) extern PR_VISIBILITY_DEFAULT __type
   1.139 +#define PR_IMPLEMENT(__type) PR_VISIBILITY_DEFAULT __type
   1.140 +#define PR_EXTERN_DATA(__type) extern PR_VISIBILITY_DEFAULT __type
   1.141 +#define PR_IMPLEMENT_DATA(__type) PR_VISIBILITY_DEFAULT __type
   1.142 +#define PR_CALLBACK
   1.143 +#define PR_CALLBACK_DECL
   1.144 +#define PR_STATIC_CALLBACK(__x) static __x
   1.145 +
   1.146 +#endif
   1.147 +
   1.148 +#if defined(_NSPR_BUILD_)
   1.149 +#define NSPR_API(__type) PR_EXPORT(__type)
   1.150 +#define NSPR_DATA_API(__type) PR_EXPORT_DATA(__type)
   1.151 +#else
   1.152 +#define NSPR_API(__type) PR_IMPORT(__type)
   1.153 +#define NSPR_DATA_API(__type) PR_IMPORT_DATA(__type)
   1.154 +#endif
   1.155 +
   1.156 +/***********************************************************************
   1.157 +** MACROS:      PR_BEGIN_MACRO
   1.158 +**              PR_END_MACRO
   1.159 +** DESCRIPTION:
   1.160 +**      Macro body brackets so that macros with compound statement definitions
   1.161 +**      behave syntactically more like functions when called.
   1.162 +***********************************************************************/
   1.163 +#define PR_BEGIN_MACRO  do {
   1.164 +#define PR_END_MACRO    } while (0)
   1.165 +
   1.166 +/***********************************************************************
   1.167 +** MACROS:      PR_BEGIN_EXTERN_C
   1.168 +**              PR_END_EXTERN_C
   1.169 +** DESCRIPTION:
   1.170 +**      Macro shorthands for conditional C++ extern block delimiters.
   1.171 +***********************************************************************/
   1.172 +#ifdef __cplusplus
   1.173 +#define PR_BEGIN_EXTERN_C       extern "C" {
   1.174 +#define PR_END_EXTERN_C         }
   1.175 +#else
   1.176 +#define PR_BEGIN_EXTERN_C
   1.177 +#define PR_END_EXTERN_C
   1.178 +#endif
   1.179 +
   1.180 +/***********************************************************************
   1.181 +** MACROS:      PR_BIT
   1.182 +**              PR_BITMASK
   1.183 +** DESCRIPTION:
   1.184 +** Bit masking macros.  XXX n must be <= 31 to be portable
   1.185 +***********************************************************************/
   1.186 +#define PR_BIT(n)       ((PRUint32)1 << (n))
   1.187 +#define PR_BITMASK(n)   (PR_BIT(n) - 1)
   1.188 +
   1.189 +/***********************************************************************
   1.190 +** MACROS:      PR_ROUNDUP
   1.191 +**              PR_MIN
   1.192 +**              PR_MAX
   1.193 +**              PR_ABS
   1.194 +** DESCRIPTION:
   1.195 +**      Commonly used macros for operations on compatible types.
   1.196 +***********************************************************************/
   1.197 +#define PR_ROUNDUP(x,y) ((((x)+((y)-1))/(y))*(y))
   1.198 +#define PR_MIN(x,y)     ((x)<(y)?(x):(y))
   1.199 +#define PR_MAX(x,y)     ((x)>(y)?(x):(y))
   1.200 +#define PR_ABS(x)       ((x)<0?-(x):(x))
   1.201 +
   1.202 +/***********************************************************************
   1.203 +** MACROS:      PR_ARRAY_SIZE
   1.204 +** DESCRIPTION:
   1.205 +**  The number of elements in an array.
   1.206 +***********************************************************************/
   1.207 +#define PR_ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
   1.208 +
   1.209 +PR_BEGIN_EXTERN_C
   1.210 +
   1.211 +/*
   1.212 +** Starting in NSPR 4.9.5, NSPR's exact-width integer types should match
   1.213 +** the exact-width integer types defined in <stdint.h>. This allows sloppy
   1.214 +** code to use PRInt{N} and int{N}_t interchangeably.
   1.215 +**
   1.216 +** The 8-bit and 16-bit integer types can only be defined using char and
   1.217 +** short. All platforms define the 32-bit integer types using int. So only
   1.218 +** the 64-bit integer types could be defined differently.
   1.219 +**
   1.220 +** NSPR's original strategy was to use the "shortest" 64-bit integer type:
   1.221 +** if long is 64-bit, then prefer it over long long. This strategy is also
   1.222 +** used by Linux/glibc, FreeBSD, and NetBSD.
   1.223 +**
   1.224 +** Other platforms use a different strategy: simply define the 64-bit
   1.225 +** integer types using long long. We define the PR_ALTERNATE_INT64_TYPEDEF
   1.226 +** macro on these platforms. Note that PR_ALTERNATE_INT64_TYPEDEF is for
   1.227 +** internal use by NSPR headers only. Do not define or test this macro in
   1.228 +** your code.
   1.229 +**
   1.230 +** NOTE: NSPR can't use <stdint.h> because C99 requires C++ code to define
   1.231 +** __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS to make all the macros
   1.232 +** defined in <stdint.h> available. This strange requirement is gone in
   1.233 +** C11. When most platforms ignore this C99 requirement, NSPR will be able
   1.234 +** to use <stdint.h>. A patch to do that is in NSPR bug 634793.
   1.235 +*/
   1.236 +
   1.237 +#if defined(__APPLE__) || defined(__ANDROID__) || defined(__OpenBSD__)
   1.238 +#define PR_ALTERNATE_INT64_TYPEDEF
   1.239 +#endif
   1.240 +
   1.241 +/************************************************************************
   1.242 +** TYPES:       PRUint8
   1.243 +**              PRInt8
   1.244 +** DESCRIPTION:
   1.245 +**  The int8 types are known to be 8 bits each. There is no type that
   1.246 +**      is equivalent to a plain "char".
   1.247 +************************************************************************/
   1.248 +#if PR_BYTES_PER_BYTE == 1
   1.249 +typedef unsigned char PRUint8;
   1.250 +/*
   1.251 +** Some cfront-based C++ compilers do not like 'signed char' and
   1.252 +** issue the warning message:
   1.253 +**     warning: "signed" not implemented (ignored)
   1.254 +** For these compilers, we have to define PRInt8 as plain 'char'.
   1.255 +** Make sure that plain 'char' is indeed signed under these compilers.
   1.256 +*/
   1.257 +#if (defined(HPUX) && defined(__cplusplus) \
   1.258 +        && !defined(__GNUC__) && __cplusplus < 199707L) \
   1.259 +    || (defined(SCO) && defined(__cplusplus) \
   1.260 +        && !defined(__GNUC__) && __cplusplus == 1L)
   1.261 +typedef char PRInt8;
   1.262 +#else
   1.263 +typedef signed char PRInt8;
   1.264 +#endif
   1.265 +#else
   1.266 +#error No suitable type for PRInt8/PRUint8
   1.267 +#endif
   1.268 +
   1.269 +/************************************************************************
   1.270 + * MACROS:      PR_INT8_MAX
   1.271 + *              PR_INT8_MIN
   1.272 + *              PR_UINT8_MAX
   1.273 + * DESCRIPTION:
   1.274 + *  The maximum and minimum values of a PRInt8 or PRUint8.
   1.275 +************************************************************************/
   1.276 +
   1.277 +#define PR_INT8_MAX 127
   1.278 +#define PR_INT8_MIN (-128)
   1.279 +#define PR_UINT8_MAX 255U
   1.280 +
   1.281 +/************************************************************************
   1.282 +** TYPES:       PRUint16
   1.283 +**              PRInt16
   1.284 +** DESCRIPTION:
   1.285 +**  The int16 types are known to be 16 bits each.
   1.286 +************************************************************************/
   1.287 +#if PR_BYTES_PER_SHORT == 2
   1.288 +typedef unsigned short PRUint16;
   1.289 +typedef short PRInt16;
   1.290 +#else
   1.291 +#error No suitable type for PRInt16/PRUint16
   1.292 +#endif
   1.293 +
   1.294 +/************************************************************************
   1.295 + * MACROS:      PR_INT16_MAX
   1.296 + *              PR_INT16_MIN
   1.297 + *              PR_UINT16_MAX
   1.298 + * DESCRIPTION:
   1.299 + *  The maximum and minimum values of a PRInt16 or PRUint16.
   1.300 +************************************************************************/
   1.301 +
   1.302 +#define PR_INT16_MAX 32767
   1.303 +#define PR_INT16_MIN (-32768)
   1.304 +#define PR_UINT16_MAX 65535U
   1.305 +
   1.306 +/************************************************************************
   1.307 +** TYPES:       PRUint32
   1.308 +**              PRInt32
   1.309 +** DESCRIPTION:
   1.310 +**  The int32 types are known to be 32 bits each.
   1.311 +************************************************************************/
   1.312 +#if PR_BYTES_PER_INT == 4
   1.313 +typedef unsigned int PRUint32;
   1.314 +typedef int PRInt32;
   1.315 +#define PR_INT32(x)  x
   1.316 +#define PR_UINT32(x) x ## U
   1.317 +#elif PR_BYTES_PER_LONG == 4
   1.318 +typedef unsigned long PRUint32;
   1.319 +typedef long PRInt32;
   1.320 +#define PR_INT32(x)  x ## L
   1.321 +#define PR_UINT32(x) x ## UL
   1.322 +#else
   1.323 +#error No suitable type for PRInt32/PRUint32
   1.324 +#endif
   1.325 +
   1.326 +/************************************************************************
   1.327 + * MACROS:      PR_INT32_MAX
   1.328 + *              PR_INT32_MIN
   1.329 + *              PR_UINT32_MAX
   1.330 + * DESCRIPTION:
   1.331 + *  The maximum and minimum values of a PRInt32 or PRUint32.
   1.332 +************************************************************************/
   1.333 +
   1.334 +#define PR_INT32_MAX PR_INT32(2147483647)
   1.335 +#define PR_INT32_MIN (-PR_INT32_MAX - 1)
   1.336 +#define PR_UINT32_MAX PR_UINT32(4294967295)
   1.337 +
   1.338 +/************************************************************************
   1.339 +** TYPES:       PRUint64
   1.340 +**              PRInt64
   1.341 +** DESCRIPTION:
   1.342 +**  The int64 types are known to be 64 bits each. Care must be used when
   1.343 +**      declaring variables of type PRUint64 or PRInt64. Different hardware
   1.344 +**      architectures and even different compilers have varying support for
   1.345 +**      64 bit values. The only guaranteed portability requires the use of
   1.346 +**      the LL_ macros (see prlong.h).
   1.347 +**
   1.348 +** MACROS:      PR_INT64
   1.349 +**              PR_UINT64
   1.350 +** DESCRIPTION:
   1.351 +**  The PR_INT64 and PR_UINT64 macros provide a portable way for
   1.352 +**      specifying 64-bit integer constants. They can only be used if
   1.353 +**      PRInt64 and PRUint64 are defined as compiler-supported 64-bit
   1.354 +**      integer types (i.e., if HAVE_LONG_LONG is defined, which is true
   1.355 +**      for all the supported compilers topday). If PRInt64 and PRUint64
   1.356 +**      are defined as structs, the LL_INIT macro defined in prlong.h has
   1.357 +**      to be used.
   1.358 +**
   1.359 +** MACROS:      PR_INT64_MAX
   1.360 +**              PR_INT64_MIN
   1.361 +**              PR_UINT64_MAX
   1.362 +** DESCRIPTION:
   1.363 +**  The maximum and minimum values of a PRInt64 or PRUint64.
   1.364 +************************************************************************/
   1.365 +#ifdef HAVE_LONG_LONG
   1.366 +/* Keep this in sync with prlong.h. */
   1.367 +#if PR_BYTES_PER_LONG == 8 && !defined(PR_ALTERNATE_INT64_TYPEDEF)
   1.368 +typedef long PRInt64;
   1.369 +typedef unsigned long PRUint64;
   1.370 +#define PR_INT64(x)  x ## L
   1.371 +#define PR_UINT64(x) x ## UL
   1.372 +#elif defined(WIN32) && !defined(__GNUC__)
   1.373 +typedef __int64  PRInt64;
   1.374 +typedef unsigned __int64 PRUint64;
   1.375 +#define PR_INT64(x)  x ## i64
   1.376 +#define PR_UINT64(x) x ## ui64
   1.377 +#else
   1.378 +typedef long long PRInt64;
   1.379 +typedef unsigned long long PRUint64;
   1.380 +#define PR_INT64(x)  x ## LL
   1.381 +#define PR_UINT64(x) x ## ULL
   1.382 +#endif /* PR_BYTES_PER_LONG == 8 */
   1.383 +
   1.384 +#define PR_INT64_MAX PR_INT64(0x7fffffffffffffff)
   1.385 +#define PR_INT64_MIN (-PR_INT64_MAX - 1)
   1.386 +#define PR_UINT64_MAX PR_UINT64(-1)
   1.387 +#else  /* !HAVE_LONG_LONG */
   1.388 +typedef struct {
   1.389 +#ifdef IS_LITTLE_ENDIAN
   1.390 +    PRUint32 lo, hi;
   1.391 +#else
   1.392 +    PRUint32 hi, lo;
   1.393 +#endif
   1.394 +} PRInt64;
   1.395 +typedef PRInt64 PRUint64;
   1.396 +
   1.397 +#define PR_INT64_MAX (PRInt64){0x7fffffff, 0xffffffff}
   1.398 +#define PR_INT64_MIN (PRInt64){0xffffffff, 0xffffffff}
   1.399 +#define PR_UINT64_MAX (PRUint64){0xffffffff, 0xffffffff}
   1.400 +
   1.401 +#endif /* !HAVE_LONG_LONG */
   1.402 +
   1.403 +/************************************************************************
   1.404 +** TYPES:       PRUintn
   1.405 +**              PRIntn
   1.406 +** DESCRIPTION:
   1.407 +**  The PRIntn types are most appropriate for automatic variables. They are
   1.408 +**      guaranteed to be at least 16 bits, though various architectures may
   1.409 +**      define them to be wider (e.g., 32 or even 64 bits). These types are
   1.410 +**      never valid for fields of a structure.
   1.411 +************************************************************************/
   1.412 +#if PR_BYTES_PER_INT >= 2
   1.413 +typedef int PRIntn;
   1.414 +typedef unsigned int PRUintn;
   1.415 +#else
   1.416 +#error 'sizeof(int)' not sufficient for platform use
   1.417 +#endif
   1.418 +
   1.419 +/************************************************************************
   1.420 +** TYPES:       PRFloat64
   1.421 +** DESCRIPTION:
   1.422 +**  NSPR's floating point type is always 64 bits.
   1.423 +************************************************************************/
   1.424 +typedef double          PRFloat64;
   1.425 +
   1.426 +/************************************************************************
   1.427 +** TYPES:       PRSize
   1.428 +** DESCRIPTION:
   1.429 +**  A type for representing the size of objects.
   1.430 +************************************************************************/
   1.431 +typedef size_t PRSize;
   1.432 +
   1.433 +
   1.434 +/************************************************************************
   1.435 +** TYPES:       PROffset32, PROffset64
   1.436 +** DESCRIPTION:
   1.437 +**  A type for representing byte offsets from some location.
   1.438 +************************************************************************/
   1.439 +typedef PRInt32 PROffset32;
   1.440 +typedef PRInt64 PROffset64;
   1.441 +
   1.442 +/************************************************************************
   1.443 +** TYPES:       PRPtrDiff
   1.444 +** DESCRIPTION:
   1.445 +**  A type for pointer difference. Variables of this type are suitable
   1.446 +**      for storing a pointer or pointer subtraction.
   1.447 +************************************************************************/
   1.448 +typedef ptrdiff_t PRPtrdiff;
   1.449 +
   1.450 +/************************************************************************
   1.451 +** TYPES:       PRUptrdiff
   1.452 +** DESCRIPTION:
   1.453 +**  A type for pointer difference. Variables of this type are suitable
   1.454 +**      for storing a pointer or pointer sutraction.
   1.455 +************************************************************************/
   1.456 +#ifdef _WIN64
   1.457 +typedef PRUint64 PRUptrdiff;
   1.458 +#else
   1.459 +typedef unsigned long PRUptrdiff;
   1.460 +#endif
   1.461 +
   1.462 +/************************************************************************
   1.463 +** TYPES:       PRBool
   1.464 +** DESCRIPTION:
   1.465 +**  Use PRBool for variables and parameter types. Use PR_FALSE and PR_TRUE
   1.466 +**      for clarity of target type in assignments and actual arguments. Use
   1.467 +**      'if (bool)', 'while (!bool)', '(bool) ? x : y' etc., to test booleans
   1.468 +**      just as you would C int-valued conditions.
   1.469 +************************************************************************/
   1.470 +typedef PRIntn PRBool;
   1.471 +#define PR_TRUE 1
   1.472 +#define PR_FALSE 0
   1.473 +
   1.474 +/************************************************************************
   1.475 +** TYPES:       PRPackedBool
   1.476 +** DESCRIPTION:
   1.477 +**  Use PRPackedBool within structs where bitfields are not desirable
   1.478 +**      but minimum and consistant overhead matters.
   1.479 +************************************************************************/
   1.480 +typedef PRUint8 PRPackedBool;
   1.481 +
   1.482 +/*
   1.483 +** Status code used by some routines that have a single point of failure or
   1.484 +** special status return.
   1.485 +*/
   1.486 +typedef enum { PR_FAILURE = -1, PR_SUCCESS = 0 } PRStatus;
   1.487 +
   1.488 +#ifndef __PRUNICHAR__
   1.489 +#define __PRUNICHAR__
   1.490 +#ifdef WIN32
   1.491 +typedef wchar_t PRUnichar;
   1.492 +#else
   1.493 +typedef PRUint16 PRUnichar;
   1.494 +#endif
   1.495 +#endif
   1.496 +
   1.497 +/*
   1.498 +** WARNING: The undocumented data types PRWord and PRUword are
   1.499 +** only used in the garbage collection and arena code.  Do not
   1.500 +** use PRWord and PRUword in new code.
   1.501 +**
   1.502 +** A PRWord is an integer that is the same size as a void*.
   1.503 +** It implements the notion of a "word" in the Java Virtual
   1.504 +** Machine.  (See Sec. 3.4 "Words", The Java Virtual Machine
   1.505 +** Specification, Addison-Wesley, September 1996.
   1.506 +** http://java.sun.com/docs/books/vmspec/index.html.)
   1.507 +*/
   1.508 +#ifdef _WIN64
   1.509 +typedef PRInt64 PRWord;
   1.510 +typedef PRUint64 PRUword;
   1.511 +#else
   1.512 +typedef long PRWord;
   1.513 +typedef unsigned long PRUword;
   1.514 +#endif
   1.515 +
   1.516 +#if defined(NO_NSPR_10_SUPPORT)
   1.517 +#else
   1.518 +/********* ???????????????? FIX ME       ??????????????????????????? *****/
   1.519 +/********************** Some old definitions until pr=>ds transition is done ***/
   1.520 +/********************** Also, we are still using NSPR 1.0. GC ******************/
   1.521 +/*
   1.522 +** Fundamental NSPR macros, used nearly everywhere.
   1.523 +*/
   1.524 +
   1.525 +#define PR_PUBLIC_API		PR_IMPLEMENT
   1.526 +
   1.527 +/*
   1.528 +** Macro body brackets so that macros with compound statement definitions
   1.529 +** behave syntactically more like functions when called.
   1.530 +*/
   1.531 +#define NSPR_BEGIN_MACRO        do {
   1.532 +#define NSPR_END_MACRO          } while (0)
   1.533 +
   1.534 +/*
   1.535 +** Macro shorthands for conditional C++ extern block delimiters.
   1.536 +*/
   1.537 +#ifdef NSPR_BEGIN_EXTERN_C
   1.538 +#undef NSPR_BEGIN_EXTERN_C
   1.539 +#endif
   1.540 +#ifdef NSPR_END_EXTERN_C
   1.541 +#undef NSPR_END_EXTERN_C
   1.542 +#endif
   1.543 +
   1.544 +#ifdef __cplusplus
   1.545 +#define NSPR_BEGIN_EXTERN_C     extern "C" {
   1.546 +#define NSPR_END_EXTERN_C       }
   1.547 +#else
   1.548 +#define NSPR_BEGIN_EXTERN_C
   1.549 +#define NSPR_END_EXTERN_C
   1.550 +#endif
   1.551 +
   1.552 +#include "obsolete/protypes.h"
   1.553 +
   1.554 +/********* ????????????? End Fix me ?????????????????????????????? *****/
   1.555 +#endif /* NO_NSPR_10_SUPPORT */
   1.556 +
   1.557 +/*
   1.558 +** Compile-time assert. "condition" must be a constant expression.
   1.559 +** The macro can be used only in places where an "extern" declaration is
   1.560 +** allowed.
   1.561 +*/
   1.562 +#define PR_STATIC_ASSERT(condition) \
   1.563 +    extern void pr_static_assert(int arg[(condition) ? 1 : -1])
   1.564 +
   1.565 +PR_END_EXTERN_C
   1.566 +
   1.567 +#endif /* prtypes_h___ */
   1.568 +

mercurial