| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 INCLUDE_DART_API_H_ | 5 #ifndef INCLUDE_DART_API_H_ |
| 6 #define INCLUDE_DART_API_H_ | 6 #define INCLUDE_DART_API_H_ |
| 7 | 7 |
| 8 #ifdef __cplusplus | 8 #ifdef __cplusplus |
| 9 #define DART_EXTERN_C extern "C" | 9 #define DART_EXTERN_C extern "C" |
| 10 #else | 10 #else |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 typedef void (*Dart_NativeFunction)(Dart_NativeArguments arguments); | 73 typedef void (*Dart_NativeFunction)(Dart_NativeArguments arguments); |
| 74 typedef Dart_NativeFunction (*Dart_NativeEntryResolver)(Dart_Handle name, | 74 typedef Dart_NativeFunction (*Dart_NativeEntryResolver)(Dart_Handle name, |
| 75 int num_of_arguments); | 75 int num_of_arguments); |
| 76 typedef Dart_Handle (*Dart_LibraryTagHandler)(Dart_LibraryTag tag, | 76 typedef Dart_Handle (*Dart_LibraryTagHandler)(Dart_LibraryTag tag, |
| 77 Dart_Handle library, | 77 Dart_Handle library, |
| 78 Dart_Handle url); | 78 Dart_Handle url); |
| 79 | 79 |
| 80 // TODO(iposva): This is a placeholder for the eventual external Dart API. | 80 // TODO(iposva): This is a placeholder for the eventual external Dart API. |
| 81 | 81 |
| 82 // Return value handling after a Dart API call. | 82 // Returns true if 'handle' is valid and false if invalid. |
| 83 DART_EXPORT bool Dart_IsValid(const Dart_Handle& result); | 83 DART_EXPORT bool Dart_IsValid(const Dart_Handle& handle); |
| 84 | 84 |
| 85 DART_EXPORT const char* Dart_GetError(const Dart_Handle& result); | 85 // Internal routine used for reporting invalid handles. |
| 86 DART_EXPORT Dart_Handle Dart_Error(const char* value); | 86 DART_EXPORT void _Dart_ReportInvalidHandle(const char* file, |
| 87 int line, |
| 88 const char* handle_string, |
| 89 const char* error); |
| 87 | 90 |
| 91 // Aborts the process if 'handle' is invalid. |
| 92 #define DART_CHECK_VALID(handle) \ |
| 93 if (!Dart_IsValid((handle))) { \ |
| 94 _Dart_ReportInvalidHandle(__FILE__, __LINE__, \ |
| 95 #handle, Dart_GetError(handle)); \ |
| 96 } |
| 97 |
| 98 // Gets the error message associated with an invalid handle. |
| 99 DART_EXPORT const char* Dart_GetError(const Dart_Handle& handle); |
| 100 |
| 101 // Produces an invalid handle with an associated error message |
| 102 DART_EXPORT Dart_Handle Dart_Error(const char* error); |
| 88 | 103 |
| 89 // Initialize the VM with commmand line flags. | 104 // Initialize the VM with commmand line flags. |
| 90 DART_EXPORT bool Dart_Initialize(int argc, char** argv, | 105 DART_EXPORT bool Dart_Initialize(int argc, char** argv, |
| 91 Dart_IsolateInitCallback callback); | 106 Dart_IsolateInitCallback callback); |
| 92 | 107 |
| 93 | 108 |
| 94 // Isolate handling. | 109 // Isolate handling. |
| 95 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const Dart_Snapshot* snapshot, | 110 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const Dart_Snapshot* snapshot, |
| 96 void* data); | 111 void* data); |
| 97 DART_EXPORT void Dart_ShutdownIsolate(); | 112 DART_EXPORT void Dart_ShutdownIsolate(); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 // External pprof support for gathering and dumping symbolic information | 378 // External pprof support for gathering and dumping symbolic information |
| 364 // that can be used for better profile reports for dynamically generated | 379 // that can be used for better profile reports for dynamically generated |
| 365 // code. | 380 // code. |
| 366 DART_EXPORT void Dart_InitPprofSupport(); | 381 DART_EXPORT void Dart_InitPprofSupport(); |
| 367 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); | 382 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); |
| 368 | 383 |
| 369 // Check set vm flags. | 384 // Check set vm flags. |
| 370 DART_EXPORT bool Dart_IsVMFlagSet(const char* flag_name); | 385 DART_EXPORT bool Dart_IsVMFlagSet(const char* flag_name); |
| 371 | 386 |
| 372 #endif // INCLUDE_DART_API_H_ | 387 #endif // INCLUDE_DART_API_H_ |
| OLD | NEW |