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 "dart_api.h" |
8 | 8 |
9 Dart_NativeFunction ResolveName(Dart_Handle name, int argc); | 9 Dart_NativeFunction ResolveName(Dart_Handle name, int argc); |
10 | 10 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 Dart_CObject result; | 89 Dart_CObject result; |
90 result.type = Dart_CObject::kNull; | 90 result.type = Dart_CObject::kNull; |
91 Dart_PostCObject(reply_port_id, &result); | 91 Dart_PostCObject(reply_port_id, &result); |
92 } | 92 } |
93 | 93 |
94 void randomArrayServicePort(Dart_NativeArguments arguments) { | 94 void randomArrayServicePort(Dart_NativeArguments arguments) { |
95 Dart_EnterScope(); | 95 Dart_EnterScope(); |
96 Dart_SetReturnValue(arguments, Dart_Null()); | 96 Dart_SetReturnValue(arguments, Dart_Null()); |
97 Dart_Port service_port = | 97 Dart_Port service_port = |
98 Dart_NewNativePort("RandomArrayService", wrappedRandomArray, true); | 98 Dart_NewNativePort("RandomArrayService", wrappedRandomArray, true); |
99 if (service_port != kIllegalPort) { | 99 if (service_port != ILLEGAL_PORT) { |
100 Dart_Handle send_port = HandleError(Dart_NewSendPort(service_port)); | 100 Dart_Handle send_port = HandleError(Dart_NewSendPort(service_port)); |
101 Dart_SetReturnValue(arguments, send_port); | 101 Dart_SetReturnValue(arguments, send_port); |
102 } | 102 } |
103 Dart_ExitScope(); | 103 Dart_ExitScope(); |
104 } | 104 } |
105 | 105 |
106 | 106 |
107 struct FunctionLookup { | 107 struct FunctionLookup { |
108 const char* name; | 108 const char* name; |
109 Dart_NativeFunction function; | 109 Dart_NativeFunction function; |
(...skipping 14 matching lines...) Expand all Loading... |
124 | 124 |
125 for (int i=0; function_list[i].name != NULL; ++i) { | 125 for (int i=0; function_list[i].name != NULL; ++i) { |
126 if (strcmp(function_list[i].name, cname) == 0) { | 126 if (strcmp(function_list[i].name, cname) == 0) { |
127 result = function_list[i].function; | 127 result = function_list[i].function; |
128 break; | 128 break; |
129 } | 129 } |
130 } | 130 } |
131 Dart_ExitScope(); | 131 Dart_ExitScope(); |
132 return result; | 132 return result; |
133 } | 133 } |
OLD | NEW |