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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 DART_EXPORT void Dart_ShutdownIsolate(); | 528 DART_EXPORT void Dart_ShutdownIsolate(); |
529 // TODO(turnidge): Document behavior when there is no current isolate. | 529 // TODO(turnidge): Document behavior when there is no current isolate. |
530 | 530 |
531 /** | 531 /** |
532 * Returns the current isolate. Will return NULL if there is no | 532 * Returns the current isolate. Will return NULL if there is no |
533 * current isolate. | 533 * current isolate. |
534 */ | 534 */ |
535 DART_EXPORT Dart_Isolate Dart_CurrentIsolate(); | 535 DART_EXPORT Dart_Isolate Dart_CurrentIsolate(); |
536 | 536 |
537 /** | 537 /** |
| 538 * Returns the debugging name for the current isolate. |
| 539 * |
| 540 * This name is unique to each isolate and should only be used to make |
| 541 * debugging messages more comprehensible. |
| 542 */ |
| 543 DART_EXPORT Dart_Handle Dart_DebugName(); |
| 544 |
| 545 /** |
538 * Enters an isolate. After calling this function, | 546 * Enters an isolate. After calling this function, |
539 * the current isolate will be set to the provided isolate. | 547 * the current isolate will be set to the provided isolate. |
540 * | 548 * |
541 * Requires there to be no current isolate. | 549 * Requires there to be no current isolate. |
542 */ | 550 */ |
543 DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate); | 551 DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate); |
544 // TODO(turnidge): Describe what happens if two threads attempt to | 552 // TODO(turnidge): Describe what happens if two threads attempt to |
545 // enter the same isolate simultaneously. Check for this in the code. | 553 // enter the same isolate simultaneously. Check for this in the code. |
546 // Describe whether isolates are allowed to migrate. | 554 // Describe whether isolates are allowed to migrate. |
547 | 555 |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 | 1115 |
1108 /** | 1116 /** |
1109 * Returns a String built from the provided C string | 1117 * Returns a String built from the provided C string |
1110 * | 1118 * |
1111 * \param value A C String | 1119 * \param value A C String |
1112 * | 1120 * |
1113 * \return The String object if no error occurs. Otherwise returns | 1121 * \return The String object if no error occurs. Otherwise returns |
1114 * an error handle. | 1122 * an error handle. |
1115 */ | 1123 */ |
1116 DART_EXPORT Dart_Handle Dart_NewString(const char* str); | 1124 DART_EXPORT Dart_Handle Dart_NewString(const char* str); |
| 1125 // TODO(turnidge): Document what happens when we run out of memory |
| 1126 // during this call. |
1117 | 1127 |
1118 /** | 1128 /** |
1119 * Returns a String built from an array of 8-bit codepoints. | 1129 * Returns a String built from an array of 8-bit codepoints. |
1120 * | 1130 * |
1121 * \param value An array of 8-bit codepoints. | 1131 * \param value An array of 8-bit codepoints. |
1122 * \param length The length of the codepoints array. | 1132 * \param length The length of the codepoints array. |
1123 * | 1133 * |
1124 * \return The String object if no error occurs. Otherwise returns | 1134 * \return The String object if no error occurs. Otherwise returns |
1125 * an error handle. | 1135 * an error handle. |
1126 */ | 1136 */ |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1780 * \param arguments An array of arguments to the function. | 1790 * \param arguments An array of arguments to the function. |
1781 * | 1791 * |
1782 * \return If the function or method is called and completes | 1792 * \return If the function or method is called and completes |
1783 * successfully, then the return value is returned. If an error | 1793 * successfully, then the return value is returned. If an error |
1784 * occurs during execution, then an error handle is returned. | 1794 * occurs during execution, then an error handle is returned. |
1785 */ | 1795 */ |
1786 DART_EXPORT Dart_Handle Dart_Invoke(Dart_Handle target, | 1796 DART_EXPORT Dart_Handle Dart_Invoke(Dart_Handle target, |
1787 Dart_Handle name, | 1797 Dart_Handle name, |
1788 int number_of_arguments, | 1798 int number_of_arguments, |
1789 Dart_Handle* arguments); | 1799 Dart_Handle* arguments); |
| 1800 // TODO(turnidge): Document how to invoke operators. |
1790 | 1801 |
1791 /** | 1802 /** |
1792 * Gets the value of a field. | 1803 * Gets the value of a field. |
1793 * | 1804 * |
1794 * The 'container' parameter may be an object, class, or library. If | 1805 * The 'container' parameter may be an object, class, or library. If |
1795 * 'container' is an object, then this function will access an | 1806 * 'container' is an object, then this function will access an |
1796 * instance field. If 'container' is a class, then this function will | 1807 * instance field. If 'container' is a class, then this function will |
1797 * access a static field. If 'container' is a library, then this | 1808 * access a static field. If 'container' is a library, then this |
1798 * function will access a top-level variable. | 1809 * function will access a top-level variable. |
1799 * | 1810 * |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1836 /** | 1847 /** |
1837 * Creates a native wrapper class. | 1848 * Creates a native wrapper class. |
1838 * | 1849 * |
1839 * TODO(turnidge): Document. | 1850 * TODO(turnidge): Document. |
1840 */ | 1851 */ |
1841 DART_EXPORT Dart_Handle Dart_CreateNativeWrapperClass(Dart_Handle library, | 1852 DART_EXPORT Dart_Handle Dart_CreateNativeWrapperClass(Dart_Handle library, |
1842 Dart_Handle class_name, | 1853 Dart_Handle class_name, |
1843 int field_count); | 1854 int field_count); |
1844 | 1855 |
1845 /** | 1856 /** |
| 1857 * Gets the number of native instance fields in an object. |
| 1858 */ |
| 1859 DART_EXPORT Dart_Handle Dart_GetNativeInstanceFieldCount(Dart_Handle obj, |
| 1860 int* count); |
| 1861 |
| 1862 /** |
1846 * Gets the value of a native field. | 1863 * Gets the value of a native field. |
1847 * | 1864 * |
1848 * TODO(turnidge): Document. | 1865 * TODO(turnidge): Document. |
1849 */ | 1866 */ |
1850 DART_EXPORT Dart_Handle Dart_GetNativeInstanceField(Dart_Handle obj, | 1867 DART_EXPORT Dart_Handle Dart_GetNativeInstanceField(Dart_Handle obj, |
1851 int index, | 1868 int index, |
1852 intptr_t* value); | 1869 intptr_t* value); |
1853 /** | 1870 /** |
1854 * Sets the value of a native field. | 1871 * Sets the value of a native field. |
1855 * | 1872 * |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2009 * \param buffer A buffer which contains a snapshot of the script. | 2026 * \param buffer A buffer which contains a snapshot of the script. |
2010 * | 2027 * |
2011 * \return If no error occurs, the Library object corresponding to the root | 2028 * \return If no error occurs, the Library object corresponding to the root |
2012 * script is returned. Otherwise an error handle is returned. | 2029 * script is returned. Otherwise an error handle is returned. |
2013 */ | 2030 */ |
2014 DART_EXPORT Dart_Handle Dart_LoadScriptFromSnapshot(const uint8_t* buffer); | 2031 DART_EXPORT Dart_Handle Dart_LoadScriptFromSnapshot(const uint8_t* buffer); |
2015 | 2032 |
2016 /** | 2033 /** |
2017 * Gets the library for the root script for the current isolate. | 2034 * Gets the library for the root script for the current isolate. |
2018 * | 2035 * |
2019 * \return Returns the Library object corresponding to the root script | 2036 * If the root script has not yet been set for the current isolate, |
2020 * if it has been set by a successful call to Dart_LoadScript or | 2037 * this function returns Dart_Null(). This function never returns an |
2021 * Dart_LoadScriptFromSnapshot. Otherwise returns Dart_Null(). | 2038 * error handle. |
| 2039 * |
| 2040 * \return Returns the root Library for the current isolate or Dart_Null(). |
2022 */ | 2041 */ |
2023 DART_EXPORT Dart_Handle Dart_RootLibrary(); | 2042 DART_EXPORT Dart_Handle Dart_RootLibrary(); |
2024 | 2043 |
2025 /** | 2044 /** |
2026 * Forces all loaded classes and functions to be compiled eagerly in | 2045 * Forces all loaded classes and functions to be compiled eagerly in |
2027 * the current isolate.. | 2046 * the current isolate.. |
2028 * | 2047 * |
2029 * TODO(turnidge): Document. | 2048 * TODO(turnidge): Document. |
2030 */ | 2049 */ |
2031 DART_EXPORT Dart_Handle Dart_CompileAll(); | 2050 DART_EXPORT Dart_Handle Dart_CompileAll(); |
(...skipping 10 matching lines...) Expand all Loading... |
2042 * \param class_name The name of the class or interface. | 2061 * \param class_name The name of the class or interface. |
2043 * | 2062 * |
2044 * \return If no error occurs, the class or interface is | 2063 * \return If no error occurs, the class or interface is |
2045 * returned. Otherwise an error handle is returned. | 2064 * returned. Otherwise an error handle is returned. |
2046 */ | 2065 */ |
2047 DART_EXPORT Dart_Handle Dart_GetClass(Dart_Handle library, | 2066 DART_EXPORT Dart_Handle Dart_GetClass(Dart_Handle library, |
2048 Dart_Handle class_name); | 2067 Dart_Handle class_name); |
2049 // TODO(turnidge): Consider returning Dart_Null() when the class is | 2068 // TODO(turnidge): Consider returning Dart_Null() when the class is |
2050 // not found to distinguish that from a true error case. | 2069 // not found to distinguish that from a true error case. |
2051 | 2070 |
| 2071 /** |
| 2072 * Returns the name of a library as declared in the #library directive. |
| 2073 */ |
| 2074 DART_EXPORT Dart_Handle Dart_LibraryName(Dart_Handle library); |
| 2075 |
| 2076 /** |
| 2077 * Returns the url from which a library was loaded. |
| 2078 */ |
2052 DART_EXPORT Dart_Handle Dart_LibraryUrl(Dart_Handle library); | 2079 DART_EXPORT Dart_Handle Dart_LibraryUrl(Dart_Handle library); |
2053 | 2080 |
2054 DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url); | 2081 DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url); |
2055 // TODO(turnidge): Consider returning Dart_Null() when the library is | 2082 // TODO(turnidge): Consider returning Dart_Null() when the library is |
2056 // not found to distinguish that from a true error case. | 2083 // not found to distinguish that from a true error case. |
2057 | 2084 |
2058 DART_EXPORT Dart_Handle Dart_LoadLibrary(Dart_Handle url, | 2085 DART_EXPORT Dart_Handle Dart_LoadLibrary(Dart_Handle url, |
2059 Dart_Handle source); | 2086 Dart_Handle source); |
2060 | 2087 |
2061 | 2088 |
(...skipping 20 matching lines...) Expand all Loading... |
2082 | 2109 |
2083 // --- Profiling support ---- | 2110 // --- Profiling support ---- |
2084 | 2111 |
2085 // External pprof support for gathering and dumping symbolic | 2112 // External pprof support for gathering and dumping symbolic |
2086 // information that can be used for better profile reports for | 2113 // information that can be used for better profile reports for |
2087 // dynamically generated code. | 2114 // dynamically generated code. |
2088 DART_EXPORT void Dart_InitPprofSupport(); | 2115 DART_EXPORT void Dart_InitPprofSupport(); |
2089 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); | 2116 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); |
2090 | 2117 |
2091 #endif // INCLUDE_DART_API_H_ | 2118 #endif // INCLUDE_DART_API_H_ |
OLD | NEW |