| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 void Builtin::PrintString(FILE* out, Dart_Handle str) { | 106 void Builtin::PrintString(FILE* out, Dart_Handle str) { |
| 107 const uint8_t* characters = NULL; | 107 const uint8_t* characters = NULL; |
| 108 intptr_t length; | 108 intptr_t length; |
| 109 Dart_Handle result = Dart_StringToBytes(str, &characters, &length); | 109 Dart_Handle result = Dart_StringToBytes(str, &characters, &length); |
| 110 if (Dart_IsError(result)) { | 110 if (Dart_IsError(result)) { |
| 111 // TODO(turnidge): Consider propagating some errors here. What if | 111 // TODO(turnidge): Consider propagating some errors here. What if |
| 112 // an isolate gets interrupted by the embedder in the middle of | 112 // an isolate gets interrupted by the embedder in the middle of |
| 113 // Dart_StringToBytes? We need to make sure not to swallow the | 113 // Dart_StringToBytes? We need to make sure not to swallow the |
| 114 // interrupt. | 114 // interrupt. |
| 115 fputs(Dart_GetError(result)); | 115 fputs(Dart_GetError(result), out); |
| 116 } else { | 116 } else { |
| 117 fwrite(characters, sizeof(*characters), length, out); | 117 fwrite(characters, sizeof(*characters), length, out); |
| 118 } | 118 } |
| 119 fputc('\n', out); | 119 fputc('\n', out); |
| 120 fflush(out); | 120 fflush(out); |
| 121 } | 121 } |
| 122 | 122 |
| 123 | 123 |
| 124 void FUNCTION_NAME(Logger_PrintString)(Dart_NativeArguments args) { | 124 void FUNCTION_NAME(Logger_PrintString)(Dart_NativeArguments args) { |
| 125 Dart_EnterScope(); | 125 Dart_EnterScope(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 142 } else { | 142 } else { |
| 143 ASSERT(id == Builtin::kIOLibrary); | 143 ASSERT(id == Builtin::kIOLibrary); |
| 144 url = Dart_NewString(DartUtils::kIOLibURL); | 144 url = Dart_NewString(DartUtils::kIOLibURL); |
| 145 } | 145 } |
| 146 Dart_Handle builtin_lib = Dart_LookupLibrary(url); | 146 Dart_Handle builtin_lib = Dart_LookupLibrary(url); |
| 147 DART_CHECK_VALID(builtin_lib); | 147 DART_CHECK_VALID(builtin_lib); |
| 148 // Setup the native resolver for built in library functions. | 148 // Setup the native resolver for built in library functions. |
| 149 Dart_Handle result = Dart_SetNativeResolver(builtin_lib, NativeLookup); | 149 Dart_Handle result = Dart_SetNativeResolver(builtin_lib, NativeLookup); |
| 150 DART_CHECK_VALID(result); | 150 DART_CHECK_VALID(result); |
| 151 } | 151 } |
| OLD | NEW |