williamr@2
|
1 |
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
williamr@2
|
2 |
/*
|
williamr@2
|
3 |
* The contents of this file are subject to the Mozilla Public
|
williamr@2
|
4 |
* License Version 1.1 (the "License"); you may not use this file
|
williamr@2
|
5 |
* except in compliance with the License. You may obtain a copy of
|
williamr@2
|
6 |
* the License at http://www.mozilla.org/MPL/
|
williamr@2
|
7 |
*
|
williamr@2
|
8 |
* Software distributed under the License is distributed on an "AS
|
williamr@2
|
9 |
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
williamr@2
|
10 |
* implied. See the License for the specific language governing
|
williamr@2
|
11 |
* rights and limitations under the License.
|
williamr@2
|
12 |
*
|
williamr@2
|
13 |
* The Original Code is the Netscape Portable Runtime (NSPR).
|
williamr@2
|
14 |
*
|
williamr@2
|
15 |
* The Initial Developer of the Original Code is Netscape
|
williamr@2
|
16 |
* Communications Corporation. Portions created by Netscape are
|
williamr@2
|
17 |
* Copyright (C) 1998-2000 Netscape Communications Corporation. All
|
williamr@2
|
18 |
* Rights Reserved.
|
williamr@2
|
19 |
*
|
williamr@2
|
20 |
* Contributor(s):
|
williamr@2
|
21 |
* Portions Copyright (c) 2004-2006, Nokia Corporation
|
williamr@2
|
22 |
*
|
williamr@2
|
23 |
*
|
williamr@2
|
24 |
* Alternatively, the contents of this file may be used under the
|
williamr@2
|
25 |
* terms of the GNU General Public License Version 2 or later (the
|
williamr@2
|
26 |
* "GPL"), in which case the provisions of the GPL are applicable
|
williamr@2
|
27 |
* instead of those above. If you wish to allow use of your
|
williamr@2
|
28 |
* version of this file only under the terms of the GPL and not to
|
williamr@2
|
29 |
* allow others to use your version of this file under the MPL,
|
williamr@2
|
30 |
* indicate your decision by deleting the provisions above and
|
williamr@2
|
31 |
* replace them with the notice and other provisions required by
|
williamr@2
|
32 |
* the GPL. If you do not delete the provisions above, a recipient
|
williamr@2
|
33 |
* may use your version of this file under either the MPL or the
|
williamr@2
|
34 |
* GPL.
|
williamr@2
|
35 |
*/
|
williamr@2
|
36 |
|
williamr@2
|
37 |
/* NOTES:
|
williamr@2
|
38 |
* Nokia modified this file, by changing certain variables for the purpose of
|
williamr@2
|
39 |
* porting the file to the Symbian platform on May 1st, 2004.
|
williamr@2
|
40 |
*/
|
williamr@2
|
41 |
|
williamr@2
|
42 |
|
williamr@2
|
43 |
/*
|
williamr@2
|
44 |
** File: prtypes.h
|
williamr@2
|
45 |
** Description: Definitions of NSPR's basic types
|
williamr@2
|
46 |
**
|
williamr@2
|
47 |
** Prototypes and macros used to make up for deficiencies in ANSI environments
|
williamr@2
|
48 |
** that we have found.
|
williamr@2
|
49 |
**
|
williamr@2
|
50 |
** Since we do not wrap <stdlib.h> and all the other standard headers, authors
|
williamr@2
|
51 |
** of portable code will not know in general that they need these definitions.
|
williamr@2
|
52 |
** Instead of requiring these authors to find the dependent uses in their code
|
williamr@2
|
53 |
** and take the following steps only in those C files, we take steps once here
|
williamr@2
|
54 |
** for all C files.
|
williamr@2
|
55 |
**/
|
williamr@2
|
56 |
|
williamr@2
|
57 |
#ifndef prtypes_h___
|
williamr@2
|
58 |
#define prtypes_h___
|
williamr@2
|
59 |
|
williamr@2
|
60 |
#ifdef MDCPUCFG
|
williamr@2
|
61 |
#include MDCPUCFG
|
williamr@2
|
62 |
#else
|
williamr@2
|
63 |
#include "prcpucfg.h"
|
williamr@2
|
64 |
#endif
|
williamr@2
|
65 |
|
williamr@2
|
66 |
#include <stddef.h>
|
williamr@2
|
67 |
|
williamr@2
|
68 |
/***********************************************************************
|
williamr@2
|
69 |
** MACROS: PR_EXTERN
|
williamr@2
|
70 |
** PR_IMPLEMENT
|
williamr@2
|
71 |
** DESCRIPTION:
|
williamr@2
|
72 |
** These are only for externally visible routines and globals. For
|
williamr@2
|
73 |
** internal routines, just use "extern" for type checking and that
|
williamr@2
|
74 |
** will not export internal cross-file or forward-declared symbols.
|
williamr@2
|
75 |
** Define a macro for declaring procedures return types. We use this to
|
williamr@2
|
76 |
** deal with windoze specific type hackery for DLL definitions. Use
|
williamr@2
|
77 |
** PR_EXTERN when the prototype for the method is declared. Use
|
williamr@2
|
78 |
** PR_IMPLEMENT for the implementation of the method.
|
williamr@2
|
79 |
**
|
williamr@2
|
80 |
** Example:
|
williamr@2
|
81 |
** in dowhim.h
|
williamr@2
|
82 |
** PR_EXTERN( void ) DoWhatIMean( void );
|
williamr@2
|
83 |
** in dowhim.c
|
williamr@2
|
84 |
** PR_IMPLEMENT( void ) DoWhatIMean( void ) { return; }
|
williamr@2
|
85 |
**
|
williamr@2
|
86 |
**
|
williamr@2
|
87 |
***********************************************************************/
|
williamr@2
|
88 |
#if defined(WIN32)
|
williamr@2
|
89 |
|
williamr@2
|
90 |
#if defined(__GNUC__)
|
williamr@2
|
91 |
#undef _declspec
|
williamr@2
|
92 |
#define _declspec(x) __declspec(x)
|
williamr@2
|
93 |
#endif
|
williamr@2
|
94 |
|
williamr@2
|
95 |
#define PR_EXPORT(__type) extern _declspec(dllexport) __type
|
williamr@2
|
96 |
#define PR_EXPORT_DATA(__type) extern _declspec(dllexport) __type
|
williamr@2
|
97 |
#define PR_IMPORT(__type) _declspec(dllimport) __type
|
williamr@2
|
98 |
#define PR_IMPORT_DATA(__type) _declspec(dllimport) __type
|
williamr@2
|
99 |
|
williamr@2
|
100 |
#define PR_EXTERN(__type) extern _declspec(dllexport) __type
|
williamr@2
|
101 |
#define PR_IMPLEMENT(__type) _declspec(dllexport) __type
|
williamr@2
|
102 |
#define PR_EXTERN_DATA(__type) extern _declspec(dllexport) __type
|
williamr@2
|
103 |
#define PR_IMPLEMENT_DATA(__type) _declspec(dllexport) __type
|
williamr@2
|
104 |
|
williamr@2
|
105 |
#define PR_CALLBACK
|
williamr@2
|
106 |
#define PR_CALLBACK_DECL
|
williamr@2
|
107 |
#define PR_STATIC_CALLBACK(__x) static __x
|
williamr@2
|
108 |
|
williamr@2
|
109 |
#elif defined(XP_BEOS)
|
williamr@2
|
110 |
|
williamr@2
|
111 |
#define PR_EXPORT(__type) extern __declspec(dllexport) __type
|
williamr@2
|
112 |
#define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
|
williamr@2
|
113 |
#define PR_IMPORT(__type) extern __declspec(dllexport) __type
|
williamr@2
|
114 |
#define PR_IMPORT_DATA(__type) extern __declspec(dllexport) __type
|
williamr@2
|
115 |
|
williamr@2
|
116 |
#define PR_EXTERN(__type) extern __declspec(dllexport) __type
|
williamr@2
|
117 |
#define PR_IMPLEMENT(__type) __declspec(dllexport) __type
|
williamr@2
|
118 |
#define PR_EXTERN_DATA(__type) extern __declspec(dllexport) __type
|
williamr@2
|
119 |
#define PR_IMPLEMENT_DATA(__type) __declspec(dllexport) __type
|
williamr@2
|
120 |
|
williamr@2
|
121 |
#define PR_CALLBACK
|
williamr@2
|
122 |
#define PR_CALLBACK_DECL
|
williamr@2
|
123 |
#define PR_STATIC_CALLBACK(__x) static __x
|
williamr@2
|
124 |
|
williamr@2
|
125 |
#elif defined(WIN16)
|
williamr@2
|
126 |
|
williamr@2
|
127 |
#define PR_CALLBACK_DECL __cdecl
|
williamr@2
|
128 |
|
williamr@2
|
129 |
#if defined(_WINDLL)
|
williamr@2
|
130 |
#define PR_EXPORT(__type) extern __type _cdecl _export _loadds
|
williamr@2
|
131 |
#define PR_IMPORT(__type) extern __type _cdecl _export _loadds
|
williamr@2
|
132 |
#define PR_EXPORT_DATA(__type) extern __type _export
|
williamr@2
|
133 |
#define PR_IMPORT_DATA(__type) extern __type _export
|
williamr@2
|
134 |
|
williamr@2
|
135 |
#define PR_EXTERN(__type) extern __type _cdecl _export _loadds
|
williamr@2
|
136 |
#define PR_IMPLEMENT(__type) __type _cdecl _export _loadds
|
williamr@2
|
137 |
#define PR_EXTERN_DATA(__type) extern __type _export
|
williamr@2
|
138 |
#define PR_IMPLEMENT_DATA(__type) __type _export
|
williamr@2
|
139 |
|
williamr@2
|
140 |
#define PR_CALLBACK __cdecl __loadds
|
williamr@2
|
141 |
#define PR_STATIC_CALLBACK(__x) static __x PR_CALLBACK
|
williamr@2
|
142 |
|
williamr@2
|
143 |
#else /* this must be .EXE */
|
williamr@2
|
144 |
#define PR_EXPORT(__type) extern __type _cdecl _export
|
williamr@2
|
145 |
#define PR_IMPORT(__type) extern __type _cdecl _export
|
williamr@2
|
146 |
#define PR_EXPORT_DATA(__type) extern __type _export
|
williamr@2
|
147 |
#define PR_IMPORT_DATA(__type) extern __type _export
|
williamr@2
|
148 |
|
williamr@2
|
149 |
#define PR_EXTERN(__type) extern __type _cdecl _export
|
williamr@2
|
150 |
#define PR_IMPLEMENT(__type) __type _cdecl _export
|
williamr@2
|
151 |
#define PR_EXTERN_DATA(__type) extern __type _export
|
williamr@2
|
152 |
#define PR_IMPLEMENT_DATA(__type) __type _export
|
williamr@2
|
153 |
|
williamr@2
|
154 |
#define PR_CALLBACK __cdecl __loadds
|
williamr@2
|
155 |
#define PR_STATIC_CALLBACK(__x) __x PR_CALLBACK
|
williamr@2
|
156 |
#endif /* _WINDLL */
|
williamr@2
|
157 |
|
williamr@2
|
158 |
#elif defined(XP_MAC)
|
williamr@2
|
159 |
|
williamr@2
|
160 |
#define PR_EXPORT(__type) extern __declspec(export) __type
|
williamr@2
|
161 |
#define PR_EXPORT_DATA(__type) extern __declspec(export) __type
|
williamr@2
|
162 |
#define PR_IMPORT(__type) extern __declspec(export) __type
|
williamr@2
|
163 |
#define PR_IMPORT_DATA(__type) extern __declspec(export) __type
|
williamr@2
|
164 |
|
williamr@2
|
165 |
#define PR_EXTERN(__type) extern __declspec(export) __type
|
williamr@2
|
166 |
#define PR_IMPLEMENT(__type) __declspec(export) __type
|
williamr@2
|
167 |
#define PR_EXTERN_DATA(__type) extern __declspec(export) __type
|
williamr@2
|
168 |
#define PR_IMPLEMENT_DATA(__type) __declspec(export) __type
|
williamr@2
|
169 |
|
williamr@2
|
170 |
#define PR_CALLBACK
|
williamr@2
|
171 |
#define PR_CALLBACK_DECL
|
williamr@2
|
172 |
#define PR_STATIC_CALLBACK(__x) static __x
|
williamr@2
|
173 |
|
williamr@2
|
174 |
#elif defined(XP_OS2_VACPP)
|
williamr@2
|
175 |
|
williamr@2
|
176 |
#define PR_EXPORT(__type) extern __type
|
williamr@2
|
177 |
#define PR_EXPORT_DATA(__type) extern __type
|
williamr@2
|
178 |
#define PR_IMPORT(__type) extern __type
|
williamr@2
|
179 |
#define PR_IMPORT_DATA(__type) extern __type
|
williamr@2
|
180 |
|
williamr@2
|
181 |
#define PR_EXTERN(__type) extern __type
|
williamr@2
|
182 |
#define PR_IMPLEMENT(__type) __type
|
williamr@2
|
183 |
#define PR_EXTERN_DATA(__type) extern __type
|
williamr@2
|
184 |
#define PR_IMPLEMENT_DATA(__type) __type
|
williamr@2
|
185 |
#define PR_CALLBACK _Optlink
|
williamr@2
|
186 |
#define PR_CALLBACK_DECL
|
williamr@2
|
187 |
#define PR_STATIC_CALLBACK(__x) static __x PR_CALLBACK
|
williamr@2
|
188 |
|
williamr@2
|
189 |
#else /* Unix */
|
williamr@2
|
190 |
|
williamr@2
|
191 |
#define PR_EXPORT(__type) extern __type
|
williamr@2
|
192 |
#define PR_EXPORT_DATA(__type) extern __type
|
williamr@2
|
193 |
#define PR_IMPORT(__type) extern __type
|
williamr@2
|
194 |
#define PR_IMPORT_DATA(__type) extern __type
|
williamr@2
|
195 |
|
williamr@2
|
196 |
#define PR_EXTERN(__type) extern __type
|
williamr@2
|
197 |
#define PR_IMPLEMENT(__type) __type
|
williamr@2
|
198 |
#define PR_EXTERN_DATA(__type) extern __type
|
williamr@2
|
199 |
#define PR_IMPLEMENT_DATA(__type) __type
|
williamr@2
|
200 |
#define PR_CALLBACK
|
williamr@2
|
201 |
#define PR_CALLBACK_DECL
|
williamr@2
|
202 |
#define PR_STATIC_CALLBACK(__x) static __x
|
williamr@2
|
203 |
|
williamr@2
|
204 |
#endif
|
williamr@2
|
205 |
|
williamr@2
|
206 |
#if defined(_NSPR_BUILD_)
|
williamr@2
|
207 |
#define NSPR_API(__type) PR_EXPORT(__type)
|
williamr@2
|
208 |
#define NSPR_DATA_API(__type) PR_EXPORT_DATA(__type)
|
williamr@2
|
209 |
#else
|
williamr@2
|
210 |
#define NSPR_API(__type) PR_IMPORT(__type)
|
williamr@2
|
211 |
#define NSPR_DATA_API(__type) PR_IMPORT_DATA(__type)
|
williamr@2
|
212 |
#endif
|
williamr@2
|
213 |
|
williamr@2
|
214 |
/***********************************************************************
|
williamr@2
|
215 |
** MACROS: PR_BEGIN_MACRO
|
williamr@2
|
216 |
** PR_END_MACRO
|
williamr@2
|
217 |
** DESCRIPTION:
|
williamr@2
|
218 |
** Macro body brackets so that macros with compound statement definitions
|
williamr@2
|
219 |
** behave syntactically more like functions when called.
|
williamr@2
|
220 |
***********************************************************************/
|
williamr@2
|
221 |
#define PR_BEGIN_MACRO do {
|
williamr@2
|
222 |
#define PR_END_MACRO } while (0)
|
williamr@2
|
223 |
|
williamr@2
|
224 |
/***********************************************************************
|
williamr@2
|
225 |
** MACROS: PR_BEGIN_EXTERN_C
|
williamr@2
|
226 |
** PR_END_EXTERN_C
|
williamr@2
|
227 |
** DESCRIPTION:
|
williamr@2
|
228 |
** Macro shorthands for conditional C++ extern block delimiters.
|
williamr@2
|
229 |
***********************************************************************/
|
williamr@2
|
230 |
#ifdef __cplusplus
|
williamr@2
|
231 |
#define PR_BEGIN_EXTERN_C extern "C" {
|
williamr@2
|
232 |
#define PR_END_EXTERN_C }
|
williamr@2
|
233 |
#else
|
williamr@2
|
234 |
#define PR_BEGIN_EXTERN_C
|
williamr@2
|
235 |
#define PR_END_EXTERN_C
|
williamr@2
|
236 |
#endif
|
williamr@2
|
237 |
|
williamr@2
|
238 |
/***********************************************************************
|
williamr@2
|
239 |
** MACROS: PR_BIT
|
williamr@2
|
240 |
** PR_BITMASK
|
williamr@2
|
241 |
** DESCRIPTION:
|
williamr@2
|
242 |
** Bit masking macros. XXX n must be <= 31 to be portable
|
williamr@2
|
243 |
***********************************************************************/
|
williamr@2
|
244 |
#define PR_BIT(n) ((PRUint32)1 << (n))
|
williamr@2
|
245 |
#define PR_BITMASK(n) (PR_BIT(n) - 1)
|
williamr@2
|
246 |
|
williamr@2
|
247 |
/***********************************************************************
|
williamr@2
|
248 |
** MACROS: PR_ROUNDUP
|
williamr@2
|
249 |
** PR_MIN
|
williamr@2
|
250 |
** PR_MAX
|
williamr@2
|
251 |
** PR_ABS
|
williamr@2
|
252 |
** DESCRIPTION:
|
williamr@2
|
253 |
** Commonly used macros for operations on compatible types.
|
williamr@2
|
254 |
***********************************************************************/
|
williamr@2
|
255 |
#define PR_ROUNDUP(x,y) ((((x)+((y)-1))/(y))*(y))
|
williamr@2
|
256 |
#define PR_MIN(x,y) ((x)<(y)?(x):(y))
|
williamr@2
|
257 |
#define PR_MAX(x,y) ((x)>(y)?(x):(y))
|
williamr@2
|
258 |
#define PR_ABS(x) ((x)<0?-(x):(x))
|
williamr@2
|
259 |
|
williamr@2
|
260 |
PR_BEGIN_EXTERN_C
|
williamr@2
|
261 |
|
williamr@2
|
262 |
/************************************************************************
|
williamr@2
|
263 |
** TYPES: PRUint8
|
williamr@2
|
264 |
** PRInt8
|
williamr@2
|
265 |
** DESCRIPTION:
|
williamr@2
|
266 |
** The int8 types are known to be 8 bits each. There is no type that
|
williamr@2
|
267 |
** is equivalent to a plain "char".
|
williamr@2
|
268 |
************************************************************************/
|
williamr@2
|
269 |
#if PR_BYTES_PER_BYTE == 1
|
williamr@2
|
270 |
typedef unsigned char PRUint8;
|
williamr@2
|
271 |
/*
|
williamr@2
|
272 |
** Some cfront-based C++ compilers do not like 'signed char' and
|
williamr@2
|
273 |
** issue the warning message:
|
williamr@2
|
274 |
** warning: "signed" not implemented (ignored)
|
williamr@2
|
275 |
** For these compilers, we have to define PRInt8 as plain 'char'.
|
williamr@2
|
276 |
** Make sure that plain 'char' is indeed signed under these compilers.
|
williamr@2
|
277 |
*/
|
williamr@2
|
278 |
#if (defined(HPUX) && defined(__cplusplus) \
|
williamr@2
|
279 |
&& !defined(__GNUC__) && __cplusplus < 199707L) \
|
williamr@2
|
280 |
|| (defined(SCO) && defined(__cplusplus) \
|
williamr@2
|
281 |
&& !defined(__GNUC__) && __cplusplus == 1L)
|
williamr@2
|
282 |
typedef char PRInt8;
|
williamr@2
|
283 |
#else
|
williamr@2
|
284 |
typedef signed char PRInt8;
|
williamr@2
|
285 |
#endif
|
williamr@2
|
286 |
#else
|
williamr@2
|
287 |
#error No suitable type for PRInt8/PRUint8
|
williamr@2
|
288 |
#endif
|
williamr@2
|
289 |
|
williamr@2
|
290 |
/************************************************************************
|
williamr@2
|
291 |
* MACROS: PR_INT8_MAX
|
williamr@2
|
292 |
* PR_INT8_MIN
|
williamr@2
|
293 |
* PR_UINT8_MAX
|
williamr@2
|
294 |
* DESCRIPTION:
|
williamr@2
|
295 |
* The maximum and minimum values of a PRInt8 or PRUint8.
|
williamr@2
|
296 |
************************************************************************/
|
williamr@2
|
297 |
|
williamr@2
|
298 |
#define PR_INT8_MAX 127
|
williamr@2
|
299 |
#define PR_INT8_MIN (-128)
|
williamr@2
|
300 |
#define PR_UINT8_MAX 255U
|
williamr@2
|
301 |
|
williamr@2
|
302 |
/************************************************************************
|
williamr@2
|
303 |
** TYPES: PRUint16
|
williamr@2
|
304 |
** PRInt16
|
williamr@2
|
305 |
** DESCRIPTION:
|
williamr@2
|
306 |
** The int16 types are known to be 16 bits each.
|
williamr@2
|
307 |
************************************************************************/
|
williamr@2
|
308 |
#if PR_BYTES_PER_SHORT == 2
|
williamr@2
|
309 |
typedef unsigned short PRUint16;
|
williamr@2
|
310 |
typedef short PRInt16;
|
williamr@2
|
311 |
#else
|
williamr@2
|
312 |
#error No suitable type for PRInt16/PRUint16
|
williamr@2
|
313 |
#endif
|
williamr@2
|
314 |
|
williamr@2
|
315 |
/************************************************************************
|
williamr@2
|
316 |
* MACROS: PR_INT16_MAX
|
williamr@2
|
317 |
* PR_INT16_MIN
|
williamr@2
|
318 |
* PR_UINT16_MAX
|
williamr@2
|
319 |
* DESCRIPTION:
|
williamr@2
|
320 |
* The maximum and minimum values of a PRInt16 or PRUint16.
|
williamr@2
|
321 |
************************************************************************/
|
williamr@2
|
322 |
|
williamr@2
|
323 |
#define PR_INT16_MAX 32767
|
williamr@2
|
324 |
#define PR_INT16_MIN (-32768)
|
williamr@2
|
325 |
#define PR_UINT16_MAX 65535U
|
williamr@2
|
326 |
|
williamr@2
|
327 |
/************************************************************************
|
williamr@2
|
328 |
** TYPES: PRUint32
|
williamr@2
|
329 |
** PRInt32
|
williamr@2
|
330 |
** DESCRIPTION:
|
williamr@2
|
331 |
** The int32 types are known to be 32 bits each.
|
williamr@2
|
332 |
************************************************************************/
|
williamr@2
|
333 |
#if PR_BYTES_PER_INT == 4
|
williamr@2
|
334 |
typedef unsigned int PRUint32;
|
williamr@2
|
335 |
typedef int PRInt32;
|
williamr@2
|
336 |
#define PR_INT32(x) x
|
williamr@2
|
337 |
#define PR_UINT32(x) x ## U
|
williamr@2
|
338 |
#elif PR_BYTES_PER_LONG == 4
|
williamr@2
|
339 |
typedef unsigned long PRUint32;
|
williamr@2
|
340 |
typedef long PRInt32;
|
williamr@2
|
341 |
#define PR_INT32(x) x ## L
|
williamr@2
|
342 |
#define PR_UINT32(x) x ## UL
|
williamr@2
|
343 |
#else
|
williamr@2
|
344 |
#error No suitable type for PRInt32/PRUint32
|
williamr@2
|
345 |
#endif
|
williamr@2
|
346 |
|
williamr@2
|
347 |
/************************************************************************
|
williamr@2
|
348 |
* MACROS: PR_INT32_MAX
|
williamr@2
|
349 |
* PR_INT32_MIN
|
williamr@2
|
350 |
* PR_UINT32_MAX
|
williamr@2
|
351 |
* DESCRIPTION:
|
williamr@2
|
352 |
* The maximum and minimum values of a PRInt32 or PRUint32.
|
williamr@2
|
353 |
************************************************************************/
|
williamr@2
|
354 |
|
williamr@2
|
355 |
#define PR_INT32_MAX PR_INT32(2147483647)
|
williamr@2
|
356 |
#define PR_INT32_MIN (-PR_INT32_MAX - 1)
|
williamr@2
|
357 |
#define PR_UINT32_MAX PR_UINT32(4294967295)
|
williamr@2
|
358 |
|
williamr@2
|
359 |
/************************************************************************
|
williamr@2
|
360 |
** TYPES: PRUint64
|
williamr@2
|
361 |
** PRInt64
|
williamr@2
|
362 |
** DESCRIPTION:
|
williamr@2
|
363 |
** The int64 types are known to be 64 bits each. Care must be used when
|
williamr@2
|
364 |
** declaring variables of type PRUint64 or PRInt64. Different hardware
|
williamr@2
|
365 |
** architectures and even different compilers have varying support for
|
williamr@2
|
366 |
** 64 bit values. The only guaranteed portability requires the use of
|
williamr@2
|
367 |
** the LL_ macros (see prlong.h).
|
williamr@2
|
368 |
************************************************************************/
|
williamr@2
|
369 |
#ifdef HAVE_LONG_LONG
|
williamr@2
|
370 |
#if PR_BYTES_PER_LONG == 8
|
williamr@2
|
371 |
typedef long PRInt64;
|
williamr@2
|
372 |
typedef unsigned long PRUint64;
|
williamr@2
|
373 |
#elif defined(WIN16)
|
williamr@2
|
374 |
typedef __int64 PRInt64;
|
williamr@2
|
375 |
typedef unsigned __int64 PRUint64;
|
williamr@2
|
376 |
#elif defined(WIN32) && !defined(__GNUC__)
|
williamr@2
|
377 |
typedef __int64 PRInt64;
|
williamr@2
|
378 |
typedef unsigned __int64 PRUint64;
|
williamr@2
|
379 |
#else
|
williamr@2
|
380 |
typedef long long PRInt64;
|
williamr@2
|
381 |
typedef unsigned long long PRUint64;
|
williamr@2
|
382 |
#endif /* PR_BYTES_PER_LONG == 8 */
|
williamr@2
|
383 |
#else /* !HAVE_LONG_LONG */
|
williamr@2
|
384 |
typedef struct {
|
williamr@2
|
385 |
#ifdef IS_LITTLE_ENDIAN
|
williamr@2
|
386 |
PRUint32 lo, hi;
|
williamr@2
|
387 |
#else
|
williamr@2
|
388 |
PRUint32 hi, lo;
|
williamr@2
|
389 |
#endif
|
williamr@2
|
390 |
} PRInt64;
|
williamr@2
|
391 |
typedef PRInt64 PRUint64;
|
williamr@2
|
392 |
#endif /* !HAVE_LONG_LONG */
|
williamr@2
|
393 |
|
williamr@2
|
394 |
/************************************************************************
|
williamr@2
|
395 |
** TYPES: PRUintn
|
williamr@2
|
396 |
** PRIntn
|
williamr@2
|
397 |
** DESCRIPTION:
|
williamr@2
|
398 |
** The PRIntn types are most appropriate for automatic variables. They are
|
williamr@2
|
399 |
** guaranteed to be at least 16 bits, though various architectures may
|
williamr@2
|
400 |
** define them to be wider (e.g., 32 or even 64 bits). These types are
|
williamr@2
|
401 |
** never valid for fields of a structure.
|
williamr@2
|
402 |
************************************************************************/
|
williamr@2
|
403 |
#if PR_BYTES_PER_INT >= 2
|
williamr@2
|
404 |
typedef int PRIntn;
|
williamr@2
|
405 |
typedef unsigned int PRUintn;
|
williamr@2
|
406 |
#else
|
williamr@2
|
407 |
#error 'sizeof(int)' not sufficient for platform use
|
williamr@2
|
408 |
#endif
|
williamr@2
|
409 |
|
williamr@2
|
410 |
/************************************************************************
|
williamr@2
|
411 |
** TYPES: PRFloat64
|
williamr@2
|
412 |
** DESCRIPTION:
|
williamr@2
|
413 |
** NSPR's floating point type is always 64 bits.
|
williamr@2
|
414 |
************************************************************************/
|
williamr@2
|
415 |
typedef double PRFloat64;
|
williamr@2
|
416 |
|
williamr@2
|
417 |
/************************************************************************
|
williamr@2
|
418 |
** TYPES: PRSize
|
williamr@2
|
419 |
** DESCRIPTION:
|
williamr@2
|
420 |
** A type for representing the size of objects.
|
williamr@2
|
421 |
************************************************************************/
|
williamr@2
|
422 |
typedef size_t PRSize;
|
williamr@2
|
423 |
|
williamr@2
|
424 |
|
williamr@2
|
425 |
/************************************************************************
|
williamr@2
|
426 |
** TYPES: PROffset32, PROffset64
|
williamr@2
|
427 |
** DESCRIPTION:
|
williamr@2
|
428 |
** A type for representing byte offsets from some location.
|
williamr@2
|
429 |
************************************************************************/
|
williamr@2
|
430 |
typedef PRInt32 PROffset32;
|
williamr@2
|
431 |
typedef PRInt64 PROffset64;
|
williamr@2
|
432 |
|
williamr@2
|
433 |
/************************************************************************
|
williamr@2
|
434 |
** TYPES: PRPtrDiff
|
williamr@2
|
435 |
** DESCRIPTION:
|
williamr@2
|
436 |
** A type for pointer difference. Variables of this type are suitable
|
williamr@2
|
437 |
** for storing a pointer or pointer sutraction.
|
williamr@2
|
438 |
************************************************************************/
|
williamr@2
|
439 |
typedef ptrdiff_t PRPtrdiff;
|
williamr@2
|
440 |
|
williamr@2
|
441 |
/************************************************************************
|
williamr@2
|
442 |
** TYPES: PRUptrdiff
|
williamr@2
|
443 |
** DESCRIPTION:
|
williamr@2
|
444 |
** A type for pointer difference. Variables of this type are suitable
|
williamr@2
|
445 |
** for storing a pointer or pointer sutraction.
|
williamr@2
|
446 |
************************************************************************/
|
williamr@2
|
447 |
typedef unsigned long PRUptrdiff;
|
williamr@2
|
448 |
|
williamr@2
|
449 |
/************************************************************************
|
williamr@2
|
450 |
** TYPES: PRBool
|
williamr@2
|
451 |
** DESCRIPTION:
|
williamr@2
|
452 |
** Use PRBool for variables and parameter types. Use PR_FALSE and PR_TRUE
|
williamr@2
|
453 |
** for clarity of target type in assignments and actual arguments. Use
|
williamr@2
|
454 |
** 'if (bool)', 'while (!bool)', '(bool) ? x : y' etc., to test booleans
|
williamr@2
|
455 |
** juast as you would C int-valued conditions.
|
williamr@2
|
456 |
************************************************************************/
|
williamr@2
|
457 |
typedef PRIntn PRBool;
|
williamr@2
|
458 |
#define PR_TRUE 1
|
williamr@2
|
459 |
#define PR_FALSE 0
|
williamr@2
|
460 |
|
williamr@2
|
461 |
/************************************************************************
|
williamr@2
|
462 |
** TYPES: PRPackedBool
|
williamr@2
|
463 |
** DESCRIPTION:
|
williamr@2
|
464 |
** Use PRPackedBOol within structs where bitfields are not desireable
|
williamr@2
|
465 |
** but minimum and consistant overhead matters.
|
williamr@2
|
466 |
************************************************************************/
|
williamr@2
|
467 |
typedef PRUint8 PRPackedBool;
|
williamr@2
|
468 |
|
williamr@2
|
469 |
/*
|
williamr@2
|
470 |
** Status code used by some routines that have a single point of failure or
|
williamr@2
|
471 |
** special status return.
|
williamr@2
|
472 |
*/
|
williamr@2
|
473 |
typedef enum { PR_FAILURE = -1, PR_SUCCESS = 0 } PRStatus;
|
williamr@2
|
474 |
|
williamr@2
|
475 |
#ifdef MOZ_UNICODE
|
williamr@2
|
476 |
/*
|
williamr@2
|
477 |
* EXPERIMENTAL: This type may be removed in a future release.
|
williamr@2
|
478 |
*/
|
williamr@2
|
479 |
#ifndef __PRUNICHAR__
|
williamr@2
|
480 |
#define __PRUNICHAR__
|
williamr@2
|
481 |
#if defined(WIN32) || defined(XP_MAC)
|
williamr@2
|
482 |
typedef wchar_t PRUnichar;
|
williamr@2
|
483 |
#else
|
williamr@2
|
484 |
typedef PRUint16 PRUnichar;
|
williamr@2
|
485 |
#endif
|
williamr@2
|
486 |
#endif
|
williamr@2
|
487 |
#endif /* MOZ_UNICODE */
|
williamr@2
|
488 |
|
williamr@2
|
489 |
/*
|
williamr@2
|
490 |
** WARNING: The undocumented data types PRWord and PRUword are
|
williamr@2
|
491 |
** only used in the garbage collection and arena code. Do not
|
williamr@2
|
492 |
** use PRWord and PRUword in new code.
|
williamr@2
|
493 |
**
|
williamr@2
|
494 |
** A PRWord is an integer that is the same size as a void*.
|
williamr@2
|
495 |
** It implements the notion of a "word" in the Java Virtual
|
williamr@2
|
496 |
** Machine. (See Sec. 3.4 "Words", The Java Virtual Machine
|
williamr@2
|
497 |
** Specification, Addison-Wesley, September 1996.
|
williamr@2
|
498 |
** http://java.sun.com/docs/books/vmspec/index.html.)
|
williamr@2
|
499 |
*/
|
williamr@2
|
500 |
typedef long PRWord;
|
williamr@2
|
501 |
typedef unsigned long PRUword;
|
williamr@2
|
502 |
|
williamr@2
|
503 |
#if defined(NO_NSPR_10_SUPPORT)
|
williamr@2
|
504 |
#else
|
williamr@2
|
505 |
/********* ???????????????? FIX ME ??????????????????????????? *****/
|
williamr@2
|
506 |
/********************** Some old definitions until pr=>ds transition is done ***/
|
williamr@2
|
507 |
/********************** Also, we are still using NSPR 1.0. GC ******************/
|
williamr@2
|
508 |
/*
|
williamr@2
|
509 |
** Fundamental NSPR macros, used nearly everywhere.
|
williamr@2
|
510 |
*/
|
williamr@2
|
511 |
|
williamr@2
|
512 |
#define PR_PUBLIC_API PR_IMPLEMENT
|
williamr@2
|
513 |
|
williamr@2
|
514 |
/*
|
williamr@2
|
515 |
** Macro body brackets so that macros with compound statement definitions
|
williamr@2
|
516 |
** behave syntactically more like functions when called.
|
williamr@2
|
517 |
*/
|
williamr@2
|
518 |
#define NSPR_BEGIN_MACRO do {
|
williamr@2
|
519 |
#define NSPR_END_MACRO } while (0)
|
williamr@2
|
520 |
|
williamr@2
|
521 |
/*
|
williamr@2
|
522 |
** Macro shorthands for conditional C++ extern block delimiters.
|
williamr@2
|
523 |
*/
|
williamr@2
|
524 |
#ifdef NSPR_BEGIN_EXTERN_C
|
williamr@2
|
525 |
#undef NSPR_BEGIN_EXTERN_C
|
williamr@2
|
526 |
#endif
|
williamr@2
|
527 |
#ifdef NSPR_END_EXTERN_C
|
williamr@2
|
528 |
#undef NSPR_END_EXTERN_C
|
williamr@2
|
529 |
#endif
|
williamr@2
|
530 |
|
williamr@2
|
531 |
#ifdef __cplusplus
|
williamr@2
|
532 |
#define NSPR_BEGIN_EXTERN_C extern "C" {
|
williamr@2
|
533 |
#define NSPR_END_EXTERN_C }
|
williamr@2
|
534 |
#else
|
williamr@2
|
535 |
#define NSPR_BEGIN_EXTERN_C
|
williamr@2
|
536 |
#define NSPR_END_EXTERN_C
|
williamr@2
|
537 |
#endif
|
williamr@2
|
538 |
|
williamr@2
|
539 |
#ifdef XP_MAC
|
williamr@2
|
540 |
#include "protypes.h"
|
williamr@2
|
541 |
#else
|
williamr@2
|
542 |
#include "obsolete/protypes.h"
|
williamr@2
|
543 |
#endif
|
williamr@2
|
544 |
|
williamr@2
|
545 |
/********* ????????????? End Fix me ?????????????????????????????? *****/
|
williamr@2
|
546 |
#endif /* NO_NSPR_10_SUPPORT */
|
williamr@2
|
547 |
|
williamr@2
|
548 |
PR_END_EXTERN_C
|
williamr@2
|
549 |
|
williamr@2
|
550 |
#endif /* prtypes_h___ */
|
williamr@2
|
551 |
|