Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 * claim ownership of the 'error' parameter. | 124 * claim ownership of the 'error' parameter. |
| 125 * | 125 * |
| 126 * Requires there to be a current isolate. | 126 * Requires there to be a current isolate. |
| 127 * | 127 * |
| 128 * \param error A C string containing an error message. | 128 * \param error A C string containing an error message. |
| 129 */ | 129 */ |
| 130 DART_EXPORT Dart_Handle Dart_Error(const char* error); | 130 DART_EXPORT Dart_Handle Dart_Error(const char* error); |
| 131 // TODO(turnidge): Accept printf-style args here. | 131 // TODO(turnidge): Accept printf-style args here. |
| 132 | 132 |
| 133 /** | 133 /** |
| 134 * Converts an object to a string. | |
| 135 * | |
| 136 * If an exception occurs during the conversion, this is treated as an | |
| 137 * error. | |
| 138 * | |
| 139 * \return A handle to the converted string if no errors occur during | |
| 140 * the conversion. If an error does occur, an invalid handle is | |
| 141 * returned. | |
| 142 */ | |
| 143 DART_EXPORT Dart_Handle Dart_ToString(Dart_Handle object); | |
| 144 | |
| 145 /** | |
| 146 * Checks if the two objects are the same object | |
| 147 * | |
| 148 * The result of the comparison is returned through the 'identical' | |
|
Ivan Posva
2011/11/07 23:48:30
identical -> same
turnidge
2011/11/10 20:30:58
Done.
| |
| 149 * parameter. The return value itself is used to indicate success or | |
| 150 * failure, not identity. | |
| 151 * | |
| 152 * \param obj1 An object to be compared. | |
| 153 * \param obj2 An object to be compared. | |
| 154 * \param equal Returns the result of the equality comparison. | |
|
Ivan Posva
2011/11/07 23:48:30
equal -> same
turnidge
2011/11/10 20:30:58
Done.
| |
| 155 * | |
| 156 * \return A valid handle if no error occurs during the comparison. | |
| 157 */ | |
| 158 DART_EXPORT Dart_Handle Dart_IsSame(Dart_Handle obj1, | |
| 159 Dart_Handle obj2, | |
| 160 bool* same); | |
| 161 | |
| 162 /** | |
| 134 * Allocates a persistent handle for an object. | 163 * Allocates a persistent handle for an object. |
| 135 * | 164 * |
| 136 * This handle has the lifetime of the current isolate unless it is | 165 * This handle has the lifetime of the current isolate unless it is |
| 137 * explicitly deallocated by calling Dart_DeletePersistentHandle. | 166 * explicitly deallocated by calling Dart_DeletePersistentHandle. |
| 138 * | 167 * |
| 139 * Requires there to be a current isolate. | 168 * Requires there to be a current isolate. |
| 140 */ | 169 */ |
| 141 DART_EXPORT Dart_Handle Dart_NewPersistentHandle(Dart_Handle object); | 170 DART_EXPORT Dart_Handle Dart_NewPersistentHandle(Dart_Handle object); |
| 142 | 171 |
| 143 /** | 172 /** |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 445 * \return A handle to the null object. | 474 * \return A handle to the null object. |
| 446 */ | 475 */ |
| 447 DART_EXPORT Dart_Handle Dart_Null(); | 476 DART_EXPORT Dart_Handle Dart_Null(); |
| 448 | 477 |
| 449 /** | 478 /** |
| 450 * Is this object null? | 479 * Is this object null? |
| 451 */ | 480 */ |
| 452 DART_EXPORT bool Dart_IsNull(Dart_Handle object); | 481 DART_EXPORT bool Dart_IsNull(Dart_Handle object); |
| 453 | 482 |
| 454 /** | 483 /** |
| 455 * Converts an object to a string. | 484 * Checks if the two objects are equal. |
| 456 * | |
| 457 * If an exception occurs during the conversion, this is treated as an | |
| 458 * error. | |
| 459 * | |
| 460 * \return A handle to the converted string if no errors occur during | |
| 461 * the conversion. If an error does occur, an invalid handle is | |
| 462 * returned. | |
| 463 */ | |
| 464 DART_EXPORT Dart_Handle Dart_ObjectToString(Dart_Handle object); | |
| 465 // TODO(turnidge): Consider shortening name to Dart_ToString. | |
| 466 | |
| 467 /** | |
| 468 * Returns true if the two objects are equal. | |
| 469 * | 485 * |
| 470 * The result of the comparison is returned through the 'equal' | 486 * The result of the comparison is returned through the 'equal' |
| 471 * parameter. The return value itself is used to indicate success or | 487 * parameter. The return value itself is used to indicate success or |
| 472 * failure, not equality. | 488 * failure, not equality. |
| 473 * | 489 * |
| 474 * \param obj1 An object to be compared. | 490 * \param obj1 An object to be compared. |
| 475 * \param obj2 An object to be compared. | 491 * \param obj2 An object to be compared. |
| 476 * \param equal Returns the result of the equality comparison. | 492 * \param equal Returns the result of the equality comparison. |
| 477 * | 493 * |
| 478 * \return A valid handle if no error occurs during the comparison. | 494 * \return A valid handle if no error occurs during the comparison. |
| 479 */ | 495 */ |
| 480 DART_EXPORT Dart_Handle Dart_Objects_Equal(Dart_Handle obj1, | 496 DART_EXPORT Dart_Handle Dart_ObjectEquals(Dart_Handle obj1, |
| 481 Dart_Handle obj2, | 497 Dart_Handle obj2, |
| 482 bool* equal); | 498 bool* equal); |
| 483 // TODO(turnidge): Consider renaming for consistency. Maybe just | |
| 484 // Dart_Equals. | |
| 485 // TODO(turnidge): Need to add identity equality function. | |
| 486 | 499 |
| 487 /** | 500 /** |
| 488 * Is this object an instance of some type? | 501 * Is this object an instance of some type? |
| 489 * | 502 * |
| 490 * The result of the test is returned through the 'instanceif' parameter. | 503 * The result of the test is returned through the 'instanceif' parameter. |
| 491 * The return value itself is used to indicate success or failure. | 504 * The return value itself is used to indicate success or failure. |
| 492 * | 505 * |
| 493 * \param object An object. | 506 * \param object An object. |
| 494 * \param type A type. | 507 * \param type A type. |
| 495 * \param instanceof Return true if 'object' is an instance of type 'type'. | 508 * \param instanceof Return true if 'object' is an instance of type 'type'. |
| 496 * | 509 * |
| 497 * \return A valid handle if no error occurs during the operation. | 510 * \return A valid handle if no error occurs during the operation. |
| 498 */ | 511 */ |
| 499 DART_EXPORT Dart_Handle Dart_IsInstanceOf(Dart_Handle object, | 512 DART_EXPORT Dart_Handle Dart_ObjectIsType(Dart_Handle object, |
| 500 Dart_Handle type, | 513 Dart_Handle type, |
| 501 bool* instanceof); | 514 bool* instanceof); |
| 502 | 515 |
| 503 // --- Numbers ---- | 516 // --- Numbers ---- |
| 504 | 517 |
| 505 /** | 518 /** |
| 506 * Is this object a Number? | 519 * Is this object a Number? |
| 507 */ | 520 */ |
| 508 DART_EXPORT bool Dart_IsNumber(Dart_Handle object); | 521 DART_EXPORT bool Dart_IsNumber(Dart_Handle object); |
| 509 | 522 |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1004 * Rethrows an exception. | 1017 * Rethrows an exception. |
| 1005 * | 1018 * |
| 1006 * Rethrows an exception, unwinding all dart frames on the stack. If | 1019 * Rethrows an exception, unwinding all dart frames on the stack. If |
| 1007 * successful, this function does not return. Note that this means | 1020 * successful, this function does not return. Note that this means |
| 1008 * that the destructors of any stack-allocated C++ objects will not be | 1021 * that the destructors of any stack-allocated C++ objects will not be |
| 1009 * called. If there are no Dart frames on the stack, an error occurs. | 1022 * called. If there are no Dart frames on the stack, an error occurs. |
| 1010 * | 1023 * |
| 1011 * \return An invalid handle if the exception was not thrown. | 1024 * \return An invalid handle if the exception was not thrown. |
| 1012 * Otherwise the function does not return. | 1025 * Otherwise the function does not return. |
| 1013 */ | 1026 */ |
| 1014 DART_EXPORT Dart_Handle Dart_ReThrowException(Dart_Handle exception, | 1027 DART_EXPORT Dart_Handle Dart_RethrowException(Dart_Handle exception, |
| 1015 Dart_Handle stacktrace); | 1028 Dart_Handle stacktrace); |
| 1016 // TODO(turnidge): ReThrow -> Rethrow. | |
| 1017 | 1029 |
| 1018 // --- Native functions --- | 1030 // --- Native functions --- |
| 1019 | 1031 |
| 1020 /** | 1032 /** |
| 1021 * The arguments to a native function. | 1033 * The arguments to a native function. |
| 1022 * | 1034 * |
| 1023 * This object is passed to a native function to represent its | 1035 * This object is passed to a native function to represent its |
| 1024 * arguments and return value. It allows access to the arguments to a | 1036 * arguments and return value. It allows access to the arguments to a |
| 1025 * native function by index. It also allows the return value of a | 1037 * native function by index. It also allows the return value of a |
| 1026 * native function to be set. | 1038 * native function to be set. |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1135 | 1147 |
| 1136 // --- Profiling support ---- | 1148 // --- Profiling support ---- |
| 1137 | 1149 |
| 1138 // External pprof support for gathering and dumping symbolic | 1150 // External pprof support for gathering and dumping symbolic |
| 1139 // information that can be used for better profile reports for | 1151 // information that can be used for better profile reports for |
| 1140 // dynamically generated code. | 1152 // dynamically generated code. |
| 1141 DART_EXPORT void Dart_InitPprofSupport(); | 1153 DART_EXPORT void Dart_InitPprofSupport(); |
| 1142 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); | 1154 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); |
| 1143 | 1155 |
| 1144 #endif // INCLUDE_DART_API_H_ | 1156 #endif // INCLUDE_DART_API_H_ |
| OLD | NEW |