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 RUNTIME_INCLUDE_DART_API_H_ | 7 #ifndef RUNTIME_INCLUDE_DART_API_H_ |
8 #define RUNTIME_INCLUDE_DART_API_H_ | 8 #define RUNTIME_INCLUDE_DART_API_H_ |
9 | 9 |
10 /** \mainpage Dart Embedding API Reference | 10 /** \mainpage Dart Embedding API Reference |
(...skipping 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1827 * | 1827 * |
1828 * \param str A String. | 1828 * \param str A String. |
1829 * \param length Returns the storage size in bytes of the String. | 1829 * \param length Returns the storage size in bytes of the String. |
1830 * This is the size in bytes needed to store the String. | 1830 * This is the size in bytes needed to store the String. |
1831 * | 1831 * |
1832 * \return A valid handle if no error occurs during the operation. | 1832 * \return A valid handle if no error occurs during the operation. |
1833 */ | 1833 */ |
1834 DART_EXPORT Dart_Handle Dart_StringStorageSize(Dart_Handle str, intptr_t* size); | 1834 DART_EXPORT Dart_Handle Dart_StringStorageSize(Dart_Handle str, intptr_t* size); |
1835 | 1835 |
1836 /** | 1836 /** |
1837 * Converts a String into an ExternalString. | |
1838 * The original object is morphed into an external string object. | |
1839 * | |
1840 * \param array External space into which the string data will be | |
1841 * copied into. This must not move. | |
1842 * \param external_allocation_size The size in bytes of the provided external | |
1843 * space (array). Used to inform the garbage collector. | |
1844 * \param peer An external pointer to associate with this string. | |
1845 * \param cback A callback to be called when this string is finalized. | |
1846 * | |
1847 * \return the converted ExternalString object if no error occurs. | |
1848 * Otherwise returns an error handle. | |
1849 * If the object is a valid string but if it cannot be externalized | |
1850 * the string data is copied into the external space specified | |
1851 * and the passed in peer is setup as a peer for this string object. | |
1852 * In this case the function returns the original String object as is. | |
1853 * | |
1854 * For example: | |
1855 * intptr_t size; | |
1856 * Dart_Handle result; | |
1857 * result = DartStringStorageSize(str, &size); | |
1858 * void* data = malloc(size); | |
1859 * result = Dart_MakeExternalString(str, data, size, NULL, NULL); | |
1860 * | |
1861 */ | |
1862 DART_EXPORT Dart_Handle | |
1863 Dart_MakeExternalString(Dart_Handle str, | |
1864 void* array, | |
1865 intptr_t external_allocation_size, | |
1866 void* peer, | |
1867 Dart_PeerFinalizer cback); | |
1868 | |
1869 /** | |
1870 * Retrieves some properties associated with a String. | 1837 * Retrieves some properties associated with a String. |
1871 * Properties retrieved are: | 1838 * Properties retrieved are: |
1872 * - character size of the string (one or two byte) | 1839 * - character size of the string (one or two byte) |
1873 * - length of the string | 1840 * - length of the string |
1874 * - peer pointer of string if it is an external string. | 1841 * - peer pointer of string if it is an external string. |
1875 * \param str A String. | 1842 * \param str A String. |
1876 * \param char_size Returns the character size of the String. | 1843 * \param char_size Returns the character size of the String. |
1877 * \param str_len Returns the length of the String. | 1844 * \param str_len Returns the length of the String. |
1878 * \param peer Returns the peer pointer associated with the String or 0 if | 1845 * \param peer Returns the peer pointer associated with the String or 0 if |
1879 * there is no peer pointer for it. | 1846 * there is no peer pointer for it. |
(...skipping 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3352 * compiled with DART_PRECOMPILED_RUNTIME). | 3319 * compiled with DART_PRECOMPILED_RUNTIME). |
3353 */ | 3320 */ |
3354 DART_EXPORT bool Dart_IsPrecompiledRuntime(); | 3321 DART_EXPORT bool Dart_IsPrecompiledRuntime(); |
3355 | 3322 |
3356 /** | 3323 /** |
3357 * Print a native stack trace. Used for crash handling. | 3324 * Print a native stack trace. Used for crash handling. |
3358 */ | 3325 */ |
3359 DART_EXPORT void Dart_DumpNativeStackTrace(void* context); | 3326 DART_EXPORT void Dart_DumpNativeStackTrace(void* context); |
3360 | 3327 |
3361 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ | 3328 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ |
OLD | NEW |