📄 prtypes.h
字号:
#define PR_MIN(x,y) ((x)<(y)?(x):(y))#define PR_MAX(x,y) ((x)>(y)?(x):(y))#define PR_ABS(x) ((x)<0?-(x):(x))PR_BEGIN_EXTERN_C/************************************************************************** TYPES: PRUint8** PRInt8** DESCRIPTION:** The int8 types are known to be 8 bits each. There is no type that** is equivalent to a plain "char". ************************************************************************/#if PR_BYTES_PER_BYTE == 1typedef unsigned char PRUint8;/*** Some cfront-based C++ compilers do not like 'signed char' and** issue the warning message:** warning: "signed" not implemented (ignored)** For these compilers, we have to define PRInt8 as plain 'char'.** Make sure that plain 'char' is indeed signed under these compilers.*/#if (defined(HPUX) && defined(__cplusplus) \ && !defined(__GNUC__) && __cplusplus < 199707L) \ || (defined(SCO) && defined(__cplusplus) \ && !defined(__GNUC__) && __cplusplus == 1L)typedef char PRInt8;#elsetypedef signed char PRInt8;#endif#else#error No suitable type for PRInt8/PRUint8#endif/************************************************************************** TYPES: PRUint16** PRInt16** DESCRIPTION:** The int16 types are known to be 16 bits each. ************************************************************************/#if PR_BYTES_PER_SHORT == 2typedef unsigned short PRUint16;typedef short PRInt16;#else#error No suitable type for PRInt16/PRUint16#endif/************************************************************************** TYPES: PRUint32** PRInt32** DESCRIPTION:** The int32 types are known to be 32 bits each. ************************************************************************/#if PR_BYTES_PER_INT == 4typedef unsigned int PRUint32;typedef int PRInt32;#define PR_INT32(x) x#define PR_UINT32(x) x ## U#elif PR_BYTES_PER_LONG == 4typedef unsigned long PRUint32;typedef long PRInt32;#define PR_INT32(x) x ## L#define PR_UINT32(x) x ## UL#else#error No suitable type for PRInt32/PRUint32#endif/************************************************************************** TYPES: PRUint64** PRInt64** DESCRIPTION:** The int64 types are known to be 64 bits each. Care must be used when** declaring variables of type PRUint64 or PRInt64. Different hardware** architectures and even different compilers have varying support for** 64 bit values. The only guaranteed portability requires the use of** the LL_ macros (see prlong.h).************************************************************************/#ifdef HAVE_LONG_LONG#if PR_BYTES_PER_LONG == 8typedef long PRInt64;typedef unsigned long PRUint64;#elif defined(WIN16)typedef __int64 PRInt64;typedef unsigned __int64 PRUint64;#elif defined(WIN32) && !defined(__GNUC__)typedef __int64 PRInt64;typedef unsigned __int64 PRUint64;#elsetypedef long long PRInt64;typedef unsigned long long PRUint64;#endif /* PR_BYTES_PER_LONG == 8 */#else /* !HAVE_LONG_LONG */typedef struct {#ifdef IS_LITTLE_ENDIAN PRUint32 lo, hi;#else PRUint32 hi, lo;#endif} PRInt64;typedef PRInt64 PRUint64;#endif /* !HAVE_LONG_LONG *//************************************************************************** TYPES: PRUintn** PRIntn** DESCRIPTION:** The PRIntn types are most appropriate for automatic variables. They are** guaranteed to be at least 16 bits, though various architectures may** define them to be wider (e.g., 32 or even 64 bits). These types are** never valid for fields of a structure. ************************************************************************/#if PR_BYTES_PER_INT >= 2typedef int PRIntn;typedef unsigned int PRUintn;#else#error 'sizeof(int)' not sufficient for platform use#endif/************************************************************************** TYPES: PRFloat64** DESCRIPTION:** NSPR's floating point type is always 64 bits. ************************************************************************/typedef double PRFloat64;/************************************************************************** TYPES: PRSize** DESCRIPTION:** A type for representing the size of objects. ************************************************************************/typedef size_t PRSize;/************************************************************************** TYPES: PROffset32, PROffset64** DESCRIPTION:** A type for representing byte offsets from some location. ************************************************************************/typedef PRInt32 PROffset32;typedef PRInt64 PROffset64;/************************************************************************** TYPES: PRPtrDiff** DESCRIPTION:** A type for pointer difference. Variables of this type are suitable** for storing a pointer or pointer sutraction. ************************************************************************/typedef ptrdiff_t PRPtrdiff;/************************************************************************** TYPES: PRUptrdiff** DESCRIPTION:** A type for pointer difference. Variables of this type are suitable** for storing a pointer or pointer sutraction. ************************************************************************/typedef unsigned long PRUptrdiff;/************************************************************************** TYPES: PRBool** DESCRIPTION:** Use PRBool for variables and parameter types. Use PR_FALSE and PR_TRUE** for clarity of target type in assignments and actual arguments. Use** 'if (bool)', 'while (!bool)', '(bool) ? x : y' etc., to test booleans** juast as you would C int-valued conditions. ************************************************************************/typedef PRIntn PRBool;#define PR_TRUE 1#define PR_FALSE 0/************************************************************************** TYPES: PRPackedBool** DESCRIPTION:** Use PRPackedBOol within structs where bitfields are not desireable** but minimum and consistant overhead matters.************************************************************************/typedef PRUint8 PRPackedBool;/*** Status code used by some routines that have a single point of failure or ** special status return.*/typedef enum { PR_FAILURE = -1, PR_SUCCESS = 0 } PRStatus;/*** WARNING: The undocumented data types PRWord and PRUword are** only used in the garbage collection and arena code. Do not** use PRWord and PRUword in new code.**** A PRWord is an integer that is the same size as a void*.** It implements the notion of a "word" in the Java Virtual** Machine. (See Sec. 3.4 "Words", The Java Virtual Machine** Specification, Addison-Wesley, September 1996.** http://java.sun.com/docs/books/vmspec/index.html.)*/typedef long PRWord;typedef unsigned long PRUword;#if defined(NO_NSPR_10_SUPPORT)#else/********* ???????????????? FIX ME ??????????????????????????? *****//********************** Some old definitions until pr=>ds transition is done ***//********************** Also, we are still using NSPR 1.0. GC ******************//*** Fundamental NSPR macros, used nearly everywhere.*/#define PR_PUBLIC_API PR_IMPLEMENT/*** Macro body brackets so that macros with compound statement definitions** behave syntactically more like functions when called.*/#define NSPR_BEGIN_MACRO do {#define NSPR_END_MACRO } while (0)/*** Macro shorthands for conditional C++ extern block delimiters.*/#ifdef NSPR_BEGIN_EXTERN_C#undef NSPR_BEGIN_EXTERN_C#endif#ifdef NSPR_END_EXTERN_C#undef NSPR_END_EXTERN_C#endif#ifdef __cplusplus#define NSPR_BEGIN_EXTERN_C extern "C" {#define NSPR_END_EXTERN_C }#else#define NSPR_BEGIN_EXTERN_C#define NSPR_END_EXTERN_C#endif#ifdef XP_MAC#include "protypes.h"#else#include "obsolete/protypes.h"#endif/********* ????????????? End Fix me ?????????????????????????????? *****/#endif /* NO_NSPR_10_SUPPORT */PR_END_EXTERN_C#endif /* prtypes_h___ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -