| 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 21 matching lines...) Expand all Loading... |
| 32 typedef unsigned __int16 uint16_t; | 32 typedef unsigned __int16 uint16_t; |
| 33 typedef unsigned __int32 uint32_t; | 33 typedef unsigned __int32 uint32_t; |
| 34 typedef unsigned __int64 uint64_t; | 34 typedef unsigned __int64 uint64_t; |
| 35 #if defined(DART_SHARED_LIB) | 35 #if defined(DART_SHARED_LIB) |
| 36 #define DART_EXPORT DART_EXTERN_C __declspec(dllexport) | 36 #define DART_EXPORT DART_EXTERN_C __declspec(dllexport) |
| 37 #else | 37 #else |
| 38 #define DART_EXPORT DART_EXTERN_C | 38 #define DART_EXPORT DART_EXTERN_C |
| 39 #endif | 39 #endif |
| 40 #else | 40 #else |
| 41 #include <inttypes.h> | 41 #include <inttypes.h> |
| 42 #include <stdbool.h> |
| 42 #if __GNUC__ >= 4 | 43 #if __GNUC__ >= 4 |
| 43 #if defined(DART_SHARED_LIB) | 44 #if defined(DART_SHARED_LIB) |
| 44 #define DART_EXPORT DART_EXTERN_C __attribute__ ((visibility("default"))) | 45 #define DART_EXPORT DART_EXTERN_C __attribute__ ((visibility("default"))) |
| 45 #else | 46 #else |
| 46 #define DART_EXPORT DART_EXTERN_C | 47 #define DART_EXPORT DART_EXTERN_C |
| 47 #endif | 48 #endif |
| 48 #else | 49 #else |
| 49 #error Tool chain not supported. | 50 #error Tool chain not supported. |
| 50 #endif | 51 #endif |
| 51 #endif | 52 #endif |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 DART_EXPORT bool Dart_Post(Dart_Port port_id, Dart_Handle object); | 671 DART_EXPORT bool Dart_Post(Dart_Port port_id, Dart_Handle object); |
| 671 | 672 |
| 672 // --- Message sending/receiving from native code ---- | 673 // --- Message sending/receiving from native code ---- |
| 673 | 674 |
| 674 /** | 675 /** |
| 675 * A Dart_CObject is used for representing Dart objects as native C | 676 * A Dart_CObject is used for representing Dart objects as native C |
| 676 * data outside the Dart heap. These objects are totally detached from | 677 * data outside the Dart heap. These objects are totally detached from |
| 677 * the Dart heap. Only a subset of the Dart objects have a | 678 * the Dart heap. Only a subset of the Dart objects have a |
| 678 * representation as a Dart_CObject. | 679 * representation as a Dart_CObject. |
| 679 */ | 680 */ |
| 680 struct Dart_CObject { | 681 typedef struct _Dart_CObject { |
| 681 enum Type { | 682 enum Type { |
| 682 kNull = 0, | 683 kNull = 0, |
| 683 kBool, | 684 kBool, |
| 684 kInt32, | 685 kInt32, |
| 685 kInt64, | 686 kInt64, |
| 686 kBigint, | 687 kBigint, |
| 687 kDouble, | 688 kDouble, |
| 688 kString, | 689 kString, |
| 689 kArray, | 690 kArray, |
| 690 kUint8Array, | 691 kUint8Array, |
| 691 kUnsupported, | 692 kUnsupported, |
| 692 kNumberOfTypes | 693 kNumberOfTypes |
| 693 }; | 694 } type; |
| 694 Type type; | |
| 695 union { | 695 union { |
| 696 bool as_bool; | 696 bool as_bool; |
| 697 int32_t as_int32; | 697 int32_t as_int32; |
| 698 int64_t as_int64; | 698 int64_t as_int64; |
| 699 double as_double; | 699 double as_double; |
| 700 char* as_string; | 700 char* as_string; |
| 701 char* as_bigint; | 701 char* as_bigint; |
| 702 struct { | 702 struct { |
| 703 int length; | 703 int length; |
| 704 Dart_CObject** values; | 704 struct _Dart_CObject** values; |
| 705 } as_array; | 705 } as_array; |
| 706 struct { | 706 struct { |
| 707 int length; | 707 int length; |
| 708 uint8_t* values; | 708 uint8_t* values; |
| 709 } as_byte_array; | 709 } as_byte_array; |
| 710 } value; | 710 } value; |
| 711 }; | 711 } Dart_CObject; |
| 712 | 712 |
| 713 /** | 713 /** |
| 714 * Posts a message on some port. The message will contain the | 714 * Posts a message on some port. The message will contain the |
| 715 * Dart_CObject object graph rooted in 'message'. | 715 * Dart_CObject object graph rooted in 'message'. |
| 716 * | 716 * |
| 717 * While the message is being sent the state of the graph of | 717 * While the message is being sent the state of the graph of |
| 718 * Dart_CObject structures rooted in 'message' should not be accessed, | 718 * Dart_CObject structures rooted in 'message' should not be accessed, |
| 719 * as the message generation will make temporary modifications to the | 719 * as the message generation will make temporary modifications to the |
| 720 * data. When the message has been sent the graph will be fully | 720 * data. When the message has been sent the graph will be fully |
| 721 * restored. | 721 * restored. |
| (...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2018 | 2018 |
| 2019 // --- Profiling support ---- | 2019 // --- Profiling support ---- |
| 2020 | 2020 |
| 2021 // External pprof support for gathering and dumping symbolic | 2021 // External pprof support for gathering and dumping symbolic |
| 2022 // information that can be used for better profile reports for | 2022 // information that can be used for better profile reports for |
| 2023 // dynamically generated code. | 2023 // dynamically generated code. |
| 2024 DART_EXPORT void Dart_InitPprofSupport(); | 2024 DART_EXPORT void Dart_InitPprofSupport(); |
| 2025 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); | 2025 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); |
| 2026 | 2026 |
| 2027 #endif // INCLUDE_DART_API_H_ | 2027 #endif // INCLUDE_DART_API_H_ |
| OLD | NEW |