Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Unified Diff: runtime/include/dart_api.h

Issue 9384027: Add multi-byte ByteArray access methods to the Dart API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: minor changes to formatting and comments Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/include/dart_api.h
diff --git a/runtime/include/dart_api.h b/runtime/include/dart_api.h
index bd3b2c2a41895a8ece35997140a0bc0e6ad35f73..f21a600c5eb6055f24f34184d674915cc3a82270 100755
--- a/runtime/include/dart_api.h
+++ b/runtime/include/dart_api.h
@@ -1195,6 +1195,7 @@ DART_EXPORT Dart_Handle Dart_NewByteArray(intptr_t length);
*
* \param value An array of 8-bit bytes. This array must not move.
* \param length The length of the array.
+ * \param peer An external pointer to associate with this byte array.
*
* \return The ByteArray object if no error occurs. Otherwise returns
* an error handle.
@@ -1210,6 +1211,306 @@ DART_EXPORT Dart_Handle Dart_NewExternalByteArray(uint8_t* data,
DART_EXPORT Dart_Handle Dart_ExternalByteArrayGetPeer(Dart_Handle object,
void** peer);
+/**
+ * Gets an int8_t at some byte offset in a ByteArray.
+ *
+ * If the byte offset is out of bounds, an error occurs.
+ *
+ * \param array A ByteArray.
+ * \param offset A valid byte offset into the List.
+ * \param value Returns the value of the int8_t.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_ByteArrayGetInt8At(Dart_Handle array,
+ intptr_t offset,
+ int8_t* value);
+
+/**
+ * Sets an int8_t at some byte offset in a ByteArray.
+ *
+ * If the byte offset is out of bounds, an error occurs.
+ *
+ * \param array A ByteArray.
+ * \param offset A valid byte offset into the ByteArray.
+ * \param value The int8_t to put into the ByteArray.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_ByteArraySetInt8At(Dart_Handle array,
+ intptr_t offset,
+ int8_t value);
+
+/**
+ * Gets a uint8_t at some byte offset in a ByteArray.
+ *
+ * If the byte offset is out of bounds, an error occurs.
+ *
+ * \param array A ByteArray.
+ * \param offset A valid byte offset into the List.
+ * \param value Returns the value of the uint8_t.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_ByteArrayGetUint8At(Dart_Handle array,
+ intptr_t offset,
+ uint8_t* value);
+
+/**
+ * Sets a uint8_t at some byte offset in a ByteArray.
+ *
+ * If the byte offset is out of bounds, an error occurs.
+ *
+ * \param array A ByteArray.
+ * \param offset A valid byte offset into the ByteArray.
+ * \param value The uint8_t to put into the ByteArray.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_ByteArraySetUint8At(Dart_Handle array,
+ intptr_t offset,
+ uint8_t value);
+
+/**
+ * Gets an int16_t at some byte offset in a ByteArray.
+ *
+ * If the byte offset is out of bounds, an error occurs.
+ *
+ * \param array A ByteArray.
+ * \param offset A valid byte offset into the List.
+ * \param value Returns the value of the int16_t.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_ByteArrayGetInt16At(Dart_Handle array,
+ intptr_t offset,
+ int16_t* value);
+
+/**
+ * Sets an int16_t at some byte offset in a ByteArray.
+ *
+ * If the byte offset is out of bounds, an error occurs.
+ *
+ * \param array A ByteArray.
+ * \param offset A valid byte offset into the ByteArray.
+ * \param value The int16_t to put into the ByteArray.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_ByteArraySetInt16At(Dart_Handle array,
+ intptr_t offset,
+ int16_t value);
+
+/**
+ * Gets a uint16_t at some byte offset in a ByteArray.
+ *
+ * If the byte offset is out of bounds, an error occurs.
+ *
+ * \param array A ByteArray.
+ * \param offset A valid byte offset into the List.
+ * \param value Returns the value of the uint16_t.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_ByteArrayGetUint16At(Dart_Handle array,
+ intptr_t offset,
+ uint16_t* value);
+
+/**
+ * Sets a uint16_t at some byte offset in a ByteArray.
+ *
+ * If the byte offset is out of bounds, an error occurs.
+ *
+ * \param array A ByteArray.
+ * \param offset A valid byte offset into the ByteArray.
+ * \param value The uint16_t to put into the ByteArray.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_ByteArraySetUint16At(Dart_Handle array,
+ intptr_t offset,
+ uint16_t value);
+
+/**
+ * Gets an int32_t at some byte offset in a ByteArray.
+ *
+ * If the byte offset is out of bounds, an error occurs.
+ *
+ * \param array A ByteArray.
+ * \param offset A valid byte offset into the List.
+ * \param value Returns the value of the int32_t.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_ByteArrayGetInt32At(Dart_Handle array,
+ intptr_t offset,
+ int32_t* value);
+
+/**
+ * Sets an int32_t at some byte offset in a ByteArray.
+ *
+ * If the byte offset is out of bounds, an error occurs.
+ *
+ * \param array A ByteArray.
+ * \param offset A valid byte offset into the ByteArray.
+ * \param value The int32_t to put into the ByteArray.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_ByteArraySetInt32At(Dart_Handle array,
+ intptr_t offset,
+ int32_t value);
+
+/**
+ * Gets a uint32_t at some byte offset in a ByteArray.
+ *
+ * If the byte offset is out of bounds, an error occurs.
+ *
+ * \param array A ByteArray.
+ * \param offset A valid byte offset into the List.
+ * \param value Returns the value of the uint32_t.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_ByteArrayGetUint32At(Dart_Handle array,
+ intptr_t offset,
+ uint32_t* value);
+
+/**
+ * Sets a uint32_t at some byte offset in a ByteArray.
+ *
+ * If the byte offset is out of bounds, an error occurs.
+ *
+ * \param array A ByteArray.
+ * \param offset A valid byte offset into the ByteArray.
+ * \param value The uint32_t to put into the ByteArray.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_ByteArraySetUint32At(Dart_Handle array,
+ intptr_t offset,
+ uint32_t value);
+
+/**
+ * Gets an int64_t at some byte offset in a ByteArray.
+ *
+ * If the byte offset is out of bounds, an error occurs.
+ *
+ * \param array A ByteArray.
+ * \param offset A valid byte offset into the List.
+ * \param value Returns the value of the int64_t.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_ByteArrayGetInt64At(Dart_Handle array,
+ intptr_t offset,
+ int64_t* value);
+
+/**
+ * Sets an int64_t at some byte offset in a ByteArray.
+ *
+ * If the byte offset is out of bounds, an error occurs.
+ *
+ * \param array A ByteArray.
+ * \param offset A valid byte offset into the ByteArray.
+ * \param value The int64_t to put into the ByteArray.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_ByteArraySetInt64At(Dart_Handle array,
+ intptr_t offset,
+ int64_t value);
+
+/**
+ * Gets a uint64_t at some byte offset in a ByteArray.
+ *
+ * If the byte offset is out of bounds, an error occurs.
+ *
+ * \param array A ByteArray.
+ * \param offset A valid byte offset into the List.
+ * \param value Returns the value of the uint64_t.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_ByteArrayGetUint64At(Dart_Handle array,
+ intptr_t offset,
+ uint64_t* value);
+
+/**
+ * Sets a uint64_t at some byte offset in a ByteArray.
+ *
+ * If the byte offset is out of bounds, an error occurs.
+ *
+ * \param array A ByteArray.
+ * \param offset A valid byte offset into the ByteArray.
+ * \param value The uint64_t to put into the ByteArray.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_ByteArraySetUint64At(Dart_Handle array,
+ intptr_t offset,
+ uint64_t value);
+
+/**
+ * Gets a float at some byte offset in a ByteArray.
+ *
+ * If the byte offset is out of bounds, an error occurs.
+ *
+ * \param array A ByteArray.
+ * \param offset A valid byte offset into the List.
+ * \param value Returns the value of the float.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_ByteArrayGetFloat32At(Dart_Handle array,
+ intptr_t offset,
+ float* value);
+
+/**
+ * Sets a float at some byte offset in a ByteArray.
+ *
+ * If the byte offset is out of bounds, an error occurs.
+ *
+ * \param array A ByteArray.
+ * \param offset A valid byte offset into the ByteArray.
+ * \param value The float to put into the ByteArray.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_ByteArraySetFloat32At(Dart_Handle array,
+ intptr_t offset,
+ float value);
+
+/**
+ * Gets a double from some byte offset in a ByteArray.
+ *
+ * If the byte offset is out of bounds, an error occurs.
+ *
+ * \param array A ByteArray.
+ * \param offset A valid byte offset into the List.
+ * \param value Returns the value of the double.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_ByteArrayGetFloat64At(Dart_Handle array,
+ intptr_t offset,
+ double* value);
+
+/**
+ * Sets a double at some byte offset in a ByteArray.
+ *
+ * If the byte offset is out of bounds, an error occurs.
+ *
+ * \param array A ByteArray.
+ * \param offset A valid byte offset into the ByteArray.
+ * \param value The double to put into the ByteArray.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_ByteArraySetFloat64At(Dart_Handle array,
+ intptr_t offset,
+ double value);
+
// --- Closures ---
/**
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698