| 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 |
| 68 #endif | 71 #endif |
| 72 #ifndef FALSE |
| 73 #define FALSE false |
| 74 #endif |
| 75 #endif // __cplusplus |
| 76 |
| 69 typedef void* FX_POSITION; // Keep until fxcrt containers gone | 77 typedef void* FX_POSITION; // Keep until fxcrt containers gone |
| 70 typedef float FX_FLOAT; // Keep, allow upgrade to doubles. | 78 typedef float FX_FLOAT; // Keep, allow upgrade to doubles. |
| 71 typedef double FX_DOUBLE; // Keep, allow downgrade to floats. | 79 typedef double FX_DOUBLE; // Keep, allow downgrade to floats. |
| 72 typedef int FX_BOOL; // Keep, sadly not always 0 or 1. | |
| 73 typedef char FX_CHAR; // Keep, questionable signedness. | 80 typedef char FX_CHAR; // Keep, questionable signedness. |
| 74 typedef wchar_t FX_WCHAR; // Keep, maybe bad platform wchars. | 81 typedef wchar_t FX_WCHAR; // Keep, maybe bad platform wchars. |
| 75 | 82 |
| 76 #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001) | 83 #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001) |
| 77 #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb))) | 84 #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb))) |
| 78 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) | 85 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) |
| 79 #define IsFloatEqual(fa, fb) IsFloatZero(fa - fb) | 86 #define IsFloatEqual(fa, fb) IsFloatZero(fa - fb) |
| 80 | 87 |
| 81 // PDFium string sizes are limited to 2^31-1, and the value is signed to | 88 // PDFium string sizes are limited to 2^31-1, and the value is signed to |
| 82 // allow -1 as a placeholder for "unknown". | 89 // allow -1 as a placeholder for "unknown". |
| 83 // TODO(palmer): it should be a |size_t|, or at least unsigned. | 90 // TODO(palmer): it should be a |size_t|, or at least unsigned. |
| 84 typedef int FX_STRSIZE; | 91 typedef int FX_STRSIZE; |
| 85 | 92 |
| 86 #ifndef TRUE | |
| 87 #define TRUE 1 | |
| 88 #endif | |
| 89 | |
| 90 #ifndef FALSE | |
| 91 #define FALSE 0 | |
| 92 #endif | |
| 93 | |
| 94 #ifdef __cplusplus | 93 #ifdef __cplusplus |
| 95 static_assert(TRUE == true, "true_needs_to_be_true"); | 94 static_assert(TRUE == true, "true_needs_to_be_true"); |
| 96 static_assert(FALSE == false, "false_needs_to_be_false"); | 95 static_assert(FALSE == false, "false_needs_to_be_false"); |
| 97 #endif | 96 #endif |
| 98 | 97 |
| 99 #ifndef ASSERT | 98 #ifndef ASSERT |
| 100 #ifndef NDEBUG | 99 #ifndef NDEBUG |
| 101 #define ASSERT assert | 100 #define ASSERT assert |
| 102 #else | 101 #else |
| 103 #define ASSERT(a) | 102 #define ASSERT(a) |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 332 |
| 334 // Prevent a function from ever being inlined, typically because we'd | 333 // Prevent a function from ever being inlined, typically because we'd |
| 335 // like it to appear in stack traces. | 334 // like it to appear in stack traces. |
| 336 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 335 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
| 337 #define NEVER_INLINE __declspec(noinline) | 336 #define NEVER_INLINE __declspec(noinline) |
| 338 #else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 337 #else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
| 339 #define NEVER_INLINE __attribute__((__noinline__)) | 338 #define NEVER_INLINE __attribute__((__noinline__)) |
| 340 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 339 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
| 341 | 340 |
| 342 #endif // CORE_FXCRT_FX_SYSTEM_H_ | 341 #endif // CORE_FXCRT_FX_SYSTEM_H_ |
| OLD | NEW |