| 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 <stdio.h> | 5 #include <stdio.h> |
| 6 #include <stdlib.h> | 6 #include <stdlib.h> |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "include/dart_api.h" | 9 #include "include/dart_api.h" |
| 10 #include "include/dart_tools_api.h" | 10 #include "include/dart_tools_api.h" |
| 11 | 11 |
| 12 #include "platform/assert.h" | 12 #include "platform/assert.h" |
| 13 | 13 |
| 14 #include "bin/builtin.h" | 14 #include "bin/builtin.h" |
| 15 #include "bin/dartutils.h" | 15 #include "bin/dartutils.h" |
| 16 #include "bin/embedded_dart_io.h" | 16 #include "bin/embedded_dart_io.h" |
| 17 #include "bin/file.h" | 17 #include "bin/file.h" |
| 18 #include "bin/io_natives.h" | 18 #include "bin/io_natives.h" |
| 19 #include "bin/platform.h" | 19 #include "bin/platform.h" |
| 20 | 20 |
| 21 namespace dart { | 21 namespace dart { |
| 22 namespace bin { | 22 namespace bin { |
| 23 | 23 |
| 24 // Lists the native functions implementing basic functionality in | 24 // Lists the native functions implementing basic functionality in |
| 25 // standalone dart, such as printing, file I/O, and platform information. | 25 // standalone dart, such as printing, file I/O, and platform information. |
| 26 // Advanced I/O classes like sockets and process management are implemented | 26 // Advanced I/O classes like sockets and process management are implemented |
| 27 // using functions listed in io_natives.cc. | 27 // using functions listed in io_natives.cc. |
| 28 #define BUILTIN_NATIVE_LIST(V) \ | 28 #define BUILTIN_NATIVE_LIST(V) V(Builtin_PrintString, 1) |
| 29 V(Builtin_PrintString, 1) \ | |
| 30 V(Builtin_GetCurrentDirectory, 0) | |
| 31 | 29 |
| 32 BUILTIN_NATIVE_LIST(DECLARE_FUNCTION); | 30 BUILTIN_NATIVE_LIST(DECLARE_FUNCTION); |
| 33 | 31 |
| 34 static struct NativeEntries { | 32 static struct NativeEntries { |
| 35 const char* name_; | 33 const char* name_; |
| 36 Dart_NativeFunction function_; | 34 Dart_NativeFunction function_; |
| 37 int argument_count_; | 35 int argument_count_; |
| 38 } BuiltinEntries[] = {BUILTIN_NATIVE_LIST(REGISTER_FUNCTION)}; | 36 } BuiltinEntries[] = {BUILTIN_NATIVE_LIST(REGISTER_FUNCTION)}; |
| 39 | 37 |
| 40 void Builtin_DummyNative(Dart_NativeArguments args) { | 38 void Builtin_DummyNative(Dart_NativeArguments args) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 if (ShouldCaptureStdout()) { | 97 if (ShouldCaptureStdout()) { |
| 100 // For now we report print output on the Stdout stream. | 98 // For now we report print output on the Stdout stream. |
| 101 uint8_t newline[] = {'\n'}; | 99 uint8_t newline[] = {'\n'}; |
| 102 Dart_ServiceSendDataEvent("Stdout", "WriteEvent", chars, length); | 100 Dart_ServiceSendDataEvent("Stdout", "WriteEvent", chars, length); |
| 103 Dart_ServiceSendDataEvent("Stdout", "WriteEvent", newline, sizeof(newline)); | 101 Dart_ServiceSendDataEvent("Stdout", "WriteEvent", newline, sizeof(newline)); |
| 104 } | 102 } |
| 105 } | 103 } |
| 106 | 104 |
| 107 } // namespace bin | 105 } // namespace bin |
| 108 } // namespace dart | 106 } // namespace dart |
| OLD | NEW |