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