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 #include "bin/platform.h" | 5 #include "bin/platform.h" |
6 | 6 |
7 #include "bin/file.h" | 7 #include "bin/file.h" |
8 #include "bin/utils.h" | 8 #include "bin/utils.h" |
9 #include "include/dart_api.h" | 9 #include "include/dart_api.h" |
10 | 10 |
11 namespace dart { | 11 namespace dart { |
12 namespace bin { | 12 namespace bin { |
13 | 13 |
14 void FUNCTION_NAME(Platform_NumberOfProcessors)(Dart_NativeArguments args) { | 14 void FUNCTION_NAME(Platform_NumberOfProcessors)(Dart_NativeArguments args) { |
15 Dart_SetReturnValue(args, Dart_NewInteger(Platform::NumberOfProcessors())); | 15 Dart_SetReturnValue(args, Dart_NewInteger(Platform::NumberOfProcessors())); |
16 } | 16 } |
17 | 17 |
18 void FUNCTION_NAME(Platform_OperatingSystem)(Dart_NativeArguments args) { | 18 void FUNCTION_NAME(Platform_OperatingSystem)(Dart_NativeArguments args) { |
19 Dart_SetReturnValue(args, DartUtils::NewString(Platform::OperatingSystem())); | 19 Dart_SetReturnValue(args, DartUtils::NewString(Platform::OperatingSystem())); |
20 } | 20 } |
21 | 21 |
| 22 void FUNCTION_NAME(Platform_OperatingSystemVersion)(Dart_NativeArguments args) { |
| 23 const char* version = Platform::OperatingSystemVersion(); |
| 24 if (version == NULL) { |
| 25 Dart_SetReturnValue(args, DartUtils::NewDartOSError()); |
| 26 } else { |
| 27 Dart_SetReturnValue(args, DartUtils::NewString(version)); |
| 28 } |
| 29 } |
| 30 |
22 void FUNCTION_NAME(Platform_PathSeparator)(Dart_NativeArguments args) { | 31 void FUNCTION_NAME(Platform_PathSeparator)(Dart_NativeArguments args) { |
23 Dart_SetReturnValue(args, DartUtils::NewString(File::PathSeparator())); | 32 Dart_SetReturnValue(args, DartUtils::NewString(File::PathSeparator())); |
24 } | 33 } |
25 | 34 |
26 void FUNCTION_NAME(Platform_LocalHostname)(Dart_NativeArguments args) { | 35 void FUNCTION_NAME(Platform_LocalHostname)(Dart_NativeArguments args) { |
27 const intptr_t HOSTNAME_LENGTH = 256; | 36 const intptr_t HOSTNAME_LENGTH = 256; |
28 char hostname[HOSTNAME_LENGTH]; | 37 char hostname[HOSTNAME_LENGTH]; |
29 if (Platform::LocalHostname(hostname, HOSTNAME_LENGTH)) { | 38 if (Platform::LocalHostname(hostname, HOSTNAME_LENGTH)) { |
30 Dart_SetReturnValue(args, DartUtils::NewString(hostname)); | 39 Dart_SetReturnValue(args, DartUtils::NewString(hostname)); |
31 } else { | 40 } else { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 const char* locale = Platform::LocaleName(); | 112 const char* locale = Platform::LocaleName(); |
104 if (locale == NULL) { | 113 if (locale == NULL) { |
105 Dart_SetReturnValue(args, DartUtils::NewDartOSError()); | 114 Dart_SetReturnValue(args, DartUtils::NewDartOSError()); |
106 } else { | 115 } else { |
107 Dart_SetReturnValue(args, Dart_NewStringFromCString(locale)); | 116 Dart_SetReturnValue(args, Dart_NewStringFromCString(locale)); |
108 } | 117 } |
109 } | 118 } |
110 | 119 |
111 } // namespace bin | 120 } // namespace bin |
112 } // namespace dart | 121 } // namespace dart |
OLD | NEW |