Update API functions
* Rename 'jerry_api_' prefix to 'jerry_' * Fix minor style issues * Group the API functions and add comment to each group * Move engine behaviour related funtions to 'jerry.h' JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
This commit is contained in:
@@ -56,7 +56,7 @@ ecma_op_eval (ecma_string_t *code_p, /**< code string */
|
||||
{
|
||||
ECMA_STRING_TO_UTF8_STRING (code_p, code_utf8_buffer_p, code_utf8_buffer_size);
|
||||
|
||||
ret_value = ecma_op_eval_chars_buffer ((jerry_api_char_t *) code_utf8_buffer_p,
|
||||
ret_value = ecma_op_eval_chars_buffer ((jerry_char_t *) code_utf8_buffer_p,
|
||||
chars_num,
|
||||
is_direct,
|
||||
is_called_from_strict_mode_code);
|
||||
@@ -77,7 +77,7 @@ ecma_op_eval (ecma_string_t *code_p, /**< code string */
|
||||
* @return ecma value
|
||||
*/
|
||||
ecma_value_t
|
||||
ecma_op_eval_chars_buffer (const jerry_api_char_t *code_p, /**< code characters buffer */
|
||||
ecma_op_eval_chars_buffer (const jerry_char_t *code_p, /**< code characters buffer */
|
||||
size_t code_buffer_size, /**< size of the buffer */
|
||||
bool is_direct, /**< is eval called directly (ECMA-262 v5, 15.1.2.1.1) */
|
||||
bool is_called_from_strict_mode_code) /**< is eval is called from strict mode code */
|
||||
@@ -90,7 +90,7 @@ ecma_op_eval_chars_buffer (const jerry_api_char_t *code_p, /**< code characters
|
||||
jsp_status_t parse_status;
|
||||
|
||||
bool is_strict_call = (is_direct && is_called_from_strict_mode_code);
|
||||
jerry_api_object_t *error_obj_p = NULL;
|
||||
jerry_object_t *error_obj_p = NULL;
|
||||
|
||||
parse_status = parser_parse_eval (code_p,
|
||||
code_buffer_size,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/* Copyright 2015-2016 Samsung Electronics Co., Ltd.
|
||||
* Copyright 2016 University of Szeged.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,7 +30,7 @@ extern ecma_value_t
|
||||
ecma_op_eval (ecma_string_t *, bool, bool);
|
||||
|
||||
extern ecma_value_t
|
||||
ecma_op_eval_chars_buffer (const jerry_api_char_t *, size_t, bool, bool);
|
||||
ecma_op_eval_chars_buffer (const jerry_char_t *, size_t, bool, bool);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
+105
-189
@@ -47,67 +47,67 @@ typedef enum
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
JERRY_API_DATA_TYPE_VOID, /**< no return value */
|
||||
JERRY_API_DATA_TYPE_UNDEFINED, /**< undefined */
|
||||
JERRY_API_DATA_TYPE_NULL, /**< null */
|
||||
JERRY_API_DATA_TYPE_BOOLEAN, /**< bool */
|
||||
JERRY_API_DATA_TYPE_FLOAT32, /**< 32-bit float */
|
||||
JERRY_API_DATA_TYPE_FLOAT64, /**< 64-bit float */
|
||||
JERRY_API_DATA_TYPE_UINT32, /**< number converted to 32-bit unsigned integer */
|
||||
JERRY_API_DATA_TYPE_STRING, /**< string */
|
||||
JERRY_API_DATA_TYPE_OBJECT /**< object */
|
||||
} jerry_api_data_type_t;
|
||||
JERRY_DATA_TYPE_VOID, /**< no return value */
|
||||
JERRY_DATA_TYPE_UNDEFINED, /**< undefined */
|
||||
JERRY_DATA_TYPE_NULL, /**< null */
|
||||
JERRY_DATA_TYPE_BOOLEAN, /**< bool */
|
||||
JERRY_DATA_TYPE_FLOAT32, /**< 32-bit float */
|
||||
JERRY_DATA_TYPE_FLOAT64, /**< 64-bit float */
|
||||
JERRY_DATA_TYPE_UINT32, /**< number converted to 32-bit unsigned integer */
|
||||
JERRY_DATA_TYPE_STRING, /**< string */
|
||||
JERRY_DATA_TYPE_OBJECT /**< object */
|
||||
} jerry_data_type_t;
|
||||
|
||||
/**
|
||||
* Jerry API Error object types
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
JERRY_API_ERROR_COMMON, /**< Error */
|
||||
JERRY_API_ERROR_EVAL, /**< EvalError */
|
||||
JERRY_API_ERROR_RANGE, /**< RangeError */
|
||||
JERRY_API_ERROR_REFERENCE, /**< ReferenceError */
|
||||
JERRY_API_ERROR_SYNTAX, /**< SyntaxError */
|
||||
JERRY_API_ERROR_TYPE, /**< TypeError */
|
||||
JERRY_API_ERROR_URI /**< URIError */
|
||||
} jerry_api_error_t;
|
||||
JERRY_ERROR_COMMON, /**< Error */
|
||||
JERRY_ERROR_EVAL, /**< EvalError */
|
||||
JERRY_ERROR_RANGE, /**< RangeError */
|
||||
JERRY_ERROR_REFERENCE, /**< ReferenceError */
|
||||
JERRY_ERROR_SYNTAX, /**< SyntaxError */
|
||||
JERRY_ERROR_TYPE, /**< TypeError */
|
||||
JERRY_ERROR_URI /**< URIError */
|
||||
} jerry_error_t;
|
||||
|
||||
/**
|
||||
* Jerry's char value
|
||||
*/
|
||||
typedef uint8_t jerry_api_char_t;
|
||||
*/
|
||||
typedef uint8_t jerry_char_t;
|
||||
|
||||
/**
|
||||
* Pointer to an array of character values
|
||||
*/
|
||||
typedef jerry_api_char_t *jerry_api_char_ptr_t;
|
||||
typedef jerry_char_t *jerry_char_ptr_t;
|
||||
|
||||
/**
|
||||
* Jerry's size
|
||||
*/
|
||||
typedef uint32_t jerry_api_size_t;
|
||||
*/
|
||||
typedef uint32_t jerry_size_t;
|
||||
|
||||
/**
|
||||
* Jerry's length
|
||||
*/
|
||||
typedef uint32_t jerry_api_length_t;
|
||||
*/
|
||||
typedef uint32_t jerry_length_t;
|
||||
|
||||
/**
|
||||
* Jerry's string value
|
||||
*/
|
||||
typedef struct ecma_string_t jerry_api_string_t;
|
||||
typedef struct ecma_string_t jerry_string_t;
|
||||
|
||||
/**
|
||||
* Jerry's object value
|
||||
*/
|
||||
typedef struct ecma_object_t jerry_api_object_t;
|
||||
typedef struct ecma_object_t jerry_object_t;
|
||||
|
||||
/**
|
||||
* Description of an extension function's argument
|
||||
*/
|
||||
typedef struct jerry_api_value_t
|
||||
typedef struct jerry_value_t
|
||||
{
|
||||
jerry_api_data_type_t type; /**< argument data type */
|
||||
jerry_data_type_t type; /**< argument data type */
|
||||
|
||||
union
|
||||
{
|
||||
@@ -118,212 +118,128 @@ typedef struct jerry_api_value_t
|
||||
|
||||
uint32_t v_uint32; /**< number converted 32-bit unsigned integer */
|
||||
|
||||
jerry_api_string_t *v_string; /**< pointer to a JS string */
|
||||
jerry_api_object_t *v_object; /**< pointer to a JS object */
|
||||
jerry_string_t *v_string; /**< pointer to a JS string */
|
||||
jerry_object_t *v_object; /**< pointer to a JS object */
|
||||
|
||||
} u;
|
||||
} jerry_api_value_t;
|
||||
} jerry_value_t;
|
||||
|
||||
/**
|
||||
* Jerry external function handler type
|
||||
* Type of an external function handler
|
||||
*/
|
||||
typedef bool (*jerry_external_handler_t) (const jerry_api_object_t *function_obj_p,
|
||||
const jerry_api_value_t *this_p,
|
||||
jerry_api_value_t *ret_val_p,
|
||||
const jerry_api_value_t args_p[],
|
||||
const jerry_api_length_t args_count);
|
||||
typedef bool (*jerry_external_handler_t) (const jerry_object_t *function_obj_p,
|
||||
const jerry_value_t *this_p,
|
||||
jerry_value_t *ret_val_p,
|
||||
const jerry_value_t args_p[],
|
||||
const jerry_length_t args_count);
|
||||
|
||||
/**
|
||||
* An object's native free callback
|
||||
* Native free callback of an object
|
||||
*/
|
||||
typedef void (*jerry_object_free_callback_t) (const uintptr_t native_p);
|
||||
|
||||
/**
|
||||
* function type applied for each fields in objects
|
||||
* Function type applied for each fields in objects
|
||||
*/
|
||||
typedef bool (*jerry_object_field_foreach_t) (const jerry_api_string_t *field_name_p,
|
||||
const jerry_api_value_t *field_value_p,
|
||||
typedef bool (*jerry_object_field_foreach_t) (const jerry_string_t *field_name_p,
|
||||
const jerry_value_t *field_value_p,
|
||||
void *user_data_p);
|
||||
/**
|
||||
* Returns whether the given jerry_api_value_t is void.
|
||||
*/
|
||||
bool jerry_api_value_is_void (const jerry_api_value_t *value_p);
|
||||
|
||||
/**
|
||||
* Returns whether the given jerry_api_value_t is null.
|
||||
* Get the global context
|
||||
*/
|
||||
bool jerry_api_value_is_null (const jerry_api_value_t *value_p);
|
||||
jerry_object_t *jerry_get_global (void);
|
||||
|
||||
/**
|
||||
* Returns whether the given jerry_api_value_t is undefined.
|
||||
* Checker functions of 'jerry_value_t'
|
||||
*/
|
||||
bool jerry_api_value_is_undefined (const jerry_api_value_t *value_p);
|
||||
bool jerry_value_is_void (const jerry_value_t *value_p);
|
||||
bool jerry_value_is_null (const jerry_value_t *value_p);
|
||||
bool jerry_value_is_undefined (const jerry_value_t *value_p);
|
||||
bool jerry_value_is_boolean (const jerry_value_t *value_p);
|
||||
bool jerry_value_is_number (const jerry_value_t *value_p);
|
||||
bool jerry_value_is_string (const jerry_value_t *value_p);
|
||||
bool jerry_value_is_object (const jerry_value_t *value_p);
|
||||
bool jerry_value_is_function (const jerry_value_t *value_p);
|
||||
|
||||
/**
|
||||
* Returns whether the given jerry_api_value_t has boolean type.
|
||||
* Getter functions of 'jerry_value_t'
|
||||
*/
|
||||
bool jerry_api_value_is_boolean (const jerry_api_value_t *value_p);
|
||||
bool jerry_get_boolean_value (const jerry_value_t *value_p);
|
||||
double jerry_get_number_value (const jerry_value_t *value_p);
|
||||
jerry_string_t *jerry_get_string_value (const jerry_value_t *value_p);
|
||||
jerry_object_t *jerry_get_object_value (const jerry_value_t *value_p);
|
||||
|
||||
/**
|
||||
* Returns whether the given jerry_api_value_t is number.
|
||||
*
|
||||
* More specifically, returns true if the type is JERRY_API_DATA_TYPE_FLOAT32,
|
||||
* JERRY_API_DATA_TYPE_FLOAT64 or JERRY_API_DATA_TYPE_UINT32, false otherwise.
|
||||
* Converters of 'jerry_value_t'
|
||||
*/
|
||||
bool jerry_api_value_is_number (const jerry_api_value_t *value_p);
|
||||
jerry_string_t *jerry_value_to_string (const jerry_value_t *);
|
||||
|
||||
/**
|
||||
* Returns whether the given jerry_api_value_t is string.
|
||||
* Create functions of 'jerry_value_t'
|
||||
*/
|
||||
bool jerry_api_value_is_string (const jerry_api_value_t *value_p);
|
||||
jerry_value_t jerry_create_void_value (void);
|
||||
jerry_value_t jerry_create_null_value (void);
|
||||
jerry_value_t jerry_create_undefined_value (void);
|
||||
jerry_value_t jerry_create_boolean_value (bool value);
|
||||
jerry_value_t jerry_create_number_value (double value);
|
||||
jerry_value_t jerry_create_object_value (jerry_object_t *value);
|
||||
jerry_value_t jerry_create_string_value (jerry_string_t *value);
|
||||
|
||||
/**
|
||||
* Returns whether the given jerry_api_value_t is object.
|
||||
* Acquire types with reference counter (increase the references)
|
||||
*/
|
||||
bool jerry_api_value_is_object (const jerry_api_value_t *value_p);
|
||||
jerry_string_t *jerry_acquire_string (jerry_string_t *);
|
||||
jerry_object_t *jerry_acquire_object (jerry_object_t *);
|
||||
jerry_value_t *jerry_acquire_value (jerry_value_t *);
|
||||
|
||||
/**
|
||||
* Returns whether the given jerry_api_value_t is a function object.
|
||||
*
|
||||
* More specifically, returns true if the jerry_api_value_t of the value
|
||||
* pointed by value_p has JERRY_API_DATA_TYPE_OBJECT type and
|
||||
* jerry_api_is_function() functiron return true for its v_object member,
|
||||
* otherwise false.
|
||||
* Relase the referenced values
|
||||
*/
|
||||
bool jerry_api_value_is_function (const jerry_api_value_t *value_p);
|
||||
void jerry_release_object (jerry_object_t *);
|
||||
void jerry_release_string (jerry_string_t *);
|
||||
void jerry_release_value (jerry_value_t *);
|
||||
|
||||
/**
|
||||
* Returns the boolean v_bool member of the given jerry_api_value_t structure.
|
||||
* If the given jerry_api_value_t structure has type other than
|
||||
* JERRY_API_DATA_TYPE_BOOLEAN, JERRY_ASSERT fails.
|
||||
* Create functions of API objects
|
||||
*/
|
||||
bool jerry_api_get_boolean_value (const jerry_api_value_t *value_p);
|
||||
jerry_object_t *jerry_create_object (void);
|
||||
jerry_object_t *jerry_create_array_object (jerry_size_t);
|
||||
jerry_object_t *jerry_create_external_function (jerry_external_handler_t);
|
||||
jerry_object_t *jerry_create_error (jerry_error_t, const jerry_char_t *);
|
||||
jerry_object_t *jerry_create_error_sz (jerry_error_t, const jerry_char_t *, jerry_size_t);
|
||||
jerry_string_t *jerry_create_string (const jerry_char_t *);
|
||||
jerry_string_t *jerry_create_string_sz (const jerry_char_t *, jerry_size_t);
|
||||
|
||||
/**
|
||||
* Returns the number value of the given jerry_api_value_t structure
|
||||
* as a double.
|
||||
*
|
||||
* If the given jerry_api_value_t structure has type JERRY_API_DATA_TYPE_UINT32
|
||||
* v_uint32 member will be returned as a double value. If the given
|
||||
* jerry_api_value_t structure has type JERRY_API_DATA_TYPE_FLOAT32
|
||||
* v_float32 member will be returned as a double and if tpye is
|
||||
* JERRY_API_DATA_TYPE_FLOAT64 the function returns the v_float64 member.
|
||||
* As long as the type is none of the above, JERRY_ASSERT falis.
|
||||
* Functions of array objects
|
||||
*/
|
||||
double jerry_api_get_number_value (const jerry_api_value_t *value_p);
|
||||
bool jerry_set_array_index_value (jerry_object_t *, jerry_length_t, jerry_value_t *);
|
||||
bool jerry_get_array_index_value (jerry_object_t *, jerry_length_t, jerry_value_t *);
|
||||
|
||||
/**
|
||||
* Returns the v_string member of the given jerry_api_value_t structure.
|
||||
* If the given jerry_api_value_t structure has type other than
|
||||
* JERRY_API_DATA_TYPE_STRING, JERRY_ASSERT fails.
|
||||
* Functions of 'jerry_string_t'
|
||||
*/
|
||||
jerry_api_string_t *jerry_api_get_string_value (const jerry_api_value_t *value_p);
|
||||
jerry_size_t jerry_get_string_size (const jerry_string_t *);
|
||||
jerry_length_t jerry_get_string_length (const jerry_string_t *);
|
||||
jerry_size_t jerry_string_to_char_buffer (const jerry_string_t *, jerry_char_t *, jerry_size_t);
|
||||
|
||||
/**
|
||||
* Returns the v_object member of the given jerry_api_value_t structure.
|
||||
* If the given jerry_api_value_t structure has type other than
|
||||
* JERRY_API_DATA_TYPE_OBJECT, JERRY_ASSERT fails.
|
||||
* General API functions of JS objects
|
||||
*/
|
||||
jerry_api_object_t *jerry_api_get_object_value (const jerry_api_value_t *value_p);
|
||||
|
||||
/**
|
||||
* Creates and returns a jerry_api_value_t with type
|
||||
* JERRY_API_DATA_TYPE_VOID.
|
||||
*/
|
||||
jerry_api_value_t jerry_api_create_void_value (void);
|
||||
|
||||
/**
|
||||
* Creates and returns a jerry_api_value_t with type
|
||||
* JERRY_API_DATA_TYPE_NULL.
|
||||
*/
|
||||
jerry_api_value_t jerry_api_create_null_value (void);
|
||||
|
||||
/**
|
||||
* Creates and returns a jerry_api_value_t with type
|
||||
* JERRY_API_DATA_TYPE_UNDEFINED.
|
||||
*/
|
||||
jerry_api_value_t jerry_api_create_undefined_value (void);
|
||||
|
||||
/**
|
||||
* Creates a JERRY_API_DATA_TYPE_BOOLEAN jerry_api_value_t from the given
|
||||
* boolean parameter and returns with it.
|
||||
*/
|
||||
jerry_api_value_t jerry_api_create_boolean_value (bool value);
|
||||
|
||||
/**
|
||||
* Creates a jerry_api_value_t from the given double parameter and returns
|
||||
* with it.
|
||||
* The v_float64 member will be set and the will be JERRY_API_DATA_TYPE_FLOAT64.
|
||||
*/
|
||||
jerry_api_value_t jerry_api_create_number_value (double value);
|
||||
|
||||
/**
|
||||
* Creates a JERRY_API_DATA_TYPE_OBJECT type jerry_api_value_t from the
|
||||
* given jerry_api_object_t *parameter and returns with it.
|
||||
*/
|
||||
jerry_api_value_t jerry_api_create_object_value (jerry_api_object_t *value);
|
||||
|
||||
/**
|
||||
* Creates a JERRY_API_DATA_TYPE_STRING type jerry_api_value_t from the
|
||||
* given jerry_api_string_t *parameter and returns with it.
|
||||
*/
|
||||
jerry_api_value_t jerry_api_create_string_value (jerry_api_string_t *value);
|
||||
|
||||
jerry_api_size_t jerry_api_string_to_char_buffer (const jerry_api_string_t *, jerry_api_char_t *, jerry_api_size_t);
|
||||
jerry_api_string_t *jerry_api_acquire_string (jerry_api_string_t *);
|
||||
jerry_api_object_t *jerry_api_acquire_object (jerry_api_object_t *);
|
||||
jerry_api_value_t *jerry_api_acquire_value (jerry_api_value_t *);
|
||||
|
||||
void jerry_api_release_object (jerry_api_object_t *);
|
||||
void jerry_api_release_string (jerry_api_string_t *);
|
||||
void jerry_api_release_value (jerry_api_value_t *);
|
||||
|
||||
jerry_api_object_t *jerry_api_create_array_object (jerry_api_size_t);
|
||||
jerry_api_object_t *jerry_api_create_object (void);
|
||||
jerry_api_string_t *jerry_api_create_string (const jerry_api_char_t *);
|
||||
jerry_api_string_t *jerry_api_create_string_sz (const jerry_api_char_t *, jerry_api_size_t);
|
||||
|
||||
bool jerry_api_set_array_index_value (jerry_api_object_t *, jerry_api_length_t, jerry_api_value_t *);
|
||||
bool jerry_api_get_array_index_value (jerry_api_object_t *, jerry_api_length_t, jerry_api_value_t *);
|
||||
|
||||
jerry_api_object_t *jerry_api_create_error (jerry_api_error_t, const jerry_api_char_t *);
|
||||
jerry_api_object_t *jerry_api_create_error_sz (jerry_api_error_t, const jerry_api_char_t *, jerry_api_size_t);
|
||||
jerry_api_object_t *jerry_api_create_external_function (jerry_external_handler_t);
|
||||
|
||||
bool jerry_api_is_constructor (const jerry_api_object_t *);
|
||||
bool jerry_api_is_function (const jerry_api_object_t *);
|
||||
|
||||
bool jerry_api_add_object_field (jerry_api_object_t *, const jerry_api_char_t *, jerry_api_size_t,
|
||||
const jerry_api_value_t *, bool);
|
||||
bool jerry_api_delete_object_field (jerry_api_object_t *, const jerry_api_char_t *, jerry_api_size_t);
|
||||
|
||||
bool jerry_api_get_object_field_value (jerry_api_object_t *, const jerry_api_char_t *, jerry_api_value_t *);
|
||||
bool jerry_api_get_object_field_value_sz (jerry_api_object_t *, const jerry_api_char_t *, jerry_api_size_t,
|
||||
jerry_api_value_t *);
|
||||
|
||||
bool jerry_api_set_object_field_value (jerry_api_object_t *, const jerry_api_char_t *, const jerry_api_value_t *);
|
||||
bool jerry_api_set_object_field_value_sz (jerry_api_object_t *, const jerry_api_char_t *, jerry_api_size_t,
|
||||
const jerry_api_value_t *);
|
||||
|
||||
bool jerry_api_foreach_object_field (jerry_api_object_t *, jerry_object_field_foreach_t, void *);
|
||||
bool jerry_api_get_object_native_handle (jerry_api_object_t *, uintptr_t *);
|
||||
void jerry_api_set_object_native_handle (jerry_api_object_t *, uintptr_t, jerry_object_free_callback_t);
|
||||
bool jerry_api_call_function (jerry_api_object_t *, jerry_api_object_t *, jerry_api_value_t *,
|
||||
const jerry_api_value_t[], uint16_t);
|
||||
bool jerry_api_construct_object (jerry_api_object_t *, jerry_api_value_t *, const jerry_api_value_t[], uint16_t);
|
||||
jerry_completion_code_t jerry_api_eval (const jerry_api_char_t *, size_t, bool, bool, jerry_api_value_t *);
|
||||
jerry_api_object_t *jerry_api_get_global (void);
|
||||
|
||||
void jerry_api_gc (void);
|
||||
void jerry_register_external_magic_strings (const jerry_api_char_ptr_t *, uint32_t, const jerry_api_length_t *);
|
||||
|
||||
size_t jerry_parse_and_save_snapshot (const jerry_api_char_t *, size_t, bool, uint8_t *, size_t);
|
||||
jerry_completion_code_t jerry_exec_snapshot (const void *, size_t, bool, jerry_api_value_t *);
|
||||
|
||||
jerry_api_size_t jerry_api_get_string_size (const jerry_api_string_t *);
|
||||
jerry_api_length_t jerry_api_get_string_length (const jerry_api_string_t *);
|
||||
|
||||
jerry_api_string_t *jerry_api_value_to_string (const jerry_api_value_t *);
|
||||
bool jerry_is_constructor (const jerry_object_t *);
|
||||
bool jerry_is_function (const jerry_object_t *);
|
||||
bool jerry_add_object_field (jerry_object_t *, const jerry_char_t *, jerry_size_t, const jerry_value_t *, bool);
|
||||
bool jerry_delete_object_field (jerry_object_t *, const jerry_char_t *, jerry_size_t);
|
||||
bool jerry_get_object_field_value (jerry_object_t *, const jerry_char_t *, jerry_value_t *);
|
||||
bool jerry_get_object_field_value_sz (jerry_object_t *, const jerry_char_t *, jerry_size_t, jerry_value_t *);
|
||||
bool jerry_set_object_field_value (jerry_object_t *, const jerry_char_t *, const jerry_value_t *);
|
||||
bool jerry_set_object_field_value_sz (jerry_object_t *, const jerry_char_t *, jerry_size_t, const jerry_value_t *);
|
||||
bool jerry_foreach_object_field (jerry_object_t *, jerry_object_field_foreach_t, void *);
|
||||
bool jerry_get_object_native_handle (jerry_object_t *, uintptr_t *);
|
||||
void jerry_set_object_native_handle (jerry_object_t *, uintptr_t, jerry_object_free_callback_t);
|
||||
bool jerry_construct_object (jerry_object_t *, jerry_value_t *, const jerry_value_t[], uint16_t);
|
||||
bool jerry_call_function (jerry_object_t *, jerry_object_t *, jerry_value_t *, const jerry_value_t[], uint16_t);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
+411
-412
File diff suppressed because it is too large
Load Diff
+11
-5
@@ -41,8 +41,7 @@ typedef enum
|
||||
JERRY_FLAG_SHOW_OPCODES = (1u << 0), /**< dump byte-code to stdout after parse */
|
||||
JERRY_FLAG_MEM_STATS = (1u << 1), /**< dump memory statistics */
|
||||
JERRY_FLAG_MEM_STATS_SEPARATE = (1u << 2), /**< dump memory statistics and reset peak values after parse */
|
||||
JERRY_FLAG_PARSE_ONLY = (1u << 3), /**< parse only, prevents script execution (only for testing)
|
||||
* TODO: Remove. */
|
||||
JERRY_FLAG_PARSE_ONLY = (1u << 3), /**< parse only, prevents script execution */
|
||||
JERRY_FLAG_ENABLE_LOG = (1u << 4), /**< enable logging */
|
||||
} jerry_flag_t;
|
||||
|
||||
@@ -71,9 +70,16 @@ void jerry_cleanup (void);
|
||||
|
||||
void jerry_get_memory_limits (size_t *, size_t *);
|
||||
|
||||
bool jerry_parse (const jerry_api_char_t *, size_t, jerry_api_object_t **);
|
||||
jerry_completion_code_t jerry_run (jerry_api_value_t *);
|
||||
jerry_completion_code_t jerry_run_simple (const jerry_api_char_t *, size_t, jerry_flag_t);
|
||||
bool jerry_parse (const jerry_char_t *, size_t, jerry_object_t **);
|
||||
jerry_completion_code_t jerry_run (jerry_value_t *);
|
||||
jerry_completion_code_t jerry_run_simple (const jerry_char_t *, size_t, jerry_flag_t);
|
||||
|
||||
jerry_completion_code_t jerry_eval (const jerry_char_t *, size_t, bool, bool, jerry_value_t *);
|
||||
void jerry_gc (void);
|
||||
void jerry_register_external_magic_strings (const jerry_char_ptr_t *, uint32_t, const jerry_length_t *);
|
||||
|
||||
size_t jerry_parse_and_save_snapshot (const jerry_char_t *, size_t, bool, uint8_t *, size_t);
|
||||
jerry_completion_code_t jerry_exec_snapshot (const void *, size_t, bool, jerry_value_t *);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -2240,21 +2240,21 @@ parser_set_show_instrs (int show_instrs) /**< flag indicating whether to dump by
|
||||
* Parse EcamScript source code
|
||||
*
|
||||
* Note:
|
||||
* returned error object should be freed with jerry_api_release_object
|
||||
* returned error object should be freed with jerry_release_object
|
||||
*/
|
||||
jsp_status_t
|
||||
parser_parse_script (const jerry_api_char_t *source_p, /**< source code */
|
||||
parser_parse_script (const jerry_char_t *source_p, /**< source code */
|
||||
size_t size, /**< size of the source code */
|
||||
ecma_compiled_code_t **bytecode_data_p, /**< [out] JS bytecode */
|
||||
jerry_api_object_t **error_obj_p) /**< [out] error object */
|
||||
jerry_object_t **error_obj_p) /**< [out] error object */
|
||||
{
|
||||
parser_error_location parse_error;
|
||||
*bytecode_data_p = parser_parse_source (source_p, size, false, &parse_error);
|
||||
|
||||
if (!*bytecode_data_p)
|
||||
{
|
||||
*error_obj_p = jerry_api_create_error (JERRY_API_ERROR_SYNTAX,
|
||||
(const jerry_api_char_t *) parser_error_to_string (parse_error.error));
|
||||
*error_obj_p = jerry_create_error (JERRY_ERROR_SYNTAX,
|
||||
(const jerry_char_t *) parser_error_to_string (parse_error.error));
|
||||
return JSP_STATUS_SYNTAX_ERROR;
|
||||
}
|
||||
|
||||
@@ -2265,22 +2265,22 @@ parser_parse_script (const jerry_api_char_t *source_p, /**< source code */
|
||||
* Parse EcamScript eval source code
|
||||
*
|
||||
* Note:
|
||||
* returned error object should be freed with jerry_api_release_object
|
||||
* returned error object should be freed with jerry_release_object
|
||||
*/
|
||||
jsp_status_t
|
||||
parser_parse_eval (const jerry_api_char_t *source_p, /**< source code */
|
||||
parser_parse_eval (const jerry_char_t *source_p, /**< source code */
|
||||
size_t size, /**< size of the source code */
|
||||
bool is_strict, /**< strict mode */
|
||||
ecma_compiled_code_t **bytecode_data_p, /**< [out] JS bytecode */
|
||||
jerry_api_object_t **error_obj_p) /**< [out] error object */
|
||||
jerry_object_t **error_obj_p) /**< [out] error object */
|
||||
{
|
||||
parser_error_location parse_error;
|
||||
*bytecode_data_p = parser_parse_source (source_p, size, is_strict, &parse_error);
|
||||
|
||||
if (!*bytecode_data_p)
|
||||
{
|
||||
*error_obj_p = jerry_api_create_error (JERRY_API_ERROR_SYNTAX,
|
||||
(const jerry_api_char_t *) parser_error_to_string (parse_error.error));
|
||||
*error_obj_p = jerry_create_error (JERRY_ERROR_SYNTAX,
|
||||
(const jerry_char_t *) parser_error_to_string (parse_error.error));
|
||||
return JSP_STATUS_SYNTAX_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@@ -138,15 +138,15 @@ typedef enum
|
||||
} jsp_status_t;
|
||||
|
||||
/* Note: source must be a valid UTF-8 string */
|
||||
extern jsp_status_t parser_parse_script (const jerry_api_char_t *,
|
||||
extern jsp_status_t parser_parse_script (const jerry_char_t *,
|
||||
size_t,
|
||||
ecma_compiled_code_t **,
|
||||
jerry_api_object_t **);
|
||||
extern jsp_status_t parser_parse_eval (const jerry_api_char_t *,
|
||||
jerry_object_t **);
|
||||
extern jsp_status_t parser_parse_eval (const jerry_char_t *,
|
||||
size_t,
|
||||
bool,
|
||||
ecma_compiled_code_t **,
|
||||
jerry_api_object_t **);
|
||||
jerry_object_t **);
|
||||
|
||||
const char *parser_error_to_string (parser_error_t);
|
||||
|
||||
|
||||
+1
-1
@@ -176,7 +176,7 @@ static const uint16_t vm_decode_table[] =
|
||||
* Run global code
|
||||
*
|
||||
* Note:
|
||||
* returned error value should be freed with jerry_api_release_value
|
||||
* returned error value should be freed with jerry_release_value
|
||||
* just when the value becomes unnecessary.
|
||||
*
|
||||
* @return completion code
|
||||
|
||||
Reference in New Issue
Block a user