| 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 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1188 * \return The ByteArray object if no error occurs. Otherwise returns | 1188 * \return The ByteArray object if no error occurs. Otherwise returns |
| 1189 * an error handle. | 1189 * an error handle. |
| 1190 */ | 1190 */ |
| 1191 DART_EXPORT Dart_Handle Dart_NewByteArray(intptr_t length); | 1191 DART_EXPORT Dart_Handle Dart_NewByteArray(intptr_t length); |
| 1192 | 1192 |
| 1193 /** | 1193 /** |
| 1194 * Returns a ByteArray which references an external array of 8-bit bytes. | 1194 * Returns a ByteArray which references an external array of 8-bit bytes. |
| 1195 * | 1195 * |
| 1196 * \param value An array of 8-bit bytes. This array must not move. | 1196 * \param value An array of 8-bit bytes. This array must not move. |
| 1197 * \param length The length of the array. | 1197 * \param length The length of the array. |
| 1198 * \param peer An external pointer to associate with this byte array. |
| 1198 * | 1199 * |
| 1199 * \return The ByteArray object if no error occurs. Otherwise returns | 1200 * \return The ByteArray object if no error occurs. Otherwise returns |
| 1200 * an error handle. | 1201 * an error handle. |
| 1201 */ | 1202 */ |
| 1202 DART_EXPORT Dart_Handle Dart_NewExternalByteArray(uint8_t* data, | 1203 DART_EXPORT Dart_Handle Dart_NewExternalByteArray(uint8_t* data, |
| 1203 intptr_t length, | 1204 intptr_t length, |
| 1204 void* peer, | 1205 void* peer, |
| 1205 Dart_PeerFinalizer callback); | 1206 Dart_PeerFinalizer callback); |
| 1206 | 1207 |
| 1207 /** | 1208 /** |
| 1208 * Retrieves the peer pointer associated with an external ByteArray. | 1209 * Retrieves the peer pointer associated with an external ByteArray. |
| 1209 */ | 1210 */ |
| 1210 DART_EXPORT Dart_Handle Dart_ExternalByteArrayGetPeer(Dart_Handle object, | 1211 DART_EXPORT Dart_Handle Dart_ExternalByteArrayGetPeer(Dart_Handle object, |
| 1211 void** peer); | 1212 void** peer); |
| 1212 | 1213 |
| 1214 /** |
| 1215 * Gets an int8_t at some byte offset in a ByteArray. |
| 1216 * |
| 1217 * If the byte offset is out of bounds, an error occurs. |
| 1218 * |
| 1219 * \param array A ByteArray. |
| 1220 * \param offset A valid byte offset into the List. |
| 1221 * \param value Returns the value of the int8_t. |
| 1222 * |
| 1223 * \return A valid handle if no error occurs during the operation. |
| 1224 */ |
| 1225 DART_EXPORT Dart_Handle Dart_ByteArrayGetInt8At(Dart_Handle array, |
| 1226 intptr_t offset, |
| 1227 int8_t* value); |
| 1228 |
| 1229 /** |
| 1230 * Sets an int8_t at some byte offset in a ByteArray. |
| 1231 * |
| 1232 * If the byte offset is out of bounds, an error occurs. |
| 1233 * |
| 1234 * \param array A ByteArray. |
| 1235 * \param offset A valid byte offset into the ByteArray. |
| 1236 * \param value The int8_t to put into the ByteArray. |
| 1237 * |
| 1238 * \return A valid handle if no error occurs during the operation. |
| 1239 */ |
| 1240 DART_EXPORT Dart_Handle Dart_ByteArraySetInt8At(Dart_Handle array, |
| 1241 intptr_t offset, |
| 1242 int8_t value); |
| 1243 |
| 1244 /** |
| 1245 * Gets a uint8_t at some byte offset in a ByteArray. |
| 1246 * |
| 1247 * If the byte offset is out of bounds, an error occurs. |
| 1248 * |
| 1249 * \param array A ByteArray. |
| 1250 * \param offset A valid byte offset into the List. |
| 1251 * \param value Returns the value of the uint8_t. |
| 1252 * |
| 1253 * \return A valid handle if no error occurs during the operation. |
| 1254 */ |
| 1255 DART_EXPORT Dart_Handle Dart_ByteArrayGetUint8At(Dart_Handle array, |
| 1256 intptr_t offset, |
| 1257 uint8_t* value); |
| 1258 |
| 1259 /** |
| 1260 * Sets a uint8_t at some byte offset in a ByteArray. |
| 1261 * |
| 1262 * If the byte offset is out of bounds, an error occurs. |
| 1263 * |
| 1264 * \param array A ByteArray. |
| 1265 * \param offset A valid byte offset into the ByteArray. |
| 1266 * \param value The uint8_t to put into the ByteArray. |
| 1267 * |
| 1268 * \return A valid handle if no error occurs during the operation. |
| 1269 */ |
| 1270 DART_EXPORT Dart_Handle Dart_ByteArraySetUint8At(Dart_Handle array, |
| 1271 intptr_t offset, |
| 1272 uint8_t value); |
| 1273 |
| 1274 /** |
| 1275 * Gets an int16_t at some byte offset in a ByteArray. |
| 1276 * |
| 1277 * If the byte offset is out of bounds, an error occurs. |
| 1278 * |
| 1279 * \param array A ByteArray. |
| 1280 * \param offset A valid byte offset into the List. |
| 1281 * \param value Returns the value of the int16_t. |
| 1282 * |
| 1283 * \return A valid handle if no error occurs during the operation. |
| 1284 */ |
| 1285 DART_EXPORT Dart_Handle Dart_ByteArrayGetInt16At(Dart_Handle array, |
| 1286 intptr_t offset, |
| 1287 int16_t* value); |
| 1288 |
| 1289 /** |
| 1290 * Sets an int16_t at some byte offset in a ByteArray. |
| 1291 * |
| 1292 * If the byte offset is out of bounds, an error occurs. |
| 1293 * |
| 1294 * \param array A ByteArray. |
| 1295 * \param offset A valid byte offset into the ByteArray. |
| 1296 * \param value The int16_t to put into the ByteArray. |
| 1297 * |
| 1298 * \return A valid handle if no error occurs during the operation. |
| 1299 */ |
| 1300 DART_EXPORT Dart_Handle Dart_ByteArraySetInt16At(Dart_Handle array, |
| 1301 intptr_t offset, |
| 1302 int16_t value); |
| 1303 |
| 1304 /** |
| 1305 * Gets a uint16_t at some byte offset in a ByteArray. |
| 1306 * |
| 1307 * If the byte offset is out of bounds, an error occurs. |
| 1308 * |
| 1309 * \param array A ByteArray. |
| 1310 * \param offset A valid byte offset into the List. |
| 1311 * \param value Returns the value of the uint16_t. |
| 1312 * |
| 1313 * \return A valid handle if no error occurs during the operation. |
| 1314 */ |
| 1315 DART_EXPORT Dart_Handle Dart_ByteArrayGetUint16At(Dart_Handle array, |
| 1316 intptr_t offset, |
| 1317 uint16_t* value); |
| 1318 |
| 1319 /** |
| 1320 * Sets a uint16_t at some byte offset in a ByteArray. |
| 1321 * |
| 1322 * If the byte offset is out of bounds, an error occurs. |
| 1323 * |
| 1324 * \param array A ByteArray. |
| 1325 * \param offset A valid byte offset into the ByteArray. |
| 1326 * \param value The uint16_t to put into the ByteArray. |
| 1327 * |
| 1328 * \return A valid handle if no error occurs during the operation. |
| 1329 */ |
| 1330 DART_EXPORT Dart_Handle Dart_ByteArraySetUint16At(Dart_Handle array, |
| 1331 intptr_t offset, |
| 1332 uint16_t value); |
| 1333 |
| 1334 /** |
| 1335 * Gets an int32_t at some byte offset in a ByteArray. |
| 1336 * |
| 1337 * If the byte offset is out of bounds, an error occurs. |
| 1338 * |
| 1339 * \param array A ByteArray. |
| 1340 * \param offset A valid byte offset into the List. |
| 1341 * \param value Returns the value of the int32_t. |
| 1342 * |
| 1343 * \return A valid handle if no error occurs during the operation. |
| 1344 */ |
| 1345 DART_EXPORT Dart_Handle Dart_ByteArrayGetInt32At(Dart_Handle array, |
| 1346 intptr_t offset, |
| 1347 int32_t* value); |
| 1348 |
| 1349 /** |
| 1350 * Sets an int32_t at some byte offset in a ByteArray. |
| 1351 * |
| 1352 * If the byte offset is out of bounds, an error occurs. |
| 1353 * |
| 1354 * \param array A ByteArray. |
| 1355 * \param offset A valid byte offset into the ByteArray. |
| 1356 * \param value The int32_t to put into the ByteArray. |
| 1357 * |
| 1358 * \return A valid handle if no error occurs during the operation. |
| 1359 */ |
| 1360 DART_EXPORT Dart_Handle Dart_ByteArraySetInt32At(Dart_Handle array, |
| 1361 intptr_t offset, |
| 1362 int32_t value); |
| 1363 |
| 1364 /** |
| 1365 * Gets a uint32_t at some byte offset in a ByteArray. |
| 1366 * |
| 1367 * If the byte offset is out of bounds, an error occurs. |
| 1368 * |
| 1369 * \param array A ByteArray. |
| 1370 * \param offset A valid byte offset into the List. |
| 1371 * \param value Returns the value of the uint32_t. |
| 1372 * |
| 1373 * \return A valid handle if no error occurs during the operation. |
| 1374 */ |
| 1375 DART_EXPORT Dart_Handle Dart_ByteArrayGetUint32At(Dart_Handle array, |
| 1376 intptr_t offset, |
| 1377 uint32_t* value); |
| 1378 |
| 1379 /** |
| 1380 * Sets a uint32_t at some byte offset in a ByteArray. |
| 1381 * |
| 1382 * If the byte offset is out of bounds, an error occurs. |
| 1383 * |
| 1384 * \param array A ByteArray. |
| 1385 * \param offset A valid byte offset into the ByteArray. |
| 1386 * \param value The uint32_t to put into the ByteArray. |
| 1387 * |
| 1388 * \return A valid handle if no error occurs during the operation. |
| 1389 */ |
| 1390 DART_EXPORT Dart_Handle Dart_ByteArraySetUint32At(Dart_Handle array, |
| 1391 intptr_t offset, |
| 1392 uint32_t value); |
| 1393 |
| 1394 /** |
| 1395 * Gets an int64_t at some byte offset in a ByteArray. |
| 1396 * |
| 1397 * If the byte offset is out of bounds, an error occurs. |
| 1398 * |
| 1399 * \param array A ByteArray. |
| 1400 * \param offset A valid byte offset into the List. |
| 1401 * \param value Returns the value of the int64_t. |
| 1402 * |
| 1403 * \return A valid handle if no error occurs during the operation. |
| 1404 */ |
| 1405 DART_EXPORT Dart_Handle Dart_ByteArrayGetInt64At(Dart_Handle array, |
| 1406 intptr_t offset, |
| 1407 int64_t* value); |
| 1408 |
| 1409 /** |
| 1410 * Sets an int64_t at some byte offset in a ByteArray. |
| 1411 * |
| 1412 * If the byte offset is out of bounds, an error occurs. |
| 1413 * |
| 1414 * \param array A ByteArray. |
| 1415 * \param offset A valid byte offset into the ByteArray. |
| 1416 * \param value The int64_t to put into the ByteArray. |
| 1417 * |
| 1418 * \return A valid handle if no error occurs during the operation. |
| 1419 */ |
| 1420 DART_EXPORT Dart_Handle Dart_ByteArraySetInt64At(Dart_Handle array, |
| 1421 intptr_t offset, |
| 1422 int64_t value); |
| 1423 |
| 1424 /** |
| 1425 * Gets a uint64_t at some byte offset in a ByteArray. |
| 1426 * |
| 1427 * If the byte offset is out of bounds, an error occurs. |
| 1428 * |
| 1429 * \param array A ByteArray. |
| 1430 * \param offset A valid byte offset into the List. |
| 1431 * \param value Returns the value of the uint64_t. |
| 1432 * |
| 1433 * \return A valid handle if no error occurs during the operation. |
| 1434 */ |
| 1435 DART_EXPORT Dart_Handle Dart_ByteArrayGetUint64At(Dart_Handle array, |
| 1436 intptr_t offset, |
| 1437 uint64_t* value); |
| 1438 |
| 1439 /** |
| 1440 * Sets a uint64_t at some byte offset in a ByteArray. |
| 1441 * |
| 1442 * If the byte offset is out of bounds, an error occurs. |
| 1443 * |
| 1444 * \param array A ByteArray. |
| 1445 * \param offset A valid byte offset into the ByteArray. |
| 1446 * \param value The uint64_t to put into the ByteArray. |
| 1447 * |
| 1448 * \return A valid handle if no error occurs during the operation. |
| 1449 */ |
| 1450 DART_EXPORT Dart_Handle Dart_ByteArraySetUint64At(Dart_Handle array, |
| 1451 intptr_t offset, |
| 1452 uint64_t value); |
| 1453 |
| 1454 /** |
| 1455 * Gets a float at some byte offset in a ByteArray. |
| 1456 * |
| 1457 * If the byte offset is out of bounds, an error occurs. |
| 1458 * |
| 1459 * \param array A ByteArray. |
| 1460 * \param offset A valid byte offset into the List. |
| 1461 * \param value Returns the value of the float. |
| 1462 * |
| 1463 * \return A valid handle if no error occurs during the operation. |
| 1464 */ |
| 1465 DART_EXPORT Dart_Handle Dart_ByteArrayGetFloat32At(Dart_Handle array, |
| 1466 intptr_t offset, |
| 1467 float* value); |
| 1468 |
| 1469 /** |
| 1470 * Sets a float at some byte offset in a ByteArray. |
| 1471 * |
| 1472 * If the byte offset is out of bounds, an error occurs. |
| 1473 * |
| 1474 * \param array A ByteArray. |
| 1475 * \param offset A valid byte offset into the ByteArray. |
| 1476 * \param value The float to put into the ByteArray. |
| 1477 * |
| 1478 * \return A valid handle if no error occurs during the operation. |
| 1479 */ |
| 1480 DART_EXPORT Dart_Handle Dart_ByteArraySetFloat32At(Dart_Handle array, |
| 1481 intptr_t offset, |
| 1482 float value); |
| 1483 |
| 1484 /** |
| 1485 * Gets a double from some byte offset in a ByteArray. |
| 1486 * |
| 1487 * If the byte offset is out of bounds, an error occurs. |
| 1488 * |
| 1489 * \param array A ByteArray. |
| 1490 * \param offset A valid byte offset into the List. |
| 1491 * \param value Returns the value of the double. |
| 1492 * |
| 1493 * \return A valid handle if no error occurs during the operation. |
| 1494 */ |
| 1495 DART_EXPORT Dart_Handle Dart_ByteArrayGetFloat64At(Dart_Handle array, |
| 1496 intptr_t offset, |
| 1497 double* value); |
| 1498 |
| 1499 /** |
| 1500 * Sets a double at some byte offset in a ByteArray. |
| 1501 * |
| 1502 * If the byte offset is out of bounds, an error occurs. |
| 1503 * |
| 1504 * \param array A ByteArray. |
| 1505 * \param offset A valid byte offset into the ByteArray. |
| 1506 * \param value The double to put into the ByteArray. |
| 1507 * |
| 1508 * \return A valid handle if no error occurs during the operation. |
| 1509 */ |
| 1510 DART_EXPORT Dart_Handle Dart_ByteArraySetFloat64At(Dart_Handle array, |
| 1511 intptr_t offset, |
| 1512 double value); |
| 1513 |
| 1213 // --- Closures --- | 1514 // --- Closures --- |
| 1214 | 1515 |
| 1215 /** | 1516 /** |
| 1216 * Is this object a Closure? | 1517 * Is this object a Closure? |
| 1217 */ | 1518 */ |
| 1218 DART_EXPORT bool Dart_IsClosure(Dart_Handle object); | 1519 DART_EXPORT bool Dart_IsClosure(Dart_Handle object); |
| 1219 | 1520 |
| 1220 /** | 1521 /** |
| 1221 * Invokes a Closure with the given arguments. | 1522 * Invokes a Closure with the given arguments. |
| 1222 * | 1523 * |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1500 | 1801 |
| 1501 // --- Profiling support ---- | 1802 // --- Profiling support ---- |
| 1502 | 1803 |
| 1503 // External pprof support for gathering and dumping symbolic | 1804 // External pprof support for gathering and dumping symbolic |
| 1504 // information that can be used for better profile reports for | 1805 // information that can be used for better profile reports for |
| 1505 // dynamically generated code. | 1806 // dynamically generated code. |
| 1506 DART_EXPORT void Dart_InitPprofSupport(); | 1807 DART_EXPORT void Dart_InitPprofSupport(); |
| 1507 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); | 1808 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); |
| 1508 | 1809 |
| 1509 #endif // INCLUDE_DART_API_H_ | 1810 #endif // INCLUDE_DART_API_H_ |
| OLD | NEW |