| 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/builtin.h" | 5 #include "bin/builtin.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include "bin/dartutils.h" | 10 #include "bin/dartutils.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 fflush(out); | 117 fflush(out); |
| 118 } | 118 } |
| 119 | 119 |
| 120 | 120 |
| 121 void FUNCTION_NAME(Logger_PrintString)(Dart_NativeArguments args) { | 121 void FUNCTION_NAME(Logger_PrintString)(Dart_NativeArguments args) { |
| 122 Dart_EnterScope(); | 122 Dart_EnterScope(); |
| 123 Builtin::PrintString(stdout, Dart_GetNativeArgument(args, 0)); | 123 Builtin::PrintString(stdout, Dart_GetNativeArgument(args, 0)); |
| 124 Dart_ExitScope(); | 124 Dart_ExitScope(); |
| 125 } | 125 } |
| 126 | 126 |
| 127 |
| 127 void FUNCTION_NAME(Exit)(Dart_NativeArguments args) { | 128 void FUNCTION_NAME(Exit)(Dart_NativeArguments args) { |
| 128 Dart_EnterScope(); | 129 Dart_EnterScope(); |
| 129 int64_t status = 0; | 130 int64_t status = 0; |
| 130 // Ignore result if passing invalid argument and just exit 0. | 131 // Ignore result if passing invalid argument and just exit 0. |
| 131 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status); | 132 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status); |
| 132 Dart_ExitScope(); | 133 Dart_ExitScope(); |
| 133 exit(status); | 134 exit(status); |
| 134 } | 135 } |
| 135 | |
| 136 | |
| 137 void Builtin::SetupIOLibrary(Dart_Handle io_lib) { | |
| 138 Dart_Handle url = Dart_NewString(DartUtils::kIsolateLibURL); | |
| 139 DART_CHECK_VALID(url); | |
| 140 Dart_Handle isolate_lib = Dart_LookupLibrary(url); | |
| 141 DART_CHECK_VALID(isolate_lib); | |
| 142 Dart_Handle timer_closure = | |
| 143 Dart_Invoke(io_lib, Dart_NewString("_getTimerFactoryClosure"), 0, NULL); | |
| 144 Dart_Handle args[1]; | |
| 145 args[0] = timer_closure; | |
| 146 DART_CHECK_VALID(Dart_Invoke(isolate_lib, | |
| 147 Dart_NewString("_setTimerFactoryClosure"), | |
| 148 1, args)); | |
| 149 } | |
| OLD | NEW |