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 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 /** \mainpage Dart Embedding API Reference | 8 /** \mainpage Dart Embedding API Reference |
9 * | 9 * |
10 * Dart is a class-based programming language for creating structured | 10 * Dart is a class-based programming language for creating structured |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 * | 639 * |
640 * This function should be used to dispose of native resources that | 640 * This function should be used to dispose of native resources that |
641 * are allocated to an isolate in order to avoid leaks. | 641 * are allocated to an isolate in order to avoid leaks. |
642 * | 642 * |
643 * \param callback_data The same callback data which was passed to the | 643 * \param callback_data The same callback data which was passed to the |
644 * isolate when it was created. | 644 * isolate when it was created. |
645 * | 645 * |
646 */ | 646 */ |
647 typedef void (*Dart_IsolateShutdownCallback)(void* callback_data); | 647 typedef void (*Dart_IsolateShutdownCallback)(void* callback_data); |
648 | 648 |
649 /** | 649 typedef void* (*Dart_FileOpenCallback)(const char* name); |
650 * Callbacks provided by the embedder for file operations. If the | |
651 * embedder does not allow file operations these callbacks can be | |
652 * NULL. | |
653 * | |
654 * Dart_FileOpenCallback - opens a file for reading or writing. | |
655 * \param name The name of the file to open. | |
656 * \param write A boolean variable which indicates if the file is to | |
657 * opened for writing. If there is an existing file it needs to truncated. | |
658 * | |
659 * Dart_FileReadCallback - Read contents of file. | |
660 * \param data Buffer allocated in the callback into which the contents | |
661 * of the file are read into. It is the responsibility of the caller to | |
662 * free this buffer. | |
663 * \param file_length A variable into which the length of the file is returned. | |
664 * In the case of an error this value would be -1. | |
665 * \param stream Handle to the opened file. | |
666 * | |
667 * Dart_FileWriteCallback - Write data into file. | |
668 * \param data Buffer which needs to be written into the file. | |
669 * \param length Length of the buffer. | |
670 * \param stream Handle to the opened file. | |
671 * | |
672 * Dart_FileCloseCallback - Closes the opened file. | |
673 * \param stream Handle to the opened file. | |
674 * | |
675 */ | |
676 typedef void* (*Dart_FileOpenCallback)(const char* name, bool write); | |
677 | |
678 typedef void (*Dart_FileReadCallback)(const uint8_t** data, | |
679 intptr_t* file_length, | |
680 void* stream); | |
681 | 650 |
682 typedef void (*Dart_FileWriteCallback)(const void* data, | 651 typedef void (*Dart_FileWriteCallback)(const void* data, |
683 intptr_t length, | 652 intptr_t length, |
684 void* stream); | 653 void* stream); |
685 | 654 |
686 typedef void (*Dart_FileCloseCallback)(void* stream); | 655 typedef void (*Dart_FileCloseCallback)(void* stream); |
687 | 656 |
688 | 657 |
689 /** | 658 /** |
690 * Initializes the VM. | 659 * Initializes the VM. |
691 * | 660 * |
692 * \param create A function to be called during isolate creation. | 661 * \param create A function to be called during isolate creation. |
693 * See Dart_IsolateCreateCallback. | 662 * See Dart_IsolateCreateCallback. |
694 * \param interrupt A function to be called when an isolate is interrupted. | 663 * \param interrupt A function to be called when an isolate is interrupted. |
695 * See Dart_IsolateInterruptCallback. | 664 * See Dart_IsolateInterruptCallback. |
696 * \param unhandled_exception A function to be called if an isolate has an | 665 * \param unhandled_exception A function to be called if an isolate has an |
697 * unhandled exception. Set Dart_IsolateUnhandledExceptionCallback. | 666 * unhandled exception. Set Dart_IsolateUnhandledExceptionCallback. |
698 * \param shutdown A function to be called when an isolate is shutdown. | 667 * \param shutdown A function to be called when an isolate is shutdown. |
699 * See Dart_IsolateShutdownCallback. | 668 * See Dart_IsolateShutdownCallback. |
700 * | 669 * |
701 * \return True if initialization is successful. | 670 * \return True if initialization is successful. |
702 */ | 671 */ |
703 DART_EXPORT bool Dart_Initialize( | 672 DART_EXPORT bool Dart_Initialize( |
704 Dart_IsolateCreateCallback create, | 673 Dart_IsolateCreateCallback create, |
705 Dart_IsolateInterruptCallback interrupt, | 674 Dart_IsolateInterruptCallback interrupt, |
706 Dart_IsolateUnhandledExceptionCallback unhandled_exception, | 675 Dart_IsolateUnhandledExceptionCallback unhandled_exception, |
707 Dart_IsolateShutdownCallback shutdown, | 676 Dart_IsolateShutdownCallback shutdown, |
708 Dart_FileOpenCallback file_open, | 677 Dart_FileOpenCallback file_open, |
709 Dart_FileReadCallback file_read, | |
710 Dart_FileWriteCallback file_write, | 678 Dart_FileWriteCallback file_write, |
711 Dart_FileCloseCallback file_close); | 679 Dart_FileCloseCallback file_close); |
712 | 680 |
713 /** | 681 /** |
714 * Sets command line flags. Should be called before Dart_Initialize. | 682 * Sets command line flags. Should be called before Dart_Initialize. |
715 * | 683 * |
716 * \param argc The length of the arguments array. | 684 * \param argc The length of the arguments array. |
717 * \param argv An array of arguments. | 685 * \param argv An array of arguments. |
718 * | 686 * |
719 * \return True if VM flags set successfully. | 687 * \return True if VM flags set successfully. |
(...skipping 1915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2635 * | 2603 * |
2636 * \param object An object. | 2604 * \param object An object. |
2637 * \param peer A value to store in the peer field. | 2605 * \param peer A value to store in the peer field. |
2638 * | 2606 * |
2639 * \return Returns an error if 'object' is a subtype of Null, num, or | 2607 * \return Returns an error if 'object' is a subtype of Null, num, or |
2640 * bool. | 2608 * bool. |
2641 */ | 2609 */ |
2642 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer); | 2610 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer); |
2643 | 2611 |
2644 #endif // INCLUDE_DART_API_H_ | 2612 #endif // INCLUDE_DART_API_H_ |
OLD | NEW |