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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 static void ReadFile(const uint8_t** data, intptr_t* file_len, void* stream); | 115 static void ReadFile(const uint8_t** data, intptr_t* file_len, void* stream); |
116 static void WriteFile(const void* buffer, intptr_t num_bytes, void* stream); | 116 static void WriteFile(const void* buffer, intptr_t num_bytes, void* stream); |
117 static void CloseFile(void* stream); | 117 static void CloseFile(void* stream); |
118 static Dart_Handle ReadStringFromFile(const char* filename); | 118 static Dart_Handle ReadStringFromFile(const char* filename); |
119 static Dart_Handle ReadStringFromHttp(const char* filename); | 119 static Dart_Handle ReadStringFromHttp(const char* filename); |
120 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, | 120 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, |
121 Dart_Handle library, | 121 Dart_Handle library, |
122 Dart_Handle url); | 122 Dart_Handle url); |
123 static Dart_Handle LoadScript(const char* script_uri, | 123 static Dart_Handle LoadScript(const char* script_uri, |
124 Dart_Handle builtin_lib); | 124 Dart_Handle builtin_lib); |
125 static Dart_Handle LoadScriptHttp(Dart_Handle uri, | 125 static Dart_Handle LoadScriptHttp(Dart_Handle script_uri, |
126 Dart_Handle builtin_lib); | 126 Dart_Handle builtin_lib); |
127 static Dart_Handle LoadSource(CommandLineOptions* url_mapping, | 127 static Dart_Handle LoadSource(CommandLineOptions* url_mapping, |
128 Dart_Handle library, | 128 Dart_Handle library, |
129 Dart_Handle url, | 129 Dart_Handle url, |
130 Dart_LibraryTag tag, | 130 Dart_LibraryTag tag, |
131 const char* filename); | 131 const char* filename); |
132 static Dart_Handle PrepareForScriptLoading(const char* package_root, | 132 static Dart_Handle PrepareForScriptLoading(const char* package_root, |
133 Dart_Handle builtin_lib); | 133 Dart_Handle builtin_lib); |
134 | 134 |
135 static bool PostNull(Dart_Port port_id); | 135 static bool PostNull(Dart_Port port_id); |
(...skipping 20 matching lines...) Expand all Loading... |
156 } | 156 } |
157 | 157 |
158 // Create a new Dart InternalError object with the provided message. | 158 // Create a new Dart InternalError object with the provided message. |
159 static Dart_Handle NewInternalError(const char* message); | 159 static Dart_Handle NewInternalError(const char* message); |
160 | 160 |
161 static void SetOriginalWorkingDirectory(); | 161 static void SetOriginalWorkingDirectory(); |
162 | 162 |
163 static const char* MapLibraryUrl(CommandLineOptions* url_mapping, | 163 static const char* MapLibraryUrl(CommandLineOptions* url_mapping, |
164 const char* url_string); | 164 const char* url_string); |
165 | 165 |
166 static Dart_Handle SetWorkingDirectory(Dart_Handle builtin_lib); | |
167 | |
168 static Dart_Handle ResolveScriptUri(Dart_Handle script_uri, | 166 static Dart_Handle ResolveScriptUri(Dart_Handle script_uri, |
169 Dart_Handle builtin_lib); | 167 Dart_Handle builtin_lib); |
170 | 168 |
171 static Dart_Handle FilePathFromUri(Dart_Handle script_uri, | 169 static Dart_Handle FilePathFromUri(Dart_Handle script_uri, |
172 Dart_Handle builtin_lib); | 170 Dart_Handle builtin_lib); |
173 | 171 |
174 static Dart_Handle PathFromUri(Dart_Handle script_uri, | |
175 Dart_Handle builtin_lib); | |
176 | |
177 static Dart_Handle HostFromUri(Dart_Handle script_uri, | |
178 Dart_Handle builtin_lib); | |
179 | |
180 static Dart_Handle PortFromUri(Dart_Handle script_uri, | |
181 Dart_Handle builtin_lib); | |
182 | |
183 static Dart_Handle ResolveUri(Dart_Handle library_url, | 172 static Dart_Handle ResolveUri(Dart_Handle library_url, |
184 Dart_Handle url, | 173 Dart_Handle url, |
185 Dart_Handle builtin_lib); | 174 Dart_Handle builtin_lib); |
186 | 175 |
187 // Sniffs the specified text_buffer to see if it contains the magic number | 176 // Sniffs the specified text_buffer to see if it contains the magic number |
188 // representing a script snapshot. If the text_buffer is a script snapshot | 177 // representing a script snapshot. If the text_buffer is a script snapshot |
189 // the return value is an updated pointer to the text_buffer pointing past | 178 // the return value is an updated pointer to the text_buffer pointing past |
190 // the magic number value. The 'buffer_len' parameter is also appropriately | 179 // the magic number value. The 'buffer_len' parameter is also appropriately |
191 // adjusted. | 180 // adjusted. |
192 static const uint8_t* SniffForMagicNumber(const uint8_t* text_buffer, | 181 static const uint8_t* SniffForMagicNumber(const uint8_t* text_buffer, |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 } | 508 } |
520 | 509 |
521 private: | 510 private: |
522 DISALLOW_COPY_AND_ASSIGN(CObjectExternalUint8Array); | 511 DISALLOW_COPY_AND_ASSIGN(CObjectExternalUint8Array); |
523 }; | 512 }; |
524 | 513 |
525 } // namespace bin | 514 } // namespace bin |
526 } // namespace dart | 515 } // namespace dart |
527 | 516 |
528 #endif // BIN_DARTUTILS_H_ | 517 #endif // BIN_DARTUTILS_H_ |
OLD | NEW |