Skip to content

Support core unicode functionality #229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 29, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 9 additions & 68 deletions jerry-core/ecma/base/ecma-globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

#include "config.h"
#include "jrt.h"
#include "lit-globals.h"
#include "lit-magic-strings.h"
#include "mem-allocator.h"
#include "rcs-recordset.h"

Expand Down Expand Up @@ -566,24 +568,6 @@ typedef struct
bool is_configurable;
} ecma_property_descriptor_t;

#if CONFIG_ECMA_CHAR_ENCODING == CONFIG_ECMA_CHAR_ASCII
/**
* Description of an ecma-character
*/
typedef uint8_t ecma_char_t;
#elif CONFIG_ECMA_CHAR_ENCODING == CONFIG_ECMA_CHAR_UTF16
/**
* Description of an ecma-character
*/
typedef uint16_t ecma_char_t;
#endif /* CONFIG_ECMA_CHAR_ENCODING == CONFIG_ECMA_CHAR_UTF16 */

/**
* Description of an ecma-character pointer
*/
typedef ecma_char_t* ecma_char_ptr_t;


#if CONFIG_ECMA_NUMBER_TYPE == CONFIG_ECMA_NUMBER_FLOAT32
/**
* Description of an ecma-number
Expand Down Expand Up @@ -689,11 +673,6 @@ typedef double ecma_number_t;
*/
#define ECMA_NUMBER_SQRT2 ((ecma_number_t)1.4142135623730951)

/**
* Null character (zt-string end marker)
*/
#define ECMA_CHAR_NULL ((ecma_char_t) '\0')

/**
* Maximum number of characters in string representation of ecma-number
*/
Expand All @@ -712,22 +691,17 @@ typedef double ecma_number_t;
*/
#define ECMA_MAX_VALUE_OF_VALID_ARRAY_INDEX ((uint32_t) (-1))

/**
* Description of a collection's/string's length
*/
typedef uint16_t ecma_length_t;

/**
* Description of a collection's header.
*/
typedef struct
{
/** Compressed pointer to next chunk with collection's data */
mem_cpointer_t next_chunk_cp;

/** Number of elements in the collection */
ecma_length_t unit_number;

/** Compressed pointer to next chunk with collection's data */
mem_cpointer_t next_chunk_cp;

/** Place for the collection's data */
uint8_t data[ sizeof (uint64_t) - sizeof (mem_cpointer_t) - sizeof (ecma_length_t) ];
} ecma_collection_header_t;
Expand All @@ -741,7 +715,7 @@ typedef struct
mem_cpointer_t next_chunk_cp;

/** Characters */
uint8_t data[ sizeof (uint64_t) - sizeof (mem_cpointer_t) ];
lit_utf8_byte_t data[ sizeof (uint64_t) - sizeof (mem_cpointer_t) ];
} ecma_collection_chunk_t;

/**
Expand All @@ -768,39 +742,6 @@ FIXME (Move to library that should define the type (literal.h /* ? */))
typedef rcs_record_t *literal_t;
typedef rcs_cpointer_t lit_cpointer_t;

/**
* Identifiers of ECMA and implementation-defined magic string constants
*/
typedef enum
{
#define ECMA_MAGIC_STRING_DEF(id, ascii_zt_string) \
id,
#include "ecma-magic-strings.inc.h"
#undef ECMA_MAGIC_STRING_DEF

ECMA_MAGIC_STRING__COUNT /**< number of magic strings */
} ecma_magic_string_id_t;

/**
* Identifiers of implementation-defined external magic string constants
*/
typedef uint32_t ecma_magic_string_ex_id_t;

/**
* ECMA string hash
*/
typedef uint8_t ecma_string_hash_t;

/**
* Length of string hash, in bits
*/
#define ECMA_STRING_HASH_BITS (sizeof (ecma_string_hash_t) * JERRY_BITSINBYTE)

/**
* Number of string's last characters to use for hash calculation
*/
#define ECMA_STRING_HASH_LAST_CHARS_COUNT (2)

/**
* ECMA string-value descriptor
*/
Expand All @@ -817,7 +758,7 @@ typedef struct ecma_string_t
uint8_t container;

/** Hash of the string (calculated from two last characters of the string) */
ecma_string_hash_t hash;
lit_string_hash_t hash;

/**
* Actual data or identifier of it's place in container (depending on 'container' field)
Expand All @@ -844,10 +785,10 @@ typedef struct ecma_string_t
} concatenation;

/** Identifier of magic string */
ecma_magic_string_id_t magic_string_id;
lit_magic_string_id_t magic_string_id;

/** Identifier of external magic string */
ecma_magic_string_ex_id_t magic_string_ex_id;
lit_magic_string_ex_id_t magic_string_ex_id;

/** For zeroing and comparison in some cases */
uint32_t common_field;
Expand Down
Loading