OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 * Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
3 * for details. All rights reserved. Use of this source code is governed by a | 3 * for details. All rights reserved. Use of this source code is governed by a |
4 * BSD-style license that can be found in the LICENSE file. | 4 * BSD-style license that can be found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 #ifndef INCLUDE_DART_API_H_ | 7 #ifndef INCLUDE_DART_API_H_ |
8 #define INCLUDE_DART_API_H_ | 8 #define INCLUDE_DART_API_H_ |
9 | 9 |
10 /** \mainpage Dart Embedding API Reference | 10 /** \mainpage Dart Embedding API Reference |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 */ | 361 */ |
362 #define DART_CHECK_VALID(handle) \ | 362 #define DART_CHECK_VALID(handle) \ |
363 { \ | 363 { \ |
364 Dart_Handle __handle = handle; \ | 364 Dart_Handle __handle = handle; \ |
365 if (Dart_IsError((__handle))) { \ | 365 if (Dart_IsError((__handle))) { \ |
366 _Dart_ReportErrorHandle(__FILE__, __LINE__, \ | 366 _Dart_ReportErrorHandle(__FILE__, __LINE__, \ |
367 #handle, Dart_GetError(__handle)); \ | 367 #handle, Dart_GetError(__handle)); \ |
368 } \ | 368 } \ |
369 } \ | 369 } \ |
370 | 370 |
371 | |
372 /** | 371 /** |
373 * Converts an object to a string. | 372 * Converts an object to a string. |
374 * | 373 * |
375 * May generate an unhandled exception error. | 374 * May generate an unhandled exception error. |
376 * | 375 * |
377 * \return The converted string if no error occurs during | 376 * \return The converted string if no error occurs during |
378 * the conversion. If an error does occur, an error handle is | 377 * the conversion. If an error does occur, an error handle is |
379 * returned. | 378 * returned. |
380 */ | 379 */ |
381 DART_EXPORT Dart_Handle Dart_ToString(Dart_Handle object); | 380 DART_EXPORT Dart_Handle Dart_ToString(Dart_Handle object); |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 * instructions, or NULL if no snapshot is provided. | 855 * instructions, or NULL if no snapshot is provided. |
857 * \param create A function to be called during isolate creation. | 856 * \param create A function to be called during isolate creation. |
858 * See Dart_IsolateCreateCallback. | 857 * See Dart_IsolateCreateCallback. |
859 * \param interrupt A function to be called when an isolate is interrupted. | 858 * \param interrupt A function to be called when an isolate is interrupted. |
860 * See Dart_IsolateInterruptCallback. | 859 * See Dart_IsolateInterruptCallback. |
861 * \param unhandled_exception A function to be called if an isolate has an | 860 * \param unhandled_exception A function to be called if an isolate has an |
862 * unhandled exception. Set Dart_IsolateUnhandledExceptionCallback. | 861 * unhandled exception. Set Dart_IsolateUnhandledExceptionCallback. |
863 * \param shutdown A function to be called when an isolate is shutdown. | 862 * \param shutdown A function to be called when an isolate is shutdown. |
864 * See Dart_IsolateShutdownCallback. | 863 * See Dart_IsolateShutdownCallback. |
865 * | 864 * |
866 * \return True if initialization is successful. | 865 * \return NULL if initialization is successful. Returns an error message |
| 866 * otherwise. The caller is responsible for freeing the error message. |
867 */ | 867 */ |
868 DART_EXPORT bool Dart_Initialize( | 868 DART_EXPORT char* Dart_Initialize( |
869 const uint8_t* vm_isolate_snapshot, | 869 const uint8_t* vm_isolate_snapshot, |
870 const uint8_t* instructions_snapshot, | 870 const uint8_t* instructions_snapshot, |
871 Dart_IsolateCreateCallback create, | 871 Dart_IsolateCreateCallback create, |
872 Dart_IsolateInterruptCallback interrupt, | 872 Dart_IsolateInterruptCallback interrupt, |
873 Dart_IsolateUnhandledExceptionCallback unhandled_exception, | 873 Dart_IsolateUnhandledExceptionCallback unhandled_exception, |
874 Dart_IsolateShutdownCallback shutdown, | 874 Dart_IsolateShutdownCallback shutdown, |
875 Dart_FileOpenCallback file_open, | 875 Dart_FileOpenCallback file_open, |
876 Dart_FileReadCallback file_read, | 876 Dart_FileReadCallback file_read, |
877 Dart_FileWriteCallback file_write, | 877 Dart_FileWriteCallback file_write, |
878 Dart_FileCloseCallback file_close, | 878 Dart_FileCloseCallback file_close, |
879 Dart_EntropySource entropy_source); | 879 Dart_EntropySource entropy_source); |
880 | 880 |
881 /** | 881 /** |
882 * Cleanup state in the VM before process termination. | 882 * Cleanup state in the VM before process termination. |
883 * | 883 * |
884 * \return True if cleanup is successful. | 884 * \return NULL if cleanup is successful. Returns an error message otherwise. |
| 885 * The caller is responsible for freeing the error message. |
885 */ | 886 */ |
886 DART_EXPORT bool Dart_Cleanup(); | 887 DART_EXPORT char* Dart_Cleanup(); |
887 | 888 |
888 /** | 889 /** |
889 * Sets command line flags. Should be called before Dart_Initialize. | 890 * Sets command line flags. Should be called before Dart_Initialize. |
890 * | 891 * |
891 * \param argc The length of the arguments array. | 892 * \param argc The length of the arguments array. |
892 * \param argv An array of arguments. | 893 * \param argv An array of arguments. |
893 * | 894 * |
894 * \return True if VM flags set successfully. | 895 * \return True if VM flags set successfully. |
895 */ | 896 */ |
896 DART_EXPORT bool Dart_SetVMFlags(int argc, const char** argv); | 897 DART_EXPORT bool Dart_SetVMFlags(int argc, const char** argv); |
(...skipping 1975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2872 DART_EXPORT Dart_Handle Dart_Precompile(); | 2873 DART_EXPORT Dart_Handle Dart_Precompile(); |
2873 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshot( | 2874 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshot( |
2874 uint8_t** vm_isolate_snapshot_buffer, | 2875 uint8_t** vm_isolate_snapshot_buffer, |
2875 intptr_t* vm_isolate_snapshot_size, | 2876 intptr_t* vm_isolate_snapshot_size, |
2876 uint8_t** isolate_snapshot_buffer, | 2877 uint8_t** isolate_snapshot_buffer, |
2877 intptr_t* isolate_snapshot_size, | 2878 intptr_t* isolate_snapshot_size, |
2878 uint8_t** instructions_snapshot_buffer, | 2879 uint8_t** instructions_snapshot_buffer, |
2879 intptr_t* instructions_snapshot_size); | 2880 intptr_t* instructions_snapshot_size); |
2880 | 2881 |
2881 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ | 2882 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ |
OLD | NEW |