Rework the public API (#4829)
Related to #4186. Some notable changes: - The term 'Error' now strictly refers to native Error objects defined in the ECMA standard, which are ordinary objects. All other uses of 'error' or 'error reference' where the term refers to a thrown value is now called 'exception'. - Simplified the naming scheme of many String API functions. These functions will now also take an 'encoding' argument to specify the desired encoding in which to operate. - Removed the substring-copy-to-buffer functions. These functions behaved awkwardly, as they use character index to specify the start/end positions, and were mostly used incorrectly with byte offsets instead. The functionality can still be replicated with other functions if necessary. - String-to-buffer functions will no longer fail if the buffer is not sufficiently large, the string will instead be cropped. - Fixed the usage of the '_sz' prefix in many API functions. The term 'sz' means zero-terminated string in hungarian notation, this was used incorrectly in many cases. - Renamed most of the public API functions to have shorter, more on-point names, rather than the often too long descriptive names. Functions are now also grouped by the type of value they operate on, where this makes sense. JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
This commit is contained in:
@@ -20,7 +20,7 @@ JerryScript only supports a single nested hierarchy of scopes. There is only one
|
||||
static jerry_value_t
|
||||
create_object (void)
|
||||
{
|
||||
jerry_value_t obj = jerry_create_object ();
|
||||
jerry_value_t obj = jerry_object ();
|
||||
return obj;
|
||||
} /* create_object */
|
||||
|
||||
@@ -41,7 +41,7 @@ main (void)
|
||||
jerry_init (JERRY_INIT_EMPTY);
|
||||
|
||||
test_handle_scope_val ();
|
||||
jerry_gc (JERRY_GC_PRESSURE_LOW);
|
||||
jerry_heap_gc (JERRY_GC_PRESSURE_LOW);
|
||||
|
||||
jerry_cleanup ();
|
||||
} /* main */
|
||||
@@ -66,7 +66,7 @@ create_object (void)
|
||||
{
|
||||
jerryx_escapable_handle_scope scope;
|
||||
jerryx_open_escapable_handle_scope (&scope);
|
||||
jerry_value_t obj = jerryx_create_handle (jerry_create_object ());
|
||||
jerry_value_t obj = jerryx_create_handle (jerry_object ());
|
||||
|
||||
jerry_value_t escaped_obj;
|
||||
jerryx_escape_handle(scope, obj, &escaped_obj);
|
||||
@@ -93,7 +93,7 @@ main (void)
|
||||
jerry_init (JERRY_INIT_EMPTY);
|
||||
|
||||
test_handle_scope_val ();
|
||||
jerry_gc (JERRY_GC_PRESSURE_LOW);
|
||||
jerry_heap_gc (JERRY_GC_PRESSURE_LOW);
|
||||
|
||||
jerry_cleanup ();
|
||||
} /* main */
|
||||
@@ -102,8 +102,8 @@ main (void)
|
||||
**See also**
|
||||
|
||||
- [jerry_value_t](../docs/02.API-REFERENCE.md#jerry_value_t)
|
||||
- [jerry_acquire_value](../docs/02.API-REFERENCE.md#jerry_acquire_value)
|
||||
- [jerry_release_value](../docs/02.API-REFERENCE.md#jerry_release_value)
|
||||
- [jerry_value_copy](../docs/02.API-REFERENCE.md#jerry_value_copy)
|
||||
- [jerry_value_free](../docs/02.API-REFERENCE.md#jerry_value_free)
|
||||
|
||||
## Pre-allocated list of handle scopes and handles
|
||||
|
||||
|
||||
Reference in New Issue
Block a user