| OLD | NEW |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 #ifndef SRC_SHARED_PLATFORM_H_ | 5 #ifndef SRC_SHARED_PLATFORM_H_ |
| 6 #define SRC_SHARED_PLATFORM_H_ | 6 #define SRC_SHARED_PLATFORM_H_ |
| 7 | 7 |
| 8 #include "src/shared/assert.h" | 8 #include "src/shared/assert.h" |
| 9 #include "src/shared/globals.h" | 9 #include "src/shared/globals.h" |
| 10 #include "src/shared/list.h" | 10 #include "src/shared/list.h" |
| 11 | 11 |
| 12 #if defined(FLETCH_TARGET_OS_POSIX) | 12 #if defined(DARTINO_TARGET_OS_POSIX) |
| 13 #include "src/shared/platform_posix.h" | 13 #include "src/shared/platform_posix.h" |
| 14 #elif defined(FLETCH_TARGET_OS_WIN) | 14 #elif defined(DARTINO_TARGET_OS_WIN) |
| 15 #include "src/shared/platform_windows.h" | 15 #include "src/shared/platform_windows.h" |
| 16 #elif defined(FLETCH_TARGET_OS_LK) | 16 #elif defined(DARTINO_TARGET_OS_LK) |
| 17 #include "src/shared/platform_lk.h" | 17 #include "src/shared/platform_lk.h" |
| 18 #elif defined(FLETCH_TARGET_OS_CMSIS) | 18 #elif defined(DARTINO_TARGET_OS_CMSIS) |
| 19 #include "src/shared/platform_cmsis.h" | 19 #include "src/shared/platform_cmsis.h" |
| 20 #else | 20 #else |
| 21 #error "Platform not implemented for target os." | 21 #error "Platform not implemented for target os." |
| 22 #endif | 22 #endif |
| 23 | 23 |
| 24 namespace fletch { | 24 namespace dartino { |
| 25 | 25 |
| 26 // Computes the path of of this executable. This is similar to argv[0], but | 26 // Computes the path of of this executable. This is similar to argv[0], but |
| 27 // since argv[0] is provided by the calling process, argv[0] may be an | 27 // since argv[0] is provided by the calling process, argv[0] may be an |
| 28 // arbitrary value where as this method uses an OS-dependent method of finding | 28 // arbitrary value where as this method uses an OS-dependent method of finding |
| 29 // the real path. | 29 // the real path. |
| 30 void GetPathOfExecutable(char* path, size_t path_length); | 30 void GetPathOfExecutable(char* path, size_t path_length); |
| 31 | 31 |
| 32 class Thread; | 32 class Thread; |
| 33 class Mutex; | 33 class Mutex; |
| 34 class Semaphore; | 34 class Semaphore; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 #elif defined(__APPLE__) | 125 #elif defined(__APPLE__) |
| 126 return kMacOS; | 126 return kMacOS; |
| 127 #elif defined(_WINNT) | 127 #elif defined(_WINNT) |
| 128 return kWindows; | 128 return kWindows; |
| 129 #else | 129 #else |
| 130 return kUnknownOS; | 130 return kUnknownOS; |
| 131 #endif | 131 #endif |
| 132 } | 132 } |
| 133 | 133 |
| 134 inline Architecture Arch() { | 134 inline Architecture Arch() { |
| 135 #if defined(FLETCH_TARGET_IA32) | 135 #if defined(DARTINO_TARGET_IA32) |
| 136 return kIA32; | 136 return kIA32; |
| 137 #elif defined(FLETCH_TARGET_X64) | 137 #elif defined(DARTINO_TARGET_X64) |
| 138 return kX64; | 138 return kX64; |
| 139 #elif defined(FLETCH_TARGET_ARM) | 139 #elif defined(DARTINO_TARGET_ARM) |
| 140 return kARM; | 140 return kARM; |
| 141 #else | 141 #else |
| 142 return kUnknownArch; | 142 return kUnknownArch; |
| 143 #endif | 143 #endif |
| 144 } | 144 } |
| 145 } // namespace Platform | 145 } // namespace Platform |
| 146 | 146 |
| 147 // Interface for manipulating virtual memory. | 147 // Interface for manipulating virtual memory. |
| 148 class VirtualMemory { | 148 class VirtualMemory { |
| 149 public: | 149 public: |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 | 253 |
| 254 private: | 254 private: |
| 255 Monitor* const monitor_; | 255 Monitor* const monitor_; |
| 256 DISALLOW_COPY_AND_ASSIGN(ScopedMonitorUnlock); | 256 DISALLOW_COPY_AND_ASSIGN(ScopedMonitorUnlock); |
| 257 }; | 257 }; |
| 258 | 258 |
| 259 inline Mutex* Platform::CreateMutex() { return new Mutex(); } | 259 inline Mutex* Platform::CreateMutex() { return new Mutex(); } |
| 260 | 260 |
| 261 inline Monitor* Platform::CreateMonitor() { return new Monitor(); } | 261 inline Monitor* Platform::CreateMonitor() { return new Monitor(); } |
| 262 | 262 |
| 263 } // namespace fletch | 263 } // namespace dartino |
| 264 | 264 |
| 265 #endif // SRC_SHARED_PLATFORM_H_ | 265 #endif // SRC_SHARED_PLATFORM_H_ |
| OLD | NEW |