OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef PLATFORM_GLOBALS_H_ | 5 #ifndef PLATFORM_GLOBALS_H_ |
6 #define PLATFORM_GLOBALS_H_ | 6 #define PLATFORM_GLOBALS_H_ |
7 | 7 |
8 // __STDC_FORMAT_MACROS has to be defined before including <inttypes.h> to | 8 // __STDC_FORMAT_MACROS has to be defined before including <inttypes.h> to |
9 // enable platform independent printf format specifiers. | 9 // enable platform independent printf format specifiers. |
10 #ifndef __STDC_FORMAT_MACROS | 10 #ifndef __STDC_FORMAT_MACROS |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 #include <winsock2.h> | 50 #include <winsock2.h> |
51 #include <Rpc.h> | 51 #include <Rpc.h> |
52 #include <shellapi.h> | 52 #include <shellapi.h> |
53 #endif // defined(_WIN32) | 53 #endif // defined(_WIN32) |
54 | 54 |
55 #if !defined(_WIN32) | 55 #if !defined(_WIN32) |
56 #include <arpa/inet.h> | 56 #include <arpa/inet.h> |
57 #include <inttypes.h> | 57 #include <inttypes.h> |
58 #include <stdint.h> | 58 #include <stdint.h> |
59 #include <unistd.h> | 59 #include <unistd.h> |
60 #endif | 60 #endif // !defined(_WIN32) |
61 | 61 |
62 #include <float.h> | 62 #include <float.h> |
63 #include <limits.h> | 63 #include <limits.h> |
64 #include <stdarg.h> | 64 #include <stdarg.h> |
65 #include <stddef.h> | 65 #include <stddef.h> |
66 #include <stdio.h> | 66 #include <stdio.h> |
67 #include <stdlib.h> | 67 #include <stdlib.h> |
68 #include <string.h> | 68 #include <string.h> |
69 #include <sys/types.h> | 69 #include <sys/types.h> |
70 | 70 |
71 #if defined(_WIN32) | 71 #if defined(_WIN32) |
72 #include "platform/c99_support_win.h" | 72 #include "platform/c99_support_win.h" |
73 #include "platform/inttypes_support_win.h" | 73 #include "platform/inttypes_support_win.h" |
74 #include "platform/floating_point_win.h" | 74 #include "platform/floating_point_win.h" |
75 #endif | 75 #endif // defined(_WIN32) |
76 | 76 |
77 #include "platform/math.h" | 77 #include "platform/math.h" |
78 | 78 |
79 #if !defined(_WIN32) | 79 #if !defined(_WIN32) |
80 #include "platform/floating_point.h" | 80 #include "platform/floating_point.h" |
81 #endif | 81 #endif // !defined(_WIN32) |
82 | 82 |
83 // Target OS detection. | 83 // Target OS detection. |
84 // for more information on predefined macros: | 84 // for more information on predefined macros: |
85 // - http://msdn.microsoft.com/en-us/library/b0084kay.aspx | 85 // - http://msdn.microsoft.com/en-us/library/b0084kay.aspx |
86 // - with gcc, run: "echo | gcc -E -dM -" | 86 // - with gcc, run: "echo | gcc -E -dM -" |
87 #if defined(__ANDROID__) | 87 #if defined(__ANDROID__) |
| 88 |
| 89 // Check for Android first, to determine its difference from Linux. |
88 #define TARGET_OS_ANDROID 1 | 90 #define TARGET_OS_ANDROID 1 |
| 91 |
89 #elif defined(__linux__) || defined(__FreeBSD__) | 92 #elif defined(__linux__) || defined(__FreeBSD__) |
| 93 |
| 94 // Generic Linux. |
90 #define TARGET_OS_LINUX 1 | 95 #define TARGET_OS_LINUX 1 |
| 96 |
91 #elif defined(__APPLE__) | 97 #elif defined(__APPLE__) |
| 98 |
92 // Define the flavor of Mac OS we are running on. | 99 // Define the flavor of Mac OS we are running on. |
93 #include <TargetConditionals.h> | 100 #include <TargetConditionals.h> |
94 // TODO(iposva): Rename TARGET_OS_MACOS to TARGET_OS_MAC to inherit | 101 // TODO(iposva): Rename TARGET_OS_MACOS to TARGET_OS_MAC to inherit |
95 // the value defined in TargetConditionals.h | 102 // the value defined in TargetConditionals.h |
96 #define TARGET_OS_MACOS 1 | 103 #define TARGET_OS_MACOS 1 |
97 #if TARGET_OS_IPHONE | 104 #if TARGET_OS_IPHONE |
98 #define TARGET_OS_IOS 1 | 105 #define TARGET_OS_IOS 1 |
99 #endif | 106 #endif |
100 | 107 |
101 #elif defined(_WIN32) | 108 #elif defined(_WIN32) |
| 109 |
| 110 // Windows, both 32- and 64-bit, regardless of the check for _WIN32. |
102 #define TARGET_OS_WINDOWS 1 | 111 #define TARGET_OS_WINDOWS 1 |
| 112 |
103 #else | 113 #else |
104 #error Automatic target os detection failed. | 114 #error Automatic target os detection failed. |
105 #endif | 115 #endif |
106 | 116 |
| 117 |
| 118 // Setup product, release or debug build related macros. |
| 119 #if defined(PRODUCT) && defined(DEBUG) |
| 120 #error Both PRODUCT and DEBUG defined. |
| 121 #endif // defined(PRODUCT) && defined(DEBUG) |
| 122 |
| 123 #if defined(PRODUCT) |
| 124 #define NOT_IN_PRODUCT(code) |
| 125 #define DEBUG_ONLY(code) |
| 126 #else // defined(PRODUCT) |
| 127 #define NOT_IN_PRODUCT(code) code |
| 128 #if defined(DEBUG) |
| 129 #define DEBUG_ONLY(code) code |
| 130 #else // defined(DEBUG) |
| 131 #define DEBUG_ONLY(code) |
| 132 #endif // defined(DEBUG) |
| 133 #endif // defined(PRODUCT) |
| 134 |
| 135 |
107 namespace dart { | 136 namespace dart { |
108 | 137 |
109 struct simd128_value_t { | 138 struct simd128_value_t { |
110 union { | 139 union { |
111 int32_t int_storage[4]; | 140 int32_t int_storage[4]; |
112 float float_storage[4]; | 141 float float_storage[4]; |
113 double double_storage[2]; | 142 double double_storage[2]; |
114 }; | 143 }; |
115 simd128_value_t& readFrom(const float* v) { | 144 simd128_value_t& readFrom(const float* v) { |
116 float_storage[0] = v[0]; | 145 float_storage[0] = v[0]; |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 | 643 |
615 #if defined(_WIN32) | 644 #if defined(_WIN32) |
616 #define STDIN_FILENO 0 | 645 #define STDIN_FILENO 0 |
617 #define STDOUT_FILENO 1 | 646 #define STDOUT_FILENO 1 |
618 #define STDERR_FILENO 2 | 647 #define STDERR_FILENO 2 |
619 #endif | 648 #endif |
620 | 649 |
621 } // namespace dart | 650 } // namespace dart |
622 | 651 |
623 #endif // PLATFORM_GLOBALS_H_ | 652 #endif // PLATFORM_GLOBALS_H_ |
OLD | NEW |