Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 <assert.h> | 5 #include <assert.h> |
| 6 #include <stdlib.h> | 6 #include <stdlib.h> |
| 7 #include <string.h> | |
| 8 #include <stdio.h> | 7 #include <stdio.h> |
| 9 | 8 |
| 9 #include <string> | |
|
Ivan Posva
2011/10/18 20:52:43
I do not see a reason for changing which headers a
rchandia
2011/10/18 21:05:28
Neither do I, but the presubmit script complained
Ivan Posva
2011/10/18 21:31:53
Agreed, but as I said it should not matter as all
| |
| 10 | |
| 10 #include "include/dart_api.h" | 11 #include "include/dart_api.h" |
| 11 | 12 |
| 12 #include "bin/builtin.h" | 13 #include "bin/builtin.h" |
| 13 | 14 |
| 14 // Implementation of native functions which are used for some | 15 // Implementation of native functions which are used for some |
| 15 // test/debug functionality in standalone dart mode. | 16 // test/debug functionality in standalone dart mode. |
| 16 | 17 |
| 17 void PrintString(FILE* out, Dart_Handle string) { | 18 void PrintString(FILE* out, Dart_Handle string) { |
| 18 Dart_Result result = Dart_StringToCString(string); | 19 Dart_Result result = Dart_StringToCString(string); |
| 19 const char* cstring = Dart_IsValidResult(result) ? | 20 const char* cstring = Dart_IsValidResult(result) ? |
| 20 Dart_GetResultAsCString(result) : Dart_GetErrorCString(result); | 21 Dart_GetResultAsCString(result) : Dart_GetErrorCString(result); |
| 21 fprintf(out, "%s\n", cstring); | 22 fprintf(out, "%s\n", cstring); |
| 23 fflush(out); | |
| 22 } | 24 } |
| 23 | 25 |
| 24 | 26 |
| 25 void FUNCTION_NAME(Logger_PrintString)(Dart_NativeArguments args) { | 27 void FUNCTION_NAME(Logger_PrintString)(Dart_NativeArguments args) { |
| 26 Dart_EnterScope(); | 28 Dart_EnterScope(); |
| 27 PrintString(stdout, Dart_GetNativeArgument(args, 0)); | 29 PrintString(stdout, Dart_GetNativeArgument(args, 0)); |
| 28 Dart_ExitScope(); | 30 Dart_ExitScope(); |
| 29 } | 31 } |
| OLD | NEW |