Add core unicode functionality.

Add utf-8 processing routines.
Change ecma_char_t from char/uint16_t to uint16_t.
Apply all utf-8 processing routines.
Change char to jerry_api_char in API functions' declarations.

JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
This commit is contained in:
Andrey Shitov
2015-06-29 19:17:17 +03:00
parent c4b0cd2196
commit fd9ff8e3bd
56 changed files with 2468 additions and 1480 deletions
+17 -16
View File
@@ -138,9 +138,10 @@ ecma_new_standard_error_with_message (ecma_standard_error_t error_type, /**< nat
*/
ecma_completion_value_t
ecma_raise_standard_error (ecma_standard_error_t error_type, /**< error type */
const ecma_char_t *msg_p) /**< error message */
const lit_utf8_byte_t *msg_p) /**< error message */
{
ecma_string_t *error_msg_p = ecma_new_ecma_string (msg_p);
ecma_string_t *error_msg_p = ecma_new_ecma_string_from_utf8 (msg_p,
lit_zt_utf8_string_size (msg_p));
ecma_object_t *error_obj_p = ecma_new_standard_error_with_message (error_type, error_msg_p);
ecma_deref_ecma_string (error_msg_p);
return ecma_make_throw_obj_completion_value (error_obj_p);
@@ -153,9 +154,9 @@ ecma_raise_standard_error (ecma_standard_error_t error_type, /**< error type */
* Returned value must be freed with ecma_free_completion_value
*/
ecma_completion_value_t
ecma_raise_common_error (const ecma_char_t *msg_p) /**< error message */
ecma_raise_common_error (const char *msg_p) /**< error message */
{
return ecma_raise_standard_error (ECMA_ERROR_COMMON, msg_p);
return ecma_raise_standard_error (ECMA_ERROR_COMMON, (const lit_utf8_byte_t *) msg_p);
} /* ecma_raise_common_error */
/**
@@ -167,9 +168,9 @@ ecma_raise_common_error (const ecma_char_t *msg_p) /**< error message */
* Returned value must be freed with ecma_free_completion_value
*/
ecma_completion_value_t
ecma_raise_eval_error (const ecma_char_t *msg_p) /**< error message */
ecma_raise_eval_error (const char *msg_p) /**< error message */
{
return ecma_raise_standard_error (ECMA_ERROR_EVAL, msg_p);
return ecma_raise_standard_error (ECMA_ERROR_EVAL, (const lit_utf8_byte_t *) msg_p);
} /* ecma_raise_eval_error */
/**
@@ -181,9 +182,9 @@ ecma_raise_eval_error (const ecma_char_t *msg_p) /**< error message */
* Returned value must be freed with ecma_free_completion_value
*/
ecma_completion_value_t
ecma_raise_range_error (const ecma_char_t *msg_p) /**< error message */
ecma_raise_range_error (const char *msg_p) /**< error message */
{
return ecma_raise_standard_error (ECMA_ERROR_RANGE, msg_p);
return ecma_raise_standard_error (ECMA_ERROR_RANGE, (const lit_utf8_byte_t *) msg_p);
} /* ecma_raise_range_error */
/**
@@ -195,9 +196,9 @@ ecma_raise_range_error (const ecma_char_t *msg_p) /**< error message */
* Returned value must be freed with ecma_free_completion_value
*/
ecma_completion_value_t
ecma_raise_reference_error (const ecma_char_t *msg_p) /**< error message */
ecma_raise_reference_error (const char *msg_p) /**< error message */
{
return ecma_raise_standard_error (ECMA_ERROR_REFERENCE, msg_p);
return ecma_raise_standard_error (ECMA_ERROR_REFERENCE, (const lit_utf8_byte_t *) msg_p);
} /* ecma_raise_reference_error */
/**
@@ -209,9 +210,9 @@ ecma_raise_reference_error (const ecma_char_t *msg_p) /**< error message */
* Returned value must be freed with ecma_free_completion_value
*/
ecma_completion_value_t
ecma_raise_syntax_error (const ecma_char_t *msg_p) /**< error message */
ecma_raise_syntax_error (const char *msg_p) /**< error message */
{
return ecma_raise_standard_error (ECMA_ERROR_SYNTAX, msg_p);
return ecma_raise_standard_error (ECMA_ERROR_SYNTAX, (const lit_utf8_byte_t *) msg_p);
} /* ecma_raise_syntax_error */
/**
@@ -223,9 +224,9 @@ ecma_raise_syntax_error (const ecma_char_t *msg_p) /**< error message */
* Returned value must be freed with ecma_free_completion_value
*/
ecma_completion_value_t
ecma_raise_type_error (const ecma_char_t *msg_p) /**< error message */
ecma_raise_type_error (const char *msg_p) /**< error message */
{
return ecma_raise_standard_error (ECMA_ERROR_TYPE, msg_p);
return ecma_raise_standard_error (ECMA_ERROR_TYPE, (const lit_utf8_byte_t *) msg_p);
} /* ecma_raise_type_error */
/**
@@ -237,9 +238,9 @@ ecma_raise_type_error (const ecma_char_t *msg_p) /**< error message */
* Returned value must be freed with ecma_free_completion_value
*/
ecma_completion_value_t
ecma_raise_uri_error (const ecma_char_t *msg_p) /**< error message */
ecma_raise_uri_error (const char *msg_p) /**< error message */
{
return ecma_raise_standard_error (ECMA_ERROR_URI, msg_p);
return ecma_raise_standard_error (ECMA_ERROR_URI, (const lit_utf8_byte_t *) msg_p);
} /* ecma_raise_uri_error */
/**