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 <stdlib.h> | 5 #include <stdlib.h> |
6 #include <stdio.h> | 6 #include <stdio.h> |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "include/dart_api.h" | 9 #include "include/dart_api.h" |
10 | 10 |
11 #include "bin/builtin.h" | 11 #include "bin/builtin.h" |
12 #include "bin/io_natives.h" | 12 #include "bin/io_natives.h" |
13 | 13 |
14 namespace dart { | 14 namespace dart { |
15 namespace bin { | 15 namespace bin { |
16 | 16 |
17 // Lists the native function implementing basic logging facility. | 17 // Lists the native function implementing basic logging facility. |
18 #define BUILTIN_NATIVE_LIST(V) \ | 18 #define BUILTIN_NATIVE_LIST(V) V(Builtin_PrintString, 1) |
19 V(Builtin_PrintString, 1) | |
20 | 19 |
21 BUILTIN_NATIVE_LIST(DECLARE_FUNCTION); | 20 BUILTIN_NATIVE_LIST(DECLARE_FUNCTION); |
22 | 21 |
23 static struct NativeEntries { | 22 static struct NativeEntries { |
24 const char* name_; | 23 const char* name_; |
25 Dart_NativeFunction function_; | 24 Dart_NativeFunction function_; |
26 int argument_count_; | 25 int argument_count_; |
27 } BuiltinEntries[] = { | 26 } BuiltinEntries[] = {BUILTIN_NATIVE_LIST(REGISTER_FUNCTION)}; |
28 BUILTIN_NATIVE_LIST(REGISTER_FUNCTION) | |
29 }; | |
30 | 27 |
31 | 28 |
32 Dart_NativeFunction Builtin::NativeLookup(Dart_Handle name, | 29 Dart_NativeFunction Builtin::NativeLookup(Dart_Handle name, |
33 int argument_count, | 30 int argument_count, |
34 bool* auto_setup_scope) { | 31 bool* auto_setup_scope) { |
35 const char* function_name = NULL; | 32 const char* function_name = NULL; |
36 Dart_Handle result = Dart_StringToCString(name, &function_name); | 33 Dart_Handle result = Dart_StringToCString(name, &function_name); |
37 DART_CHECK_VALID(result); | 34 DART_CHECK_VALID(result); |
38 ASSERT(function_name != NULL); | 35 ASSERT(function_name != NULL); |
39 ASSERT(auto_setup_scope != NULL); | 36 ASSERT(auto_setup_scope != NULL); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 } else { | 76 } else { |
80 fwrite(chars, sizeof(*chars), length, stdout); | 77 fwrite(chars, sizeof(*chars), length, stdout); |
81 } | 78 } |
82 fputc('\n', stdout); | 79 fputc('\n', stdout); |
83 fflush(stdout); | 80 fflush(stdout); |
84 Dart_ExitScope(); | 81 Dart_ExitScope(); |
85 } | 82 } |
86 | 83 |
87 } // namespace bin | 84 } // namespace bin |
88 } // namespace dart | 85 } // namespace dart |
OLD | NEW |