| 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 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1516 * Gets the storage size in bytes of a String. | 1516 * Gets the storage size in bytes of a String. |
| 1517 * | 1517 * |
| 1518 * \param str A String. | 1518 * \param str A String. |
| 1519 * \param length Returns the storage size in bytes of the String. | 1519 * \param length Returns the storage size in bytes of the String. |
| 1520 * This is the size in bytes needed to store the String. | 1520 * This is the size in bytes needed to store the String. |
| 1521 * | 1521 * |
| 1522 * \return A valid handle if no error occurs during the operation. | 1522 * \return A valid handle if no error occurs during the operation. |
| 1523 */ | 1523 */ |
| 1524 DART_EXPORT Dart_Handle Dart_StringStorageSize(Dart_Handle str, intptr_t* size); | 1524 DART_EXPORT Dart_Handle Dart_StringStorageSize(Dart_Handle str, intptr_t* size); |
| 1525 | 1525 |
| 1526 | |
| 1527 /** | 1526 /** |
| 1528 * Converts a String into an ExternalString. | 1527 * Converts a String into an ExternalString. |
| 1529 * The original object is morphed into an external string object. | 1528 * The original object is morphed into an external string object. |
| 1530 * | 1529 * |
| 1531 * \param array External space into which the string data will be | 1530 * \param array External space into which the string data will be |
| 1532 * copied into. This must not move. | 1531 * copied into. This must not move. |
| 1533 * \param length The size in bytes of the provided external space (array). | 1532 * \param length The size in bytes of the provided external space (array). |
| 1534 * \param peer An external pointer to associate with this string. | 1533 * \param peer An external pointer to associate with this string. |
| 1535 * \param cback A callback to be called when this string is finalized. | 1534 * \param cback A callback to be called when this string is finalized. |
| 1536 * | 1535 * |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1547 * void* data = malloc(size); | 1546 * void* data = malloc(size); |
| 1548 * result = Dart_MakeExternalString(str, data, size, NULL, NULL); | 1547 * result = Dart_MakeExternalString(str, data, size, NULL, NULL); |
| 1549 * | 1548 * |
| 1550 */ | 1549 */ |
| 1551 DART_EXPORT Dart_Handle Dart_MakeExternalString(Dart_Handle str, | 1550 DART_EXPORT Dart_Handle Dart_MakeExternalString(Dart_Handle str, |
| 1552 void* array, | 1551 void* array, |
| 1553 intptr_t length, | 1552 intptr_t length, |
| 1554 void* peer, | 1553 void* peer, |
| 1555 Dart_PeerFinalizer cback); | 1554 Dart_PeerFinalizer cback); |
| 1556 | 1555 |
| 1556 /** |
| 1557 * Retrieves some properties associated with a String. |
| 1558 * Properties retrieved are: |
| 1559 * - character size of the string (one or two byte) |
| 1560 * - length of the string |
| 1561 * - peer pointer of string if it is an external string. |
| 1562 * \param str A String. |
| 1563 * \param char_size Returns the character size of the String. |
| 1564 * \param str_len Returns the length of the String. |
| 1565 * \param peer Returns the peer pointer if the String is an external String. |
| 1566 * \return Success if no error occurs. Otherwise returns |
| 1567 * an error handle. |
| 1568 */ |
| 1569 DART_EXPORT Dart_Handle Dart_StringGetProperties(Dart_Handle str, |
| 1570 intptr_t* char_size, |
| 1571 intptr_t* str_len, |
| 1572 void** peer); |
| 1557 | 1573 |
| 1558 /* | 1574 /* |
| 1559 * ===== | 1575 * ===== |
| 1560 * Lists | 1576 * Lists |
| 1561 * ===== | 1577 * ===== |
| 1562 */ | 1578 */ |
| 1563 | 1579 |
| 1564 /** | 1580 /** |
| 1565 * Returns a List of the desired length. | 1581 * Returns a List of the desired length. |
| 1566 * | 1582 * |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1975 int fld_index, | 1991 int fld_index, |
| 1976 intptr_t* value); | 1992 intptr_t* value); |
| 1977 | 1993 |
| 1978 /** | 1994 /** |
| 1979 * Gets the native field of the receiver. | 1995 * Gets the native field of the receiver. |
| 1980 */ | 1996 */ |
| 1981 DART_EXPORT Dart_Handle Dart_GetNativeReceiver(Dart_NativeArguments args, | 1997 DART_EXPORT Dart_Handle Dart_GetNativeReceiver(Dart_NativeArguments args, |
| 1982 intptr_t* value); | 1998 intptr_t* value); |
| 1983 | 1999 |
| 1984 /** | 2000 /** |
| 2001 * Gets a string native argument at some index. |
| 2002 * \param args Native arguments structure. |
| 2003 * \param arg_index Index of the desired argument in the structure above. |
| 2004 * \param peer Returns the peer pointer if the String is an external String. |
| 2005 * \return the String object if no error occurs. Otherwise returns |
| 2006 * an error handle. |
| 2007 */ |
| 2008 DART_EXPORT Dart_Handle Dart_GetNativeStringArgument(Dart_NativeArguments args, |
| 2009 int arg_index, |
| 2010 void** peer); |
| 2011 |
| 2012 /** |
| 1985 * Sets the return value for a native function. | 2013 * Sets the return value for a native function. |
| 1986 */ | 2014 */ |
| 1987 DART_EXPORT void Dart_SetReturnValue(Dart_NativeArguments args, | 2015 DART_EXPORT void Dart_SetReturnValue(Dart_NativeArguments args, |
| 1988 Dart_Handle retval); | 2016 Dart_Handle retval); |
| 1989 | 2017 |
| 2018 DART_EXPORT void Dart_SetWeakHandleReturnValue(Dart_NativeArguments args, |
| 2019 Dart_WeakPersistentHandle rval); |
| 2020 |
| 1990 DART_EXPORT void Dart_SetBooleanReturnValue(Dart_NativeArguments args, | 2021 DART_EXPORT void Dart_SetBooleanReturnValue(Dart_NativeArguments args, |
| 1991 bool retval); | 2022 bool retval); |
| 1992 | 2023 |
| 1993 DART_EXPORT void Dart_SetIntegerReturnValue(Dart_NativeArguments args, | 2024 DART_EXPORT void Dart_SetIntegerReturnValue(Dart_NativeArguments args, |
| 1994 intptr_t retval); | 2025 intptr_t retval); |
| 1995 | 2026 |
| 1996 DART_EXPORT void Dart_SetDoubleReturnValue(Dart_NativeArguments args, | 2027 DART_EXPORT void Dart_SetDoubleReturnValue(Dart_NativeArguments args, |
| 1997 double retval); | 2028 double retval); |
| 1998 | 2029 |
| 1999 /** | 2030 /** |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2222 * | 2253 * |
| 2223 * \param object An object. | 2254 * \param object An object. |
| 2224 * \param peer A value to store in the peer field. | 2255 * \param peer A value to store in the peer field. |
| 2225 * | 2256 * |
| 2226 * \return Returns an error if 'object' is a subtype of Null, num, or | 2257 * \return Returns an error if 'object' is a subtype of Null, num, or |
| 2227 * bool. | 2258 * bool. |
| 2228 */ | 2259 */ |
| 2229 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer); | 2260 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer); |
| 2230 | 2261 |
| 2231 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ | 2262 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ |
| OLD | NEW |