OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/dartutils.h" | 5 #include "bin/dartutils.h" |
6 #include "bin/io_buffer.h" | 6 #include "bin/io_buffer.h" |
7 #include "bin/platform.h" | 7 #include "bin/platform.h" |
8 #include "bin/process.h" | 8 #include "bin/process.h" |
9 #include "bin/socket.h" | 9 #include "bin/socket.h" |
10 | 10 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 Dart_SetReturnValue(args, Dart_NewBoolean(success)); | 202 Dart_SetReturnValue(args, Dart_NewBoolean(success)); |
203 } | 203 } |
204 | 204 |
205 | 205 |
206 void FUNCTION_NAME(Process_Exit)(Dart_NativeArguments args) { | 206 void FUNCTION_NAME(Process_Exit)(Dart_NativeArguments args) { |
207 int64_t status = 0; | 207 int64_t status = 0; |
208 // Ignore result if passing invalid argument and just exit 0. | 208 // Ignore result if passing invalid argument and just exit 0. |
209 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status); | 209 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status); |
210 Dart_ExitIsolate(); | 210 Dart_ExitIsolate(); |
211 Dart_Cleanup(); | 211 Dart_Cleanup(); |
212 Platform::Cleanup(); | |
213 exit(static_cast<int>(status)); | 212 exit(static_cast<int>(status)); |
214 } | 213 } |
215 | 214 |
216 | 215 |
217 void FUNCTION_NAME(Process_SetExitCode)(Dart_NativeArguments args) { | 216 void FUNCTION_NAME(Process_SetExitCode)(Dart_NativeArguments args) { |
218 int64_t status = 0; | 217 int64_t status = 0; |
219 // Ignore result if passing invalid argument and just set exit code to 0. | 218 // Ignore result if passing invalid argument and just set exit code to 0. |
220 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status); | 219 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status); |
221 Process::SetGlobalExitCode(status); | 220 Process::SetGlobalExitCode(status); |
222 } | 221 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 int external_length = strlen(system_string); | 297 int external_length = strlen(system_string); |
299 uint8_t* buffer = NULL; | 298 uint8_t* buffer = NULL; |
300 Dart_Handle external_array = IOBuffer::Allocate(external_length, &buffer); | 299 Dart_Handle external_array = IOBuffer::Allocate(external_length, &buffer); |
301 memmove(buffer, system_string, external_length); | 300 memmove(buffer, system_string, external_length); |
302 if (utf8 != system_string) free(const_cast<char*>(system_string)); | 301 if (utf8 != system_string) free(const_cast<char*>(system_string)); |
303 Dart_SetReturnValue(args, external_array); | 302 Dart_SetReturnValue(args, external_array); |
304 } | 303 } |
305 | 304 |
306 } // namespace bin | 305 } // namespace bin |
307 } // namespace dart | 306 } // namespace dart |
OLD | NEW |