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 #if defined(FLETCH_TARGET_OS_WIN) | 5 #if defined(DARTINO_TARGET_OS_WIN) |
6 | 6 |
7 #include "src/shared/platform.h" // NOLINT | 7 #include "src/shared/platform.h" // NOLINT |
8 | 8 |
9 #include <winsock2.h> | 9 #include <winsock2.h> |
10 #include <stdlib.h> | 10 #include <stdlib.h> |
11 #include <malloc.h> | 11 #include <malloc.h> |
12 #include <stdarg.h> | 12 #include <stdarg.h> |
13 #include <stdio.h> | 13 #include <stdio.h> |
14 | 14 |
15 #include "src/shared/utils.h" | 15 #include "src/shared/utils.h" |
16 | 16 |
17 namespace fletch { | 17 namespace dartino { |
18 | 18 |
19 static uint64 time_launch; | 19 static uint64 time_launch; |
20 | 20 |
21 void GetPathOfExecutable(char* path, size_t path_length) { | 21 void GetPathOfExecutable(char* path, size_t path_length) { |
22 HMODULE hModule = GetModuleHandle(NULL); | 22 HMODULE hModule = GetModuleHandle(NULL); |
23 if (hModule != NULL) { | 23 if (hModule != NULL) { |
24 DWORD result = GetModuleFileName(hModule, path, path_length); | 24 DWORD result = GetModuleFileName(hModule, path, path_length); |
25 if (result == 0 || result == path_length) { | 25 if (result == 0 || result == path_length) { |
26 FATAL("GetModuleFileName failed"); | 26 FATAL("GetModuleFileName failed"); |
27 } | 27 } |
28 } else { | 28 } else { |
29 FATAL("GetModuleHandle for exe failed"); | 29 FATAL("GetModuleHandle for exe failed"); |
30 } | 30 } |
31 } | 31 } |
32 | 32 |
33 void Platform::Setup() { | 33 void Platform::Setup() { |
34 time_launch = GetTickCount64(); | 34 time_launch = GetTickCount64(); |
35 #if defined(FLETCH_ENABLE_LIVE_CODING) | 35 #if defined(DARTINO_ENABLE_LIVE_CODING) |
36 WSADATA wsa_data; | 36 WSADATA wsa_data; |
37 int status = WSAStartup(MAKEWORD(2, 2), &wsa_data); | 37 int status = WSAStartup(MAKEWORD(2, 2), &wsa_data); |
38 if (status != 0) { | 38 if (status != 0) { |
39 FATAL1("Unable to initialize Windows Sockets [error #%d].", status); | 39 FATAL1("Unable to initialize Windows Sockets [error #%d].", status); |
40 } | 40 } |
41 #endif | 41 #endif |
42 } | 42 } |
43 | 43 |
44 void Platform::TearDown() { | 44 void Platform::TearDown() { |
45 #if defined(FLETCH_ENABLE_LIVE_CODING) | 45 #if defined(DARTINO_ENABLE_LIVE_CODING) |
46 WSACleanup(); | 46 WSACleanup(); |
47 #endif | 47 #endif |
48 } | 48 } |
49 | 49 |
50 uint64 Platform::GetMicroseconds() { | 50 uint64 Platform::GetMicroseconds() { |
51 SYSTEMTIME sys_time; | 51 SYSTEMTIME sys_time; |
52 FILETIME file_time; | 52 FILETIME file_time; |
53 ULARGE_INTEGER milliseconds; | 53 ULARGE_INTEGER milliseconds; |
54 | 54 |
55 // On Windows 8+ we could maybe also use GetSystemTimePreciseAsFileTime. | 55 // On Windows 8+ we could maybe also use GetSystemTimePreciseAsFileTime. |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 bool VirtualMemory::Commit(uword address, int size, bool executable) { | 264 bool VirtualMemory::Commit(uword address, int size, bool executable) { |
265 UNIMPLEMENTED(); | 265 UNIMPLEMENTED(); |
266 return false; | 266 return false; |
267 } | 267 } |
268 | 268 |
269 bool VirtualMemory::Uncommit(uword address, int size) { | 269 bool VirtualMemory::Uncommit(uword address, int size) { |
270 UNIMPLEMENTED(); | 270 UNIMPLEMENTED(); |
271 return false; | 271 return false; |
272 } | 272 } |
273 | 273 |
274 } // namespace fletch | 274 } // namespace dartino |
275 | 275 |
276 #endif // defined(FLETCH_TARGET_OS_WIN) | 276 #endif // defined(DARTINO_TARGET_OS_WIN) |
OLD | NEW |