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