| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef CORE_FXCRT_FX_SYSTEM_H_ | 7 #ifndef CORE_FXCRT_FX_SYSTEM_H_ |
| 8 #define CORE_FXCRT_FX_SYSTEM_H_ | 8 #define CORE_FXCRT_FX_SYSTEM_H_ |
| 9 | 9 |
| 10 #include <assert.h> | 10 #include <assert.h> |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 #include <sal.h> | 58 #include <sal.h> |
| 59 #endif | 59 #endif |
| 60 | 60 |
| 61 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | 61 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
| 62 #include <Carbon/Carbon.h> | 62 #include <Carbon/Carbon.h> |
| 63 #include <libkern/OSAtomic.h> | 63 #include <libkern/OSAtomic.h> |
| 64 #endif | 64 #endif |
| 65 | 65 |
| 66 #ifdef __cplusplus | 66 #ifdef __cplusplus |
| 67 extern "C" { | 67 extern "C" { |
| 68 typedef bool FX_BOOL; // Deprecated. | |
| 69 #ifndef TRUE | |
| 70 #define TRUE true | |
| 71 #endif | |
| 72 #ifndef FALSE | |
| 73 #define FALSE false | |
| 74 #endif | |
| 75 #endif // __cplusplus | 68 #endif // __cplusplus |
| 76 | 69 |
| 77 typedef void* FX_POSITION; // Keep until fxcrt containers gone | 70 typedef void* FX_POSITION; // Keep until fxcrt containers gone |
| 78 typedef float FX_FLOAT; // Keep, allow upgrade to doubles. | 71 typedef float FX_FLOAT; // Keep, allow upgrade to doubles. |
| 79 typedef double FX_DOUBLE; // Keep, allow downgrade to floats. | 72 typedef double FX_DOUBLE; // Keep, allow downgrade to floats. |
| 80 typedef char FX_CHAR; // Keep, questionable signedness. | 73 typedef char FX_CHAR; // Keep, questionable signedness. |
| 81 typedef wchar_t FX_WCHAR; // Keep, maybe bad platform wchars. | 74 typedef wchar_t FX_WCHAR; // Keep, maybe bad platform wchars. |
| 82 | 75 |
| 83 #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001) | 76 #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001) |
| 84 #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb))) | 77 #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb))) |
| 85 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) | 78 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) |
| 86 #define IsFloatEqual(fa, fb) IsFloatZero(fa - fb) | 79 #define IsFloatEqual(fa, fb) IsFloatZero(fa - fb) |
| 87 | 80 |
| 88 // PDFium string sizes are limited to 2^31-1, and the value is signed to | 81 // PDFium string sizes are limited to 2^31-1, and the value is signed to |
| 89 // allow -1 as a placeholder for "unknown". | 82 // allow -1 as a placeholder for "unknown". |
| 90 // TODO(palmer): it should be a |size_t|, or at least unsigned. | 83 // TODO(palmer): it should be a |size_t|, or at least unsigned. |
| 91 typedef int FX_STRSIZE; | 84 typedef int FX_STRSIZE; |
| 92 | 85 |
| 93 #ifdef __cplusplus | |
| 94 static_assert(TRUE == true, "true_needs_to_be_true"); | |
| 95 static_assert(FALSE == false, "false_needs_to_be_false"); | |
| 96 #endif | |
| 97 | |
| 98 #ifndef ASSERT | 86 #ifndef ASSERT |
| 99 #ifndef NDEBUG | 87 #ifndef NDEBUG |
| 100 #define ASSERT assert | 88 #define ASSERT assert |
| 101 #else | 89 #else |
| 102 #define ASSERT(a) | 90 #define ASSERT(a) |
| 103 #endif | 91 #endif |
| 104 #endif | 92 #endif |
| 105 | 93 |
| 106 #if defined(__clang__) || defined(__GNUC__) | 94 #if defined(__clang__) || defined(__GNUC__) |
| 107 #define PDFIUM_IMMEDIATE_CRASH() __builtin_trap() | 95 #define PDFIUM_IMMEDIATE_CRASH() __builtin_trap() |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 | 320 |
| 333 // Prevent a function from ever being inlined, typically because we'd | 321 // Prevent a function from ever being inlined, typically because we'd |
| 334 // like it to appear in stack traces. | 322 // like it to appear in stack traces. |
| 335 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 323 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
| 336 #define NEVER_INLINE __declspec(noinline) | 324 #define NEVER_INLINE __declspec(noinline) |
| 337 #else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 325 #else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
| 338 #define NEVER_INLINE __attribute__((__noinline__)) | 326 #define NEVER_INLINE __attribute__((__noinline__)) |
| 339 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 327 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
| 340 | 328 |
| 341 #endif // CORE_FXCRT_FX_SYSTEM_H_ | 329 #endif // CORE_FXCRT_FX_SYSTEM_H_ |
| OLD | NEW |