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 2004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2015 | 2015 |
2016 /** | 2016 /** |
2017 * Returns the interface at some index in the list of interfaces some | 2017 * Returns the interface at some index in the list of interfaces some |
2018 * class or inteface. | 2018 * class or inteface. |
2019 * | 2019 * |
2020 * TODO(turnidge): Finish documentation. | 2020 * TODO(turnidge): Finish documentation. |
2021 */ | 2021 */ |
2022 DART_EXPORT Dart_Handle Dart_ClassGetInterfaceAt(Dart_Handle clazz, | 2022 DART_EXPORT Dart_Handle Dart_ClassGetInterfaceAt(Dart_Handle clazz, |
2023 intptr_t index); | 2023 intptr_t index); |
2024 | 2024 |
| 2025 // --- Function and Variable Declarations --- |
| 2026 |
| 2027 /** |
| 2028 * Returns a list of the names of all functions or methods declared in |
| 2029 * a library or class. |
| 2030 * |
| 2031 * \param target A library or class. |
| 2032 * |
| 2033 * \return If no error occurs, a list of strings is returned. |
| 2034 * Otherwise an erorr handle is returned. |
| 2035 */ |
| 2036 DART_EXPORT Dart_Handle Dart_GetFunctionNames(Dart_Handle target); |
| 2037 |
| 2038 /** |
| 2039 * Looks up a function or method declaration by name from a library or |
| 2040 * class. |
| 2041 * |
| 2042 * \param target The library or class containing the function. |
| 2043 * \param function_name The name of the function. |
| 2044 * |
| 2045 * \return If an error is encountered, returns an error handle. |
| 2046 * Otherwise returns a function handle if the function is found of |
| 2047 * Dart_Null() if the function is not found. |
| 2048 */ |
| 2049 DART_EXPORT Dart_Handle Dart_LookupFunction(Dart_Handle target, |
| 2050 Dart_Handle function_name); |
| 2051 |
| 2052 /** |
| 2053 * Is this a function or method declaration handle? |
| 2054 */ |
| 2055 DART_EXPORT bool Dart_IsFunction(Dart_Handle handle); |
| 2056 |
| 2057 /** |
| 2058 * Returns the name for the provided function or method. |
| 2059 * |
| 2060 * \return A valid string handle if no error occurs during the |
| 2061 * operation. |
| 2062 */ |
| 2063 DART_EXPORT Dart_Handle Dart_FunctionName(Dart_Handle function); |
| 2064 |
| 2065 /** |
| 2066 * Determines whether a function handle refers to an abstract method. |
| 2067 * |
| 2068 * \param function A handle to a function or method declaration. |
| 2069 * \param is_static Returns whether the handle refers to an abstract method. |
| 2070 * |
| 2071 * \return A valid handle if no error occurs during the operation. |
| 2072 */ |
| 2073 DART_EXPORT Dart_Handle Dart_FunctionIsAbstract(Dart_Handle function, |
| 2074 bool* is_abstract); |
| 2075 |
| 2076 /** |
| 2077 * Determines whether a function handle referes to a static function |
| 2078 * of method. |
| 2079 * |
| 2080 * For the purposes of the embedding API, a top-level function is |
| 2081 * implicitly declared static. |
| 2082 * |
| 2083 * \param function A handle to a function or method declaration. |
| 2084 * \param is_static Returns whether the function or method is declared static. |
| 2085 * |
| 2086 * \return A valid handle if no error occurs during the operation. |
| 2087 */ |
| 2088 DART_EXPORT Dart_Handle Dart_FunctionIsStatic(Dart_Handle function, |
| 2089 bool* is_static); |
| 2090 |
| 2091 /** |
| 2092 * Determines whether a function handle referes to a constructor. |
| 2093 * |
| 2094 * \param function A handle to a function or method declaration. |
| 2095 * \param is_static Returns whether the function or method is a constructor. |
| 2096 * |
| 2097 * \return A valid handle if no error occurs during the operation. |
| 2098 */ |
| 2099 DART_EXPORT Dart_Handle Dart_FunctionIsConstructor(Dart_Handle function, |
| 2100 bool* is_constructor); |
| 2101 // TODO(turnidge): Document behavior for factory constructors too. |
| 2102 |
| 2103 /** |
| 2104 * Determines whether a function or method is a getter. |
| 2105 * |
| 2106 * \param function A handle to a function or method declaration. |
| 2107 * \param is_static Returns whether the function or method is a getter. |
| 2108 * |
| 2109 * \return A valid handle if no error occurs during the operation. |
| 2110 */ |
| 2111 DART_EXPORT Dart_Handle Dart_FunctionIsGetter(Dart_Handle function, |
| 2112 bool* is_getter); |
| 2113 |
| 2114 /** |
| 2115 * Determines whether a function or method is a setter. |
| 2116 * |
| 2117 * \param function A handle to a function or method declaration. |
| 2118 * \param is_static Returns whether the function or method is a setter. |
| 2119 * |
| 2120 * \return A valid handle if no error occurs during the operation. |
| 2121 */ |
| 2122 DART_EXPORT Dart_Handle Dart_FunctionIsSetter(Dart_Handle function, |
| 2123 bool* is_setter); |
| 2124 |
| 2125 /** |
| 2126 * Returns a list of the names of all variables declared in a library |
| 2127 * or class. |
| 2128 * |
| 2129 * \param target A library or class. |
| 2130 * |
| 2131 * \return If no error occurs, a list of strings is returned. |
| 2132 * Otherwise an erorr handle is returned. |
| 2133 */ |
| 2134 DART_EXPORT Dart_Handle Dart_GetVariableNames(Dart_Handle target); |
| 2135 |
| 2136 /** |
| 2137 * Looks up a variable declaration by name from a library or class. |
| 2138 * |
| 2139 * \param library The library or class containing the variable. |
| 2140 * \param variable_name The name of the variable. |
| 2141 * |
| 2142 * \return If an error is encountered, returns an error handle. |
| 2143 * Otherwise returns a variable handle if the variable is found or |
| 2144 * Dart_Null() if the variable is not found. |
| 2145 */ |
| 2146 DART_EXPORT Dart_Handle Dart_LookupVariable(Dart_Handle target, |
| 2147 Dart_Handle variable_name); |
| 2148 |
| 2149 /** |
| 2150 * Is this a variable declaration handle? |
| 2151 */ |
| 2152 DART_EXPORT bool Dart_IsVariable(Dart_Handle handle); |
| 2153 |
| 2154 /** |
| 2155 * Returns the name for the provided variable. |
| 2156 */ |
| 2157 DART_EXPORT Dart_Handle Dart_VariableName(Dart_Handle variable); |
| 2158 |
| 2159 /** |
| 2160 * Determines whether a variable is declared static. |
| 2161 * |
| 2162 * For the purposes of the embedding API, a top-level variable is |
| 2163 * implicitly declared static. |
| 2164 * |
| 2165 * \param variable A handle to a variable declaration. |
| 2166 * \param is_static Returns whether the variable is declared static. |
| 2167 * |
| 2168 * \return A valid handle if no error occurs during the operation. |
| 2169 */ |
| 2170 DART_EXPORT Dart_Handle Dart_VariableIsStatic(Dart_Handle variable, |
| 2171 bool* is_static); |
| 2172 |
| 2173 /** |
| 2174 * Determines whether a variable is declared final. |
| 2175 * |
| 2176 * \param variable A handle to a variable declaration. |
| 2177 * \param is_final Returns whether the variable is declared final. |
| 2178 * |
| 2179 * \return A valid handle if no error occurs during the operation. |
| 2180 */ |
| 2181 DART_EXPORT Dart_Handle Dart_VariableIsFinal(Dart_Handle variable, |
| 2182 bool* is_final); |
| 2183 |
2025 // --- Constructors, Methods, and Fields --- | 2184 // --- Constructors, Methods, and Fields --- |
2026 | 2185 |
2027 /** | 2186 /** |
2028 * Invokes a constructor, creating a new object. | 2187 * Invokes a constructor, creating a new object. |
2029 * | 2188 * |
2030 * This function allows hidden constructors (constructors with leading | 2189 * This function allows hidden constructors (constructors with leading |
2031 * underscores) to be called. | 2190 * underscores) to be called. |
2032 * | 2191 * |
2033 * \param clazz A class or an interface. | 2192 * \param clazz A class or an interface. |
2034 * \param constructor_name The name of the constructor to invoke. Use | 2193 * \param constructor_name The name of the constructor to invoke. Use |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2399 // information that can be used for better profile reports for | 2558 // information that can be used for better profile reports for |
2400 // dynamically generated code. | 2559 // dynamically generated code. |
2401 DART_EXPORT void Dart_InitPprofSupport(); | 2560 DART_EXPORT void Dart_InitPprofSupport(); |
2402 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); | 2561 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); |
2403 | 2562 |
2404 // Support for generating flow graph compiler debugging output into a file. | 2563 // Support for generating flow graph compiler debugging output into a file. |
2405 typedef void (*FileWriterFunction)(const char* buffer, int64_t num_bytes); | 2564 typedef void (*FileWriterFunction)(const char* buffer, int64_t num_bytes); |
2406 DART_EXPORT void Dart_InitFlowGraphPrinting(FileWriterFunction function); | 2565 DART_EXPORT void Dart_InitFlowGraphPrinting(FileWriterFunction function); |
2407 | 2566 |
2408 #endif // INCLUDE_DART_API_H_ | 2567 #endif // INCLUDE_DART_API_H_ |
OLD | NEW |