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 "bin/dartutils.h" | 5 #include "bin/dartutils.h" |
6 | 6 |
7 #include "bin/file.h" | 7 #include "bin/file.h" |
8 #include "include/dart_api.h" | |
8 #include "platform/assert.h" | 9 #include "platform/assert.h" |
9 #include "platform/globals.h" | 10 #include "platform/globals.h" |
10 | 11 |
11 const char* DartUtils::kDartScheme = "dart:"; | 12 const char* DartUtils::kDartScheme = "dart:"; |
12 const char* DartUtils::kBuiltinLibURL = "dart:builtin"; | 13 const char* DartUtils::kBuiltinLibURL = "dart:builtin"; |
13 const char* DartUtils::kCoreLibURL = "dart:core"; | 14 const char* DartUtils::kCoreLibURL = "dart:core"; |
14 const char* DartUtils::kCoreImplLibURL = "dart:coreimpl"; | 15 const char* DartUtils::kCoreImplLibURL = "dart:coreimpl"; |
15 const char* DartUtils::kIOLibURL = "dart:io"; | 16 const char* DartUtils::kIOLibURL = "dart:io"; |
16 | 17 |
17 | 18 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
222 path, File::PathSeparator(), filename); | 223 path, File::PathSeparator(), filename); |
223 | 224 |
224 free(path); | 225 free(path); |
225 char* canonical_filename = File::GetCanonicalPath(absolute_filename); | 226 char* canonical_filename = File::GetCanonicalPath(absolute_filename); |
226 if (canonical_filename == NULL) { | 227 if (canonical_filename == NULL) { |
227 return absolute_filename; | 228 return absolute_filename; |
228 } | 229 } |
229 free(absolute_filename); | 230 free(absolute_filename); |
230 return canonical_filename; | 231 return canonical_filename; |
231 } | 232 } |
233 | |
234 | |
235 bool DartUtils::PostNull(Dart_Port port_id) { | |
236 // Post a message with just the null object. | |
237 Dart_CObject object; | |
238 object.type = Dart_CObject::kNull; | |
239 Dart_CMessage message; | |
240 message.root = &object; | |
241 return Dart_PostCMessage(port_id, &message); | |
siva
2012/02/04 02:51:17
I have the same question that I had in the other C
Søren Gjesse
2012/02/06 15:35:49
Yes, Dart_CMessage is gone.
| |
242 } | |
243 | |
244 | |
245 bool DartUtils::PostInteger(Dart_Port port_id, intptr_t value) { | |
246 // Post a message with the integer value. | |
247 intptr_t min = 0xc0000000; // -1073741824 | |
248 intptr_t max = 0x3fffffff; // 1073741823 | |
249 ASSERT(min <= value && value < max); | |
siva
2012/02/04 02:51:17
Would this work on a 64 bit system where value cou
Søren Gjesse
2012/02/06 15:35:49
Changed the method to PostInt32 and with int32_t p
| |
250 Dart_CObject object; | |
251 object.type = Dart_CObject::kInt32; | |
252 object.value.as_int32 = value; | |
253 Dart_CMessage message; | |
254 message.root = &object; | |
255 return Dart_PostCMessage(port_id, &message); | |
256 } | |
OLD | NEW |