OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 #include "vm/globals.h" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_OS_FUCHSIA) | 6 #if defined(TARGET_OS_FUCHSIA) |
7 | 7 |
8 #include "vm/os.h" | 8 #include "vm/os.h" |
9 | 9 |
| 10 #include <errno.h> |
10 #include <magenta/syscalls.h> | 11 #include <magenta/syscalls.h> |
11 #include <magenta/types.h> | 12 #include <magenta/types.h> |
12 | 13 |
13 #include "platform/assert.h" | 14 #include "platform/assert.h" |
14 #include "vm/zone.h" | 15 #include "vm/zone.h" |
15 | 16 |
16 namespace dart { | 17 namespace dart { |
17 | 18 |
18 #ifndef PRODUCT | 19 #ifndef PRODUCT |
19 | 20 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 // Print. | 234 // Print. |
234 va_list print_args; | 235 va_list print_args; |
235 va_copy(print_args, args); | 236 va_copy(print_args, args); |
236 VSNPrint(buffer, len + 1, format, print_args); | 237 VSNPrint(buffer, len + 1, format, print_args); |
237 va_end(print_args); | 238 va_end(print_args); |
238 return buffer; | 239 return buffer; |
239 } | 240 } |
240 | 241 |
241 | 242 |
242 bool OS::StringToInt64(const char* str, int64_t* value) { | 243 bool OS::StringToInt64(const char* str, int64_t* value) { |
243 UNIMPLEMENTED(); | 244 ASSERT(str != NULL && strlen(str) > 0 && value != NULL); |
244 return false; | 245 int32_t base = 10; |
| 246 char* endptr; |
| 247 int i = 0; |
| 248 if (str[0] == '-') { |
| 249 i = 1; |
| 250 } |
| 251 if ((str[i] == '0') && |
| 252 (str[i + 1] == 'x' || str[i + 1] == 'X') && |
| 253 (str[i + 2] != '\0')) { |
| 254 base = 16; |
| 255 } |
| 256 errno = 0; |
| 257 *value = strtoll(str, &endptr, base); |
| 258 return ((errno == 0) && (endptr != str) && (*endptr == 0)); |
245 } | 259 } |
246 | 260 |
247 | 261 |
248 void OS::RegisterCodeObservers() { | 262 void OS::RegisterCodeObservers() { |
249 #ifndef PRODUCT | 263 #ifndef PRODUCT |
250 if (FLAG_generate_perf_events_symbols) { | 264 if (FLAG_generate_perf_events_symbols) { |
251 UNIMPLEMENTED(); | 265 UNIMPLEMENTED(); |
252 } | 266 } |
253 #endif // !PRODUCT | 267 #endif // !PRODUCT |
254 } | 268 } |
(...skipping 26 matching lines...) Expand all Loading... |
281 } | 295 } |
282 | 296 |
283 | 297 |
284 void OS::Exit(int code) { | 298 void OS::Exit(int code) { |
285 UNIMPLEMENTED(); | 299 UNIMPLEMENTED(); |
286 } | 300 } |
287 | 301 |
288 } // namespace dart | 302 } // namespace dart |
289 | 303 |
290 #endif // defined(TARGET_OS_FUCHSIA) | 304 #endif // defined(TARGET_OS_FUCHSIA) |
OLD | NEW |