Update Jerry API

* Removed jerry_string_t and jerry_object_t
* Updated function names
* Updated return values
* Updated function descriptions
* Added new functions
* Added new unittests

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
This commit is contained in:
László Langó
2016-06-29 08:41:15 +02:00
parent cea3a142ac
commit 9bce5b09a9
19 changed files with 2077 additions and 2112 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
/* Copyright 2014-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.
@@ -502,7 +503,7 @@ ecma_gc_sweep (ecma_object_t *object_p) /**< object to free */
} /* ecma_gc_sweep */
/**
* Run garbage collecting
* Run garbage collection
*/
void
ecma_gc_run (void)
+9 -20
View File
@@ -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_char_t *) code_utf8_buffer_p,
ret_value = ecma_op_eval_chars_buffer (code_utf8_buffer_p,
chars_num,
is_direct,
is_called_from_strict_mode_code);
@@ -77,39 +77,28 @@ ecma_op_eval (ecma_string_t *code_p, /**< code string */
* @return ecma value
*/
ecma_value_t
ecma_op_eval_chars_buffer (const jerry_char_t *code_p, /**< code characters buffer */
ecma_op_eval_chars_buffer (const lit_utf8_byte_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 */
{
JERRY_ASSERT (code_p != NULL);
ecma_value_t ret_value;
ecma_compiled_code_t *bytecode_data_p;
jsp_status_t parse_status;
bool is_strict_call = (is_direct && is_called_from_strict_mode_code);
jerry_object_t *error_obj_p = NULL;
parse_status = parser_parse_eval (code_p,
code_buffer_size,
is_strict_call,
&bytecode_data_p,
&error_obj_p);
ecma_value_t parse_status = parser_parse_script (code_p,
code_buffer_size,
is_strict_call,
&bytecode_data_p);
if (parse_status == JSP_STATUS_OK)
if (ECMA_IS_VALUE_ERROR (parse_status))
{
ret_value = vm_run_eval (bytecode_data_p, is_direct);
}
else
{
JERRY_ASSERT (parse_status == JSP_STATUS_SYNTAX_ERROR);
ret_value = ecma_make_error_obj_value (error_obj_p);
return parse_status;
}
return ret_value;
return vm_run_eval (bytecode_data_p, is_direct);
} /* ecma_op_eval_chars_buffer */
/**
+1 -1
View File
@@ -30,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_char_t *, size_t, bool, bool);
ecma_op_eval_chars_buffer (const lit_utf8_byte_t *, size_t, bool, bool);
/**
* @}
+7 -3
View File
@@ -1,4 +1,5 @@
/* Copyright 2014-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.
@@ -277,8 +278,11 @@ ecma_op_object_put (ecma_object_t *obj_p, /**< the object */
* See also:
* ECMA-262 v5, 8.6.2; ECMA-262 v5, Table 8
*
* @return ecma value
* Returned value must be freed with ecma_free_value
* Note:
* returned value must be freed with ecma_free_value
*
* @return true, if deleted successfully
* false or type error otherwise (based in 'is_throw')
*/
ecma_value_t
ecma_op_object_delete (ecma_object_t *obj_p, /**< the object */
@@ -315,7 +319,7 @@ ecma_op_object_delete (ecma_object_t *obj_p, /**< the object */
{
JERRY_ASSERT (false);
return ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
return ecma_make_simple_value (ECMA_SIMPLE_VALUE_FALSE);
}
}
} /* ecma_op_object_delete */