OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/io_natives.h" | 5 #include "bin/io_natives.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include "bin/builtin.h" | 10 #include "bin/builtin.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 static struct NativeEntries { | 91 static struct NativeEntries { |
92 const char* name_; | 92 const char* name_; |
93 Dart_NativeFunction function_; | 93 Dart_NativeFunction function_; |
94 int argument_count_; | 94 int argument_count_; |
95 } IOEntries[] = { | 95 } IOEntries[] = { |
96 IO_NATIVE_LIST(REGISTER_FUNCTION) | 96 IO_NATIVE_LIST(REGISTER_FUNCTION) |
97 }; | 97 }; |
98 | 98 |
99 | 99 |
100 Dart_NativeFunction IONativeLookup(Dart_Handle name, | 100 Dart_NativeFunction IONativeLookup(Dart_Handle name, |
101 int argument_count) { | 101 int argument_count, |
| 102 bool* auto_setup_scope) { |
102 const char* function_name = NULL; | 103 const char* function_name = NULL; |
103 Dart_Handle result = Dart_StringToCString(name, &function_name); | 104 Dart_Handle result = Dart_StringToCString(name, &function_name); |
104 DART_CHECK_VALID(result); | 105 DART_CHECK_VALID(result); |
105 ASSERT(function_name != NULL); | 106 ASSERT(function_name != NULL); |
| 107 ASSERT(auto_setup_scope != NULL); |
| 108 *auto_setup_scope = true; |
106 int num_entries = sizeof(IOEntries) / sizeof(struct NativeEntries); | 109 int num_entries = sizeof(IOEntries) / sizeof(struct NativeEntries); |
107 for (int i = 0; i < num_entries; i++) { | 110 for (int i = 0; i < num_entries; i++) { |
108 struct NativeEntries* entry = &(IOEntries[i]); | 111 struct NativeEntries* entry = &(IOEntries[i]); |
109 if (!strcmp(function_name, entry->name_) && | 112 if (!strcmp(function_name, entry->name_) && |
110 (entry->argument_count_ == argument_count)) { | 113 (entry->argument_count_ == argument_count)) { |
111 return reinterpret_cast<Dart_NativeFunction>(entry->function_); | 114 return reinterpret_cast<Dart_NativeFunction>(entry->function_); |
112 } | 115 } |
113 } | 116 } |
114 return NULL; | 117 return NULL; |
115 } | 118 } |
116 | 119 |
117 } // namespace bin | 120 } // namespace bin |
118 } // namespace dart | 121 } // namespace dart |
OLD | NEW |