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 #include <string.h> | 4 #include <string.h> |
5 #include <stdlib.h> | 5 #include <stdlib.h> |
6 #include <stdio.h> | 6 #include <stdio.h> |
7 #include "dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "include/dart_native_api.h" |
8 | 9 |
9 Dart_NativeFunction ResolveName(Dart_Handle name, int argc); | 10 Dart_NativeFunction ResolveName(Dart_Handle name, int argc); |
10 | 11 |
11 DART_EXPORT Dart_Handle sample_extension_Init(Dart_Handle parent_library) { | 12 DART_EXPORT Dart_Handle sample_extension_Init(Dart_Handle parent_library) { |
12 if (Dart_IsError(parent_library)) { return parent_library; } | 13 if (Dart_IsError(parent_library)) { return parent_library; } |
13 | 14 |
14 Dart_Handle result_code = Dart_SetNativeResolver(parent_library, ResolveName); | 15 Dart_Handle result_code = Dart_SetNativeResolver(parent_library, ResolveName); |
15 if (Dart_IsError(result_code)) return result_code; | 16 if (Dart_IsError(result_code)) return result_code; |
16 | 17 |
17 return Dart_Null(); | 18 return Dart_Null(); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 126 |
126 for (int i=0; function_list[i].name != NULL; ++i) { | 127 for (int i=0; function_list[i].name != NULL; ++i) { |
127 if (strcmp(function_list[i].name, cname) == 0) { | 128 if (strcmp(function_list[i].name, cname) == 0) { |
128 result = function_list[i].function; | 129 result = function_list[i].function; |
129 break; | 130 break; |
130 } | 131 } |
131 } | 132 } |
132 Dart_ExitScope(); | 133 Dart_ExitScope(); |
133 return result; | 134 return result; |
134 } | 135 } |
OLD | NEW |