| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 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); |
| 118 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); |
| 119 static void CloseFile(void* stream); | 119 static void CloseFile(void* stream); |
| 120 static bool EntropySource(uint8_t* buffer, intptr_t length); | 120 static bool EntropySource(uint8_t* buffer, intptr_t length); |
| 121 static Dart_Handle ReadStringFromFile(const char* filename); | 121 static Dart_Handle ReadStringFromFile(const char* filename); |
| 122 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, | 122 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, |
| 123 Dart_Handle library, | 123 Dart_Handle library, |
| 124 Dart_Handle url); | 124 Dart_Handle url); |
| 125 static Dart_Handle LoadScript(const char* script_uri, | 125 static Dart_Handle LoadScript(const char* script_uri, |
| 126 Dart_Handle builtin_lib); | 126 Dart_Handle builtin_lib); |
| 127 static void PrepareBuiltinLibrary(Dart_Handle builtin_lib, |
| 128 const char* package_root); |
| 129 static void PrepareCoreLibrary(Dart_Handle builtin_lib); |
| 130 static void PrepareAsyncLibrary(Dart_Handle async_lib, |
| 131 Dart_Handle io_lib); |
| 127 static Dart_Handle PrepareForScriptLoading(const char* package_root, | 132 static Dart_Handle PrepareForScriptLoading(const char* package_root, |
| 128 Dart_Handle builtin_lib); | 133 Dart_Handle builtin_lib); |
| 134 static void SetupIOLibrary(const char* script_uri); |
| 129 | 135 |
| 130 static bool PostNull(Dart_Port port_id); | 136 static bool PostNull(Dart_Port port_id); |
| 131 static bool PostInt32(Dart_Port port_id, int32_t value); | 137 static bool PostInt32(Dart_Port port_id, int32_t value); |
| 132 static bool PostInt64(Dart_Port port_id, int64_t value); | 138 static bool PostInt64(Dart_Port port_id, int64_t value); |
| 133 | 139 |
| 134 static Dart_Handle GetDartType(const char* library_url, | 140 static Dart_Handle GetDartType(const char* library_url, |
| 135 const char* class_name); | 141 const char* class_name); |
| 136 // Create a new Dart OSError object with the current OS error. | 142 // Create a new Dart OSError object with the current OS error. |
| 137 static Dart_Handle NewDartOSError(); | 143 static Dart_Handle NewDartOSError(); |
| 138 // Create a new Dart OSError object with the provided OS error. | 144 // Create a new Dart OSError object with the provided OS error. |
| 139 static Dart_Handle NewDartOSError(OSError* os_error); | 145 static Dart_Handle NewDartOSError(OSError* os_error); |
| 140 static Dart_Handle NewDartExceptionWithOSError(const char* library_url, | 146 static Dart_Handle NewDartExceptionWithOSError(const char* library_url, |
| 141 const char* exception_name, | 147 const char* exception_name, |
| 142 const char* message, | 148 const char* message, |
| 143 Dart_Handle os_error); | 149 Dart_Handle os_error); |
| 144 static Dart_Handle NewDartExceptionWithMessage(const char* library_url, | 150 static Dart_Handle NewDartExceptionWithMessage(const char* library_url, |
| 145 const char* exception_name, | 151 const char* exception_name, |
| 146 const char* message); | 152 const char* message); |
| 147 static Dart_Handle NewDartArgumentError(const char* message); | 153 static Dart_Handle NewDartArgumentError(const char* message); |
| 154 static Dart_Handle NewDartUnsupportedError(const char* message); |
| 148 static Dart_Handle NewDartIOException(const char* exception_name, | 155 static Dart_Handle NewDartIOException(const char* exception_name, |
| 149 const char* message, | 156 const char* message, |
| 150 Dart_Handle os_error); | 157 Dart_Handle os_error); |
| 151 | 158 |
| 152 // Create a new Dart String object from a C String. | 159 // Create a new Dart String object from a C String. |
| 153 static Dart_Handle NewString(const char* str) { | 160 static Dart_Handle NewString(const char* str) { |
| 154 ASSERT(str != NULL); | 161 ASSERT(str != NULL); |
| 155 return Dart_NewStringFromUTF8(reinterpret_cast<const uint8_t*>(str), | 162 return Dart_NewStringFromUTF8(reinterpret_cast<const uint8_t*>(str), |
| 156 strlen(str)); | 163 strlen(str)); |
| 157 } | 164 } |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 | 572 |
| 566 ~ScopedBlockingCall() { | 573 ~ScopedBlockingCall() { |
| 567 Dart_IsolateUnblocked(); | 574 Dart_IsolateUnblocked(); |
| 568 } | 575 } |
| 569 }; | 576 }; |
| 570 | 577 |
| 571 } // namespace bin | 578 } // namespace bin |
| 572 } // namespace dart | 579 } // namespace dart |
| 573 | 580 |
| 574 #endif // BIN_DARTUTILS_H_ | 581 #endif // BIN_DARTUTILS_H_ |
| OLD | NEW |