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 "include/dart_api.h" |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "platform/globals.h" | 10 #include "platform/globals.h" |
11 | 11 |
12 const char* DartUtils::kDartScheme = "dart:"; | 12 const char* DartUtils::kDartScheme = "dart:"; |
13 const char* DartUtils::kDartExtensionScheme = "dartext:"; | |
Mads Ager (google)
2012/02/23 09:26:56
Should we make this "dart-ext:"?
| |
13 const char* DartUtils::kBuiltinLibURL = "dart:builtin"; | 14 const char* DartUtils::kBuiltinLibURL = "dart:builtin"; |
14 const char* DartUtils::kCoreLibURL = "dart:core"; | 15 const char* DartUtils::kCoreLibURL = "dart:core"; |
15 const char* DartUtils::kCoreImplLibURL = "dart:coreimpl"; | 16 const char* DartUtils::kCoreImplLibURL = "dart:coreimpl"; |
16 const char* DartUtils::kIOLibURL = "dart:io"; | 17 const char* DartUtils::kIOLibURL = "dart:io"; |
17 const char* DartUtils::kJsonLibURL = "dart:json"; | 18 const char* DartUtils::kJsonLibURL = "dart:json"; |
18 const char* DartUtils::kUriLibURL = "dart:uri"; | 19 const char* DartUtils::kUriLibURL = "dart:uri"; |
19 const char* DartUtils::kUtf8LibURL = "dart:utf8"; | 20 const char* DartUtils::kUtf8LibURL = "dart:utf8"; |
20 | 21 |
21 | 22 |
22 const char* DartUtils::kIdFieldName = "_id"; | 23 const char* DartUtils::kIdFieldName = "_id"; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 | 98 |
98 | 99 |
99 bool DartUtils::IsDartSchemeURL(const char* url_name) { | 100 bool DartUtils::IsDartSchemeURL(const char* url_name) { |
100 static const intptr_t kDartSchemeLen = strlen(kDartScheme); | 101 static const intptr_t kDartSchemeLen = strlen(kDartScheme); |
101 // If the URL starts with "dart:" then it is considered as a special | 102 // If the URL starts with "dart:" then it is considered as a special |
102 // library URL which is handled differently from other URLs. | 103 // library URL which is handled differently from other URLs. |
103 return (strncmp(url_name, kDartScheme, kDartSchemeLen) == 0); | 104 return (strncmp(url_name, kDartScheme, kDartSchemeLen) == 0); |
104 } | 105 } |
105 | 106 |
106 | 107 |
108 bool DartUtils::IsDartExtensionSchemeURL(const char* url_name) { | |
109 static const intptr_t kDartExtensionSchemeLen = strlen(kDartExtensionScheme); | |
110 // If the URL starts with "dartext:" then it is considered as a special | |
111 // extension library URL which is handled differently from other URLs. | |
112 return | |
113 (strncmp(url_name, kDartExtensionScheme, kDartExtensionSchemeLen) == 0); | |
114 } | |
115 | |
116 | |
107 bool DartUtils::IsDartIOLibURL(const char* url_name) { | 117 bool DartUtils::IsDartIOLibURL(const char* url_name) { |
108 return (strcmp(url_name, kIOLibURL) == 0); | 118 return (strcmp(url_name, kIOLibURL) == 0); |
109 } | 119 } |
110 | 120 |
111 | 121 |
112 bool DartUtils::IsDartJsonLibURL(const char* url_name) { | 122 bool DartUtils::IsDartJsonLibURL(const char* url_name) { |
113 return (strcmp(url_name, kJsonLibURL) == 0); | 123 return (strcmp(url_name, kJsonLibURL) == 0); |
114 } | 124 } |
115 | 125 |
116 | 126 |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
345 | 355 |
346 | 356 |
347 Dart_CObject* CObject::NewArray(int length) { | 357 Dart_CObject* CObject::NewArray(int length) { |
348 Dart_CObject* cobject = | 358 Dart_CObject* cobject = |
349 New(Dart_CObject::kArray, length * sizeof(Dart_CObject*)); // NOLINT | 359 New(Dart_CObject::kArray, length * sizeof(Dart_CObject*)); // NOLINT |
350 cobject->value.as_array.length = length; | 360 cobject->value.as_array.length = length; |
351 cobject->value.as_array.values = | 361 cobject->value.as_array.values = |
352 reinterpret_cast<Dart_CObject**>(cobject + 1); | 362 reinterpret_cast<Dart_CObject**>(cobject + 1); |
353 return cobject; | 363 return cobject; |
354 } | 364 } |
OLD | NEW |