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 #ifndef BIN_DARTUTILS_H_ | 5 #ifndef BIN_DARTUTILS_H_ |
6 #define BIN_DARTUTILS_H_ | 6 #define BIN_DARTUTILS_H_ |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 #include "include/dart_native_api.h" | 9 #include "include/dart_native_api.h" |
10 | 10 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 const char* name, | 106 const char* name, |
107 int64_t val); | 107 int64_t val); |
108 static void SetStringField(Dart_Handle handle, | 108 static void SetStringField(Dart_Handle handle, |
109 const char* name, | 109 const char* name, |
110 const char* val); | 110 const char* val); |
111 static bool IsDartSchemeURL(const char* url_name); | 111 static bool IsDartSchemeURL(const char* url_name); |
112 static bool IsDartExtensionSchemeURL(const char* url_name); | 112 static bool IsDartExtensionSchemeURL(const char* url_name); |
113 static bool IsDartIOLibURL(const char* url_name); | 113 static bool IsDartIOLibURL(const char* url_name); |
114 static bool IsDartBuiltinLibURL(const char* url_name); | 114 static bool IsDartBuiltinLibURL(const char* url_name); |
115 static bool IsHttpSchemeURL(const char* url_name); | 115 static bool IsHttpSchemeURL(const char* url_name); |
116 static Dart_Handle CanonicalizeURL(CommandLineOptions* url_mapping, | |
117 Dart_Handle library, | |
118 const char* url_str); | |
119 static void* OpenFile(const char* name, bool write); | 116 static void* OpenFile(const char* name, bool write); |
120 static void ReadFile(const uint8_t** data, intptr_t* file_len, void* stream); | 117 static void ReadFile(const uint8_t** data, intptr_t* file_len, void* stream); |
121 static void WriteFile(const void* buffer, intptr_t num_bytes, void* stream); | 118 static void WriteFile(const void* buffer, intptr_t num_bytes, void* stream); |
122 static void CloseFile(void* stream); | 119 static void CloseFile(void* stream); |
123 static bool EntropySource(uint8_t* buffer, intptr_t length); | 120 static bool EntropySource(uint8_t* buffer, intptr_t length); |
124 | 121 |
125 static Dart_Handle ReadStringFromFile(const char* filename); | 122 static Dart_Handle ReadStringFromFile(const char* filename); |
126 static Dart_Handle ReadStringFromHttp(const char* filename); | 123 static Dart_Handle ReadStringFromHttp(const char* filename); |
127 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, | 124 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, |
128 Dart_Handle library, | 125 Dart_Handle library, |
129 Dart_Handle url); | 126 Dart_Handle url); |
130 static Dart_Handle LoadScript(const char* script_uri, | 127 static Dart_Handle LoadScript(const char* script_uri, |
131 Dart_Handle builtin_lib); | 128 Dart_Handle builtin_lib); |
132 static Dart_Handle LoadScriptHttp(Dart_Handle script_uri, | 129 static Dart_Handle LoadScriptHttp(Dart_Handle script_uri, |
133 Dart_Handle builtin_lib); | 130 Dart_Handle builtin_lib); |
134 static Dart_Handle LoadSource(CommandLineOptions* url_mapping, | 131 static Dart_Handle LoadSource(Dart_Handle library, |
135 Dart_Handle library, | |
136 Dart_Handle url, | 132 Dart_Handle url, |
137 Dart_LibraryTag tag, | 133 Dart_LibraryTag tag, |
138 const char* filename); | 134 const char* filename); |
139 static Dart_Handle PrepareForScriptLoading(const char* package_root, | 135 static Dart_Handle PrepareForScriptLoading(const char* package_root, |
140 Dart_Handle builtin_lib); | 136 Dart_Handle builtin_lib); |
141 | 137 |
142 static bool PostNull(Dart_Port port_id); | 138 static bool PostNull(Dart_Port port_id); |
143 static bool PostInt32(Dart_Port port_id, int32_t value); | 139 static bool PostInt32(Dart_Port port_id, int32_t value); |
144 static bool PostInt64(Dart_Port port_id, int64_t value); | 140 static bool PostInt64(Dart_Port port_id, int64_t value); |
145 | 141 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 static const char* kIsolateLibURL; | 212 static const char* kIsolateLibURL; |
217 static const char* kIOLibURL; | 213 static const char* kIOLibURL; |
218 static const char* kIOLibPatchURL; | 214 static const char* kIOLibPatchURL; |
219 static const char* kUriLibURL; | 215 static const char* kUriLibURL; |
220 static const char* kHttpScheme; | 216 static const char* kHttpScheme; |
221 static const char* kVMServiceLibURL; | 217 static const char* kVMServiceLibURL; |
222 | 218 |
223 static uint8_t magic_number[]; | 219 static uint8_t magic_number[]; |
224 | 220 |
225 private: | 221 private: |
226 static const char* GetCanonicalPath(const char* reference_dir, | |
227 const char* filename); | |
228 | |
229 DISALLOW_ALLOCATION(); | 222 DISALLOW_ALLOCATION(); |
230 DISALLOW_IMPLICIT_CONSTRUCTORS(DartUtils); | 223 DISALLOW_IMPLICIT_CONSTRUCTORS(DartUtils); |
231 }; | 224 }; |
232 | 225 |
233 | 226 |
234 class CObject { | 227 class CObject { |
235 public: | 228 public: |
236 // These match the constants in sdk/lib/io/common.dart. | 229 // These match the constants in sdk/lib/io/common.dart. |
237 static const int kSuccess = 0; | 230 static const int kSuccess = 0; |
238 static const int kArgumentError = 1; | 231 static const int kArgumentError = 1; |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 } | 536 } |
544 | 537 |
545 private: | 538 private: |
546 DISALLOW_COPY_AND_ASSIGN(CObjectExternalUint8Array); | 539 DISALLOW_COPY_AND_ASSIGN(CObjectExternalUint8Array); |
547 }; | 540 }; |
548 | 541 |
549 } // namespace bin | 542 } // namespace bin |
550 } // namespace dart | 543 } // namespace dart |
551 | 544 |
552 #endif // BIN_DARTUTILS_H_ | 545 #endif // BIN_DARTUTILS_H_ |
OLD | NEW |