Renaming ecma_* identifiers from 'camelCase' to 'underscore_naming'.
This commit is contained in:
+160
-160
@@ -30,7 +30,7 @@
|
||||
* Compress pointer.
|
||||
*/
|
||||
uintptr_t
|
||||
ecma_CompressPointer(void *pointer) /**< pointer to compress */
|
||||
ecma_compress_pointer(void *pointer) /**< pointer to compress */
|
||||
{
|
||||
if ( pointer == NULL )
|
||||
{
|
||||
@@ -47,13 +47,13 @@ ecma_CompressPointer(void *pointer) /**< pointer to compress */
|
||||
JERRY_ASSERT((intPtr & ~((1u << ECMA_POINTER_FIELD_WIDTH) - 1)) == 0);
|
||||
|
||||
return intPtr;
|
||||
} /* ecma_CompressPointer */
|
||||
} /* ecma_compress_pointer */
|
||||
|
||||
/**
|
||||
* Decompress pointer.
|
||||
*/
|
||||
void*
|
||||
ecma_DecompressPointer(uintptr_t compressedPointer) /**< pointer to decompress */
|
||||
ecma_decompress_pointer(uintptr_t compressedPointer) /**< pointer to decompress */
|
||||
{
|
||||
if ( compressedPointer == ECMA_NULL_POINTER )
|
||||
{
|
||||
@@ -66,7 +66,7 @@ ecma_DecompressPointer(uintptr_t compressedPointer) /**< pointer to decompress *
|
||||
intPtr += mem_get_base_pointer();
|
||||
|
||||
return (void*) intPtr;
|
||||
} /* ecma_DecompressPointer */
|
||||
} /* ecma_decompress_pointer */
|
||||
|
||||
/**
|
||||
* Create an object with specified prototype object
|
||||
@@ -77,11 +77,11 @@ ecma_DecompressPointer(uintptr_t compressedPointer) /**< pointer to decompress *
|
||||
*
|
||||
* @return pointer to the object's descriptor
|
||||
*/
|
||||
ecma_Object_t*
|
||||
ecma_CreateObject( ecma_Object_t *pPrototypeObject, /**< pointer to prototybe of the object (or NULL) */
|
||||
ecma_object_t*
|
||||
ecma_create_object( ecma_object_t *pPrototypeObject, /**< pointer to prototybe of the object (or NULL) */
|
||||
bool isExtensible) /**< value of extensible attribute */
|
||||
{
|
||||
ecma_Object_t *pObject = ecma_AllocObject();
|
||||
ecma_object_t *pObject = ecma_alloc_object();
|
||||
|
||||
pObject->pProperties = ECMA_NULL_POINTER;
|
||||
pObject->IsLexicalEnvironment = false;
|
||||
@@ -92,10 +92,10 @@ ecma_CreateObject( ecma_Object_t *pPrototypeObject, /**< pointer to prototybe of
|
||||
pObject->GCInfo.u.Refs = 1;
|
||||
|
||||
pObject->u.Object.Extensible = isExtensible;
|
||||
ecma_SetPointer( pObject->u.Object.pPrototypeObject, pPrototypeObject);
|
||||
ecma_set_pointer( pObject->u.Object.pPrototypeObject, pPrototypeObject);
|
||||
|
||||
return pObject;
|
||||
} /* ecma_CreateObject */
|
||||
} /* ecma_create_object */
|
||||
|
||||
/**
|
||||
* Create a lexical environment with specified outer lexical environment
|
||||
@@ -109,11 +109,11 @@ ecma_CreateObject( ecma_Object_t *pPrototypeObject, /**< pointer to prototybe of
|
||||
*
|
||||
* @return pointer to the descriptor of lexical environment
|
||||
*/
|
||||
ecma_Object_t*
|
||||
ecma_CreateLexicalEnvironment(ecma_Object_t *pOuterLexicalEnvironment, /**< outer lexical environment */
|
||||
ecma_LexicalEnvironmentType_t type) /**< type of lexical environment to create */
|
||||
ecma_object_t*
|
||||
ecma_create_lexical_environment(ecma_object_t *pOuterLexicalEnvironment, /**< outer lexical environment */
|
||||
ecma_lexical_environment_type_t type) /**< type of lexical environment to create */
|
||||
{
|
||||
ecma_Object_t *pNewLexicalEnvironment = ecma_AllocObject();
|
||||
ecma_object_t *pNewLexicalEnvironment = ecma_alloc_object();
|
||||
|
||||
pNewLexicalEnvironment->IsLexicalEnvironment = true;
|
||||
pNewLexicalEnvironment->u.LexicalEnvironment.Type = type;
|
||||
@@ -123,10 +123,10 @@ ecma_CreateLexicalEnvironment(ecma_Object_t *pOuterLexicalEnvironment, /**< oute
|
||||
pNewLexicalEnvironment->GCInfo.IsObjectValid = true;
|
||||
pNewLexicalEnvironment->GCInfo.u.Refs = 1;
|
||||
|
||||
ecma_SetPointer( pNewLexicalEnvironment->u.LexicalEnvironment.pOuterReference, pOuterLexicalEnvironment);
|
||||
ecma_set_pointer( pNewLexicalEnvironment->u.LexicalEnvironment.pOuterReference, pOuterLexicalEnvironment);
|
||||
|
||||
return pNewLexicalEnvironment;
|
||||
} /* ecma_CreateLexicalEnvironment */
|
||||
} /* ecma_create_lexical_environment */
|
||||
|
||||
/**
|
||||
* Create internal property in an object and link it
|
||||
@@ -134,22 +134,22 @@ ecma_CreateLexicalEnvironment(ecma_Object_t *pOuterLexicalEnvironment, /**< oute
|
||||
*
|
||||
* @return pointer to newly created property's des
|
||||
*/
|
||||
ecma_Property_t*
|
||||
ecma_CreateInternalProperty(ecma_Object_t *pObject, /**< the object */
|
||||
ecma_InternalPropertyId_t propertyId) /**< internal property identifier */
|
||||
ecma_property_t*
|
||||
ecma_create_internal_property(ecma_object_t *pObject, /**< the object */
|
||||
ecma_internal_property_id_t propertyId) /**< internal property identifier */
|
||||
{
|
||||
ecma_Property_t *pNewProperty = ecma_AllocProperty();
|
||||
ecma_property_t *pNewProperty = ecma_alloc_property();
|
||||
|
||||
pNewProperty->Type = ECMA_PROPERTY_INTERNAL;
|
||||
|
||||
ecma_SetPointer( pNewProperty->pNextProperty, ecma_GetPointer( pObject->pProperties));
|
||||
ecma_SetPointer( pObject->pProperties, pNewProperty);
|
||||
ecma_set_pointer( pNewProperty->pNextProperty, ecma_get_pointer( pObject->pProperties));
|
||||
ecma_set_pointer( pObject->pProperties, pNewProperty);
|
||||
|
||||
pNewProperty->u.InternalProperty.InternalPropertyType = propertyId;
|
||||
pNewProperty->u.InternalProperty.Value = ECMA_NULL_POINTER;
|
||||
|
||||
return pNewProperty;
|
||||
} /* ecma_CreateInternalProperty */
|
||||
} /* ecma_create_internal_property */
|
||||
|
||||
/**
|
||||
* Find internal property in the object's property set.
|
||||
@@ -157,18 +157,18 @@ ecma_CreateInternalProperty(ecma_Object_t *pObject, /**< the object */
|
||||
* @return pointer to the property, if it is found,
|
||||
* NULL - otherwise.
|
||||
*/
|
||||
ecma_Property_t*
|
||||
ecma_FindInternalProperty(ecma_Object_t *pObject, /**< object descriptor */
|
||||
ecma_InternalPropertyId_t propertyId) /**< internal property identifier */
|
||||
ecma_property_t*
|
||||
ecma_find_internal_property(ecma_object_t *pObject, /**< object descriptor */
|
||||
ecma_internal_property_id_t propertyId) /**< internal property identifier */
|
||||
{
|
||||
JERRY_ASSERT( pObject != NULL );
|
||||
|
||||
JERRY_ASSERT( propertyId != ECMA_INTERNAL_PROPERTY_PROTOTYPE
|
||||
&& propertyId != ECMA_INTERNAL_PROPERTY_EXTENSIBLE );
|
||||
|
||||
for ( ecma_Property_t *pProperty = ecma_GetPointer( pObject->pProperties);
|
||||
for ( ecma_property_t *pProperty = ecma_get_pointer( pObject->pProperties);
|
||||
pProperty != NULL;
|
||||
pProperty = ecma_GetPointer( pProperty->pNextProperty) )
|
||||
pProperty = ecma_get_pointer( pProperty->pNextProperty) )
|
||||
{
|
||||
if ( pProperty->Type == ECMA_PROPERTY_INTERNAL )
|
||||
{
|
||||
@@ -180,7 +180,7 @@ ecma_FindInternalProperty(ecma_Object_t *pObject, /**< object descriptor */
|
||||
}
|
||||
|
||||
return NULL;
|
||||
} /* ecma_FindInternalProperty */
|
||||
} /* ecma_find_internal_property */
|
||||
|
||||
/**
|
||||
* Get an internal property.
|
||||
@@ -190,16 +190,16 @@ ecma_FindInternalProperty(ecma_Object_t *pObject, /**< object descriptor */
|
||||
*
|
||||
* @return pointer to the property
|
||||
*/
|
||||
ecma_Property_t*
|
||||
ecma_GetInternalProperty(ecma_Object_t *pObject, /**< object descriptor */
|
||||
ecma_InternalPropertyId_t propertyId) /**< internal property identifier */
|
||||
ecma_property_t*
|
||||
ecma_get_internal_property(ecma_object_t *pObject, /**< object descriptor */
|
||||
ecma_internal_property_id_t propertyId) /**< internal property identifier */
|
||||
{
|
||||
ecma_Property_t *pProperty = ecma_FindInternalProperty( pObject, propertyId);
|
||||
ecma_property_t *pProperty = ecma_find_internal_property( pObject, propertyId);
|
||||
|
||||
JERRY_ASSERT( pProperty != NULL );
|
||||
|
||||
return pProperty;
|
||||
} /* ecma_GetInternalProperty */
|
||||
} /* ecma_get_internal_property */
|
||||
|
||||
/**
|
||||
* Create named data property with given name, attributes and undefined value
|
||||
@@ -207,32 +207,32 @@ ecma_GetInternalProperty(ecma_Object_t *pObject, /**< object descriptor */
|
||||
*
|
||||
* @return pointer to newly created property
|
||||
*/
|
||||
ecma_Property_t*
|
||||
ecma_CreateNamedProperty(ecma_Object_t *obj_p, /**< object */
|
||||
ecma_Char_t *name_p, /**< property name */
|
||||
ecma_PropertyWritableValue_t writable, /**< 'writable' attribute */
|
||||
ecma_PropertyEnumerableValue_t enumerable, /**< 'enumerable' attribute */
|
||||
ecma_PropertyConfigurableValue_t configurable) /**< 'configurable' attribute */
|
||||
ecma_property_t*
|
||||
ecma_create_named_property(ecma_object_t *obj_p, /**< object */
|
||||
ecma_char_t *name_p, /**< property name */
|
||||
ecma_property_writable_value_t writable, /**< 'writable' attribute */
|
||||
ecma_property_enumerable_value_t enumerable, /**< 'enumerable' attribute */
|
||||
ecma_property_configurable_value_t configurable) /**< 'configurable' attribute */
|
||||
{
|
||||
JERRY_ASSERT( obj_p != NULL && name_p != NULL );
|
||||
|
||||
ecma_Property_t *prop = ecma_AllocProperty();
|
||||
ecma_property_t *prop = ecma_alloc_property();
|
||||
|
||||
prop->Type = ECMA_PROPERTY_NAMEDDATA;
|
||||
|
||||
ecma_SetPointer( prop->u.NamedDataProperty.pName, ecma_NewEcmaString( name_p));
|
||||
ecma_set_pointer( prop->u.NamedDataProperty.pName, ecma_new_ecma_string( name_p));
|
||||
|
||||
prop->u.NamedDataProperty.Writable = writable;
|
||||
prop->u.NamedDataProperty.Enumerable = enumerable;
|
||||
prop->u.NamedDataProperty.Configurable = configurable;
|
||||
|
||||
prop->u.NamedDataProperty.Value = ecma_MakeSimpleValue( ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
prop->u.NamedDataProperty.Value = ecma_make_simple_value( ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
|
||||
ecma_SetPointer( prop->pNextProperty, ecma_GetPointer( obj_p->pProperties));
|
||||
ecma_SetPointer( obj_p->pProperties, prop);
|
||||
ecma_set_pointer( prop->pNextProperty, ecma_get_pointer( obj_p->pProperties));
|
||||
ecma_set_pointer( obj_p->pProperties, prop);
|
||||
|
||||
return prop;
|
||||
} /* ecma_CreateNamedProperty */
|
||||
} /* ecma_create_named_property */
|
||||
|
||||
/**
|
||||
* Find named data property or named access property in specified object.
|
||||
@@ -240,25 +240,25 @@ ecma_CreateNamedProperty(ecma_Object_t *obj_p, /**< object */
|
||||
* @return pointer to the property, if it is found,
|
||||
* NULL - otherwise.
|
||||
*/
|
||||
ecma_Property_t*
|
||||
ecma_FindNamedProperty(ecma_Object_t *obj_p, /**< object to find property in */
|
||||
ecma_Char_t *name_p) /**< property's name */
|
||||
ecma_property_t*
|
||||
ecma_find_named_property(ecma_object_t *obj_p, /**< object to find property in */
|
||||
ecma_char_t *name_p) /**< property's name */
|
||||
{
|
||||
JERRY_ASSERT( obj_p != NULL );
|
||||
JERRY_ASSERT( name_p != NULL );
|
||||
|
||||
for ( ecma_Property_t *property_p = ecma_GetPointer( obj_p->pProperties);
|
||||
for ( ecma_property_t *property_p = ecma_get_pointer( obj_p->pProperties);
|
||||
property_p != NULL;
|
||||
property_p = ecma_GetPointer( property_p->pNextProperty) )
|
||||
property_p = ecma_get_pointer( property_p->pNextProperty) )
|
||||
{
|
||||
ecma_ArrayFirstChunk_t *property_name_p;
|
||||
ecma_array_first_chunk_t *property_name_p;
|
||||
|
||||
if ( property_p->Type == ECMA_PROPERTY_NAMEDDATA )
|
||||
{
|
||||
property_name_p = ecma_GetPointer( property_p->u.NamedDataProperty.pName);
|
||||
property_name_p = ecma_get_pointer( property_p->u.NamedDataProperty.pName);
|
||||
} else if ( property_p->Type == ECMA_PROPERTY_NAMEDACCESSOR )
|
||||
{
|
||||
property_name_p = ecma_GetPointer( property_p->u.NamedAccessorProperty.pName);
|
||||
property_name_p = ecma_get_pointer( property_p->u.NamedAccessorProperty.pName);
|
||||
} else
|
||||
{
|
||||
continue;
|
||||
@@ -266,14 +266,14 @@ ecma_FindNamedProperty(ecma_Object_t *obj_p, /**< object to find property in */
|
||||
|
||||
JERRY_ASSERT( property_name_p != NULL );
|
||||
|
||||
if ( ecma_CompareZtStringToEcmaString( name_p, property_name_p) )
|
||||
if ( ecma_compare_zt_string_to_ecma_string( name_p, property_name_p) )
|
||||
{
|
||||
return property_p;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
} /* ecma_FindNamedProperty */
|
||||
} /* ecma_find_named_property */
|
||||
|
||||
/**
|
||||
* Get named data property or named access property in specified object.
|
||||
@@ -284,19 +284,19 @@ ecma_FindNamedProperty(ecma_Object_t *obj_p, /**< object to find property in */
|
||||
* @return pointer to the property, if it is found,
|
||||
* NULL - otherwise.
|
||||
*/
|
||||
ecma_Property_t*
|
||||
ecma_GetNamedProperty(ecma_Object_t *obj_p, /**< object to find property in */
|
||||
ecma_Char_t *name_p) /**< property's name */
|
||||
ecma_property_t*
|
||||
ecma_get_named_property(ecma_object_t *obj_p, /**< object to find property in */
|
||||
ecma_char_t *name_p) /**< property's name */
|
||||
{
|
||||
JERRY_ASSERT( obj_p != NULL );
|
||||
JERRY_ASSERT( name_p != NULL );
|
||||
|
||||
ecma_Property_t *property_p = ecma_FindNamedProperty( obj_p, name_p);
|
||||
ecma_property_t *property_p = ecma_find_named_property( obj_p, name_p);
|
||||
|
||||
JERRY_ASSERT( property_p != NULL );
|
||||
|
||||
return property_p;
|
||||
} /* ecma_GetNamedProperty */
|
||||
} /* ecma_get_named_property */
|
||||
|
||||
/**
|
||||
* Get named data property in specified object.
|
||||
@@ -307,69 +307,69 @@ ecma_GetNamedProperty(ecma_Object_t *obj_p, /**< object to find property in */
|
||||
* @return pointer to the property, if it is found,
|
||||
* NULL - otherwise.
|
||||
*/
|
||||
ecma_Property_t*
|
||||
ecma_GetNamedDataProperty(ecma_Object_t *obj_p, /**< object to find property in */
|
||||
ecma_Char_t *name_p) /**< property's name */
|
||||
ecma_property_t*
|
||||
ecma_get_named_data_property(ecma_object_t *obj_p, /**< object to find property in */
|
||||
ecma_char_t *name_p) /**< property's name */
|
||||
{
|
||||
JERRY_ASSERT( obj_p != NULL );
|
||||
JERRY_ASSERT( name_p != NULL );
|
||||
|
||||
ecma_Property_t *property_p = ecma_FindNamedProperty( obj_p, name_p);
|
||||
ecma_property_t *property_p = ecma_find_named_property( obj_p, name_p);
|
||||
|
||||
JERRY_ASSERT( property_p != NULL && property_p->Type == ECMA_PROPERTY_NAMEDDATA );
|
||||
|
||||
return property_p;
|
||||
} /* ecma_GetNamedDataProperty */
|
||||
} /* ecma_get_named_data_property */
|
||||
|
||||
/**
|
||||
* Free the named data property and values it references.
|
||||
*/
|
||||
void
|
||||
ecma_FreeNamedDataProperty( ecma_Property_t *pProperty) /**< the property */
|
||||
ecma_free_named_data_property( ecma_property_t *pProperty) /**< the property */
|
||||
{
|
||||
JERRY_ASSERT( pProperty->Type == ECMA_PROPERTY_NAMEDDATA );
|
||||
|
||||
ecma_FreeArray( ecma_GetPointer( pProperty->u.NamedDataProperty.pName));
|
||||
ecma_FreeValue( pProperty->u.NamedDataProperty.Value);
|
||||
ecma_free_array( ecma_get_pointer( pProperty->u.NamedDataProperty.pName));
|
||||
ecma_free_value( pProperty->u.NamedDataProperty.Value);
|
||||
|
||||
ecma_DeallocProperty( pProperty);
|
||||
} /* ecma_FreeNamedDataProperty */
|
||||
ecma_dealloc_property( pProperty);
|
||||
} /* ecma_free_named_data_property */
|
||||
|
||||
/**
|
||||
* Free the named accessor property and values it references.
|
||||
*/
|
||||
void
|
||||
ecma_FreeNamedAccessorProperty( ecma_Property_t *pProperty) /**< the property */
|
||||
ecma_free_named_accessor_property( ecma_property_t *pProperty) /**< the property */
|
||||
{
|
||||
JERRY_ASSERT( pProperty->Type == ECMA_PROPERTY_NAMEDACCESSOR );
|
||||
|
||||
ecma_FreeArray( ecma_GetPointer( pProperty->u.NamedAccessorProperty.pName));
|
||||
ecma_free_array( ecma_get_pointer( pProperty->u.NamedAccessorProperty.pName));
|
||||
|
||||
ecma_Object_t *pGet = ecma_GetPointer(pProperty->u.NamedAccessorProperty.pGet);
|
||||
ecma_Object_t *pSet = ecma_GetPointer(pProperty->u.NamedAccessorProperty.pSet);
|
||||
ecma_object_t *pGet = ecma_get_pointer(pProperty->u.NamedAccessorProperty.pGet);
|
||||
ecma_object_t *pSet = ecma_get_pointer(pProperty->u.NamedAccessorProperty.pSet);
|
||||
|
||||
if ( pGet != NULL )
|
||||
{
|
||||
ecma_DerefObject( pGet);
|
||||
ecma_deref_object( pGet);
|
||||
}
|
||||
|
||||
if ( pSet != NULL )
|
||||
{
|
||||
ecma_DerefObject( pSet);
|
||||
ecma_deref_object( pSet);
|
||||
}
|
||||
|
||||
ecma_DeallocProperty( pProperty);
|
||||
} /* ecma_FreeNamedAccessorProperty */
|
||||
ecma_dealloc_property( pProperty);
|
||||
} /* ecma_free_named_accessor_property */
|
||||
|
||||
/**
|
||||
* Free the internal property and values it references.
|
||||
*/
|
||||
void
|
||||
ecma_FreeInternalProperty( ecma_Property_t *pProperty) /**< the property */
|
||||
ecma_free_internal_property( ecma_property_t *pProperty) /**< the property */
|
||||
{
|
||||
JERRY_ASSERT( pProperty->Type == ECMA_PROPERTY_INTERNAL );
|
||||
|
||||
ecma_InternalPropertyId_t propertyId = pProperty->u.InternalProperty.InternalPropertyType;
|
||||
ecma_internal_property_id_t propertyId = pProperty->u.InternalProperty.InternalPropertyType;
|
||||
uint32_t propertyValue = pProperty->u.InternalProperty.Value;
|
||||
|
||||
switch ( propertyId )
|
||||
@@ -378,58 +378,58 @@ ecma_FreeInternalProperty( ecma_Property_t *pProperty) /**< the property */
|
||||
case ECMA_INTERNAL_PROPERTY_NUMBER_INDEXED_ARRAY_VALUES: /* an array */
|
||||
case ECMA_INTERNAL_PROPERTY_STRING_INDEXED_ARRAY_VALUES: /* an array */
|
||||
{
|
||||
ecma_FreeArray( ecma_GetPointer( propertyValue));
|
||||
ecma_free_array( ecma_get_pointer( propertyValue));
|
||||
break;
|
||||
}
|
||||
|
||||
case ECMA_INTERNAL_PROPERTY_SCOPE: /* a lexical environment */
|
||||
case ECMA_INTERNAL_PROPERTY_BINDING_OBJECT: /* an object */
|
||||
{
|
||||
ecma_DerefObject( ecma_GetPointer( propertyValue));
|
||||
ecma_deref_object( ecma_get_pointer( propertyValue));
|
||||
break;
|
||||
}
|
||||
|
||||
case ECMA_INTERNAL_PROPERTY_PROTOTYPE: /* the property's value is located in ecma_Object_t */
|
||||
case ECMA_INTERNAL_PROPERTY_EXTENSIBLE: /* the property's value is located in ecma_Object_t */
|
||||
case ECMA_INTERNAL_PROPERTY_PROTOTYPE: /* the property's value is located in ecma_object_t */
|
||||
case ECMA_INTERNAL_PROPERTY_EXTENSIBLE: /* the property's value is located in ecma_object_t */
|
||||
case ECMA_INTERNAL_PROPERTY_PROVIDE_THIS: /* a boolean flag */
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ecma_DeallocProperty( pProperty);
|
||||
} /* ecma_FreeInternalProperty */
|
||||
ecma_dealloc_property( pProperty);
|
||||
} /* ecma_free_internal_property */
|
||||
|
||||
/**
|
||||
* Free the property and values it references.
|
||||
*/
|
||||
void
|
||||
ecma_FreeProperty(ecma_Property_t *prop_p) /**< property */
|
||||
ecma_free_property(ecma_property_t *prop_p) /**< property */
|
||||
{
|
||||
switch ( (ecma_PropertyType_t) prop_p->Type )
|
||||
switch ( (ecma_property_type_t) prop_p->Type )
|
||||
{
|
||||
case ECMA_PROPERTY_NAMEDDATA:
|
||||
{
|
||||
ecma_FreeNamedDataProperty( prop_p);
|
||||
ecma_free_named_data_property( prop_p);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case ECMA_PROPERTY_NAMEDACCESSOR:
|
||||
{
|
||||
ecma_FreeNamedAccessorProperty( prop_p);
|
||||
ecma_free_named_accessor_property( prop_p);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case ECMA_PROPERTY_INTERNAL:
|
||||
{
|
||||
ecma_FreeInternalProperty( prop_p);
|
||||
ecma_free_internal_property( prop_p);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
} /* ecma_FreeProperty */
|
||||
} /* ecma_free_property */
|
||||
|
||||
/**
|
||||
* Delete the object's property.
|
||||
@@ -437,25 +437,25 @@ ecma_FreeProperty(ecma_Property_t *prop_p) /**< property */
|
||||
* Warning: specified property must be owned by specified object.
|
||||
*/
|
||||
void
|
||||
ecma_DeleteProperty(ecma_Object_t *obj_p, /**< object */
|
||||
ecma_Property_t *prop_p) /**< property */
|
||||
ecma_delete_property(ecma_object_t *obj_p, /**< object */
|
||||
ecma_property_t *prop_p) /**< property */
|
||||
{
|
||||
for ( ecma_Property_t *cur_prop_p = ecma_GetPointer( obj_p->pProperties), *prev_prop_p = NULL, *next_prop_p;
|
||||
for ( ecma_property_t *cur_prop_p = ecma_get_pointer( obj_p->pProperties), *prev_prop_p = NULL, *next_prop_p;
|
||||
cur_prop_p != NULL;
|
||||
prev_prop_p = cur_prop_p, cur_prop_p = next_prop_p )
|
||||
{
|
||||
next_prop_p = ecma_GetPointer( cur_prop_p->pNextProperty);
|
||||
next_prop_p = ecma_get_pointer( cur_prop_p->pNextProperty);
|
||||
|
||||
if ( cur_prop_p == prop_p )
|
||||
{
|
||||
ecma_FreeProperty( prop_p);
|
||||
ecma_free_property( prop_p);
|
||||
|
||||
if ( prev_prop_p == NULL )
|
||||
{
|
||||
ecma_SetPointer( obj_p->pProperties, next_prop_p);
|
||||
ecma_set_pointer( obj_p->pProperties, next_prop_p);
|
||||
} else
|
||||
{
|
||||
ecma_SetPointer( prev_prop_p->pNextProperty, next_prop_p);
|
||||
ecma_set_pointer( prev_prop_p->pNextProperty, next_prop_p);
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -463,62 +463,62 @@ ecma_DeleteProperty(ecma_Object_t *obj_p, /**< object */
|
||||
}
|
||||
|
||||
JERRY_UNREACHABLE();
|
||||
} /* ecma_DeleteProperty */
|
||||
} /* ecma_delete_property */
|
||||
|
||||
/**
|
||||
* Allocate new ecma-string and fill it with characters from specified buffer
|
||||
*
|
||||
* @return Pointer to first chunk of an array, containing allocated string
|
||||
*/
|
||||
ecma_ArrayFirstChunk_t*
|
||||
ecma_NewEcmaString(const ecma_Char_t *pString) /**< zero-terminated string of ecma-characters */
|
||||
ecma_array_first_chunk_t*
|
||||
ecma_new_ecma_string(const ecma_char_t *pString) /**< zero-terminated string of ecma-characters */
|
||||
{
|
||||
ecma_Length_t length = 0;
|
||||
ecma_length_t length = 0;
|
||||
|
||||
/*
|
||||
* TODO: Do not precalculate length.
|
||||
*/
|
||||
if ( pString != NULL )
|
||||
{
|
||||
const ecma_Char_t *iter_p = pString;
|
||||
const ecma_char_t *iter_p = pString;
|
||||
while ( *iter_p++ )
|
||||
{
|
||||
length++;
|
||||
}
|
||||
}
|
||||
|
||||
ecma_ArrayFirstChunk_t *pStringFirstChunk = ecma_AllocArrayFirstChunk();
|
||||
ecma_array_first_chunk_t *pStringFirstChunk = ecma_alloc_array_first_chunk();
|
||||
|
||||
pStringFirstChunk->Header.UnitNumber = length;
|
||||
uint8_t *copyPointer = (uint8_t*) pString;
|
||||
size_t charsLeft = length;
|
||||
size_t charsToCopy = JERRY_MIN( length, sizeof (pStringFirstChunk->Data) / sizeof (ecma_Char_t));
|
||||
__memcpy(pStringFirstChunk->Data, copyPointer, charsToCopy * sizeof (ecma_Char_t));
|
||||
size_t charsToCopy = JERRY_MIN( length, sizeof (pStringFirstChunk->Data) / sizeof (ecma_char_t));
|
||||
__memcpy(pStringFirstChunk->Data, copyPointer, charsToCopy * sizeof (ecma_char_t));
|
||||
charsLeft -= charsToCopy;
|
||||
copyPointer += charsToCopy * sizeof (ecma_Char_t);
|
||||
copyPointer += charsToCopy * sizeof (ecma_char_t);
|
||||
|
||||
ecma_ArrayNonFirstChunk_t *pStringNonFirstChunk;
|
||||
ecma_array_non_first_chunk_t *pStringNonFirstChunk;
|
||||
|
||||
JERRY_STATIC_ASSERT( ECMA_POINTER_FIELD_WIDTH <= sizeof(uint16_t) * JERRY_BITSINBYTE );
|
||||
uint16_t *pNextChunkCompressedPointer = &pStringFirstChunk->Header.pNextChunk;
|
||||
|
||||
while ( charsLeft > 0 )
|
||||
{
|
||||
pStringNonFirstChunk = ecma_AllocArrayNonFirstChunk();
|
||||
pStringNonFirstChunk = ecma_alloc_array_non_first_chunk();
|
||||
|
||||
size_t charsToCopy = JERRY_MIN( charsLeft, sizeof (pStringNonFirstChunk->Data) / sizeof (ecma_Char_t));
|
||||
__memcpy(pStringNonFirstChunk->Data, copyPointer, charsToCopy * sizeof (ecma_Char_t));
|
||||
size_t charsToCopy = JERRY_MIN( charsLeft, sizeof (pStringNonFirstChunk->Data) / sizeof (ecma_char_t));
|
||||
__memcpy(pStringNonFirstChunk->Data, copyPointer, charsToCopy * sizeof (ecma_char_t));
|
||||
charsLeft -= charsToCopy;
|
||||
copyPointer += charsToCopy * sizeof (ecma_Char_t);
|
||||
copyPointer += charsToCopy * sizeof (ecma_char_t);
|
||||
|
||||
ecma_SetPointer( *pNextChunkCompressedPointer, pStringNonFirstChunk);
|
||||
ecma_set_pointer( *pNextChunkCompressedPointer, pStringNonFirstChunk);
|
||||
pNextChunkCompressedPointer = &pStringNonFirstChunk->pNextChunk;
|
||||
}
|
||||
|
||||
*pNextChunkCompressedPointer = ECMA_NULL_POINTER;
|
||||
|
||||
return pStringFirstChunk;
|
||||
} /* ecma_NewEcmaString */
|
||||
} /* ecma_new_ecma_string */
|
||||
|
||||
/**
|
||||
* Copy ecma-string's contents to a buffer.
|
||||
@@ -530,78 +530,78 @@ ecma_NewEcmaString(const ecma_Char_t *pString) /**< zero-terminated string of ec
|
||||
* to hold the string's content (in case size of buffer is insuficcient).
|
||||
*/
|
||||
ssize_t
|
||||
ecma_CopyEcmaStringCharsToBuffer(ecma_ArrayFirstChunk_t *pFirstChunk, /**< first chunk of ecma-string */
|
||||
ecma_copy_ecma_string_chars_to_buffer(ecma_array_first_chunk_t *pFirstChunk, /**< first chunk of ecma-string */
|
||||
uint8_t *pBuffer, /**< destination buffer */
|
||||
size_t bufferSize) /**< size of buffer */
|
||||
{
|
||||
ecma_Length_t stringLength = pFirstChunk->Header.UnitNumber;
|
||||
size_t requiredBufferSize = sizeof (ecma_Length_t) + sizeof (ecma_Char_t) * stringLength;
|
||||
ecma_length_t stringLength = pFirstChunk->Header.UnitNumber;
|
||||
size_t requiredBufferSize = sizeof (ecma_length_t) + sizeof (ecma_char_t) * stringLength;
|
||||
|
||||
if ( requiredBufferSize < bufferSize )
|
||||
{
|
||||
return -(ssize_t) requiredBufferSize;
|
||||
}
|
||||
|
||||
*(ecma_Length_t*) pBuffer = stringLength;
|
||||
*(ecma_length_t*) pBuffer = stringLength;
|
||||
|
||||
size_t charsLeft = stringLength;
|
||||
uint8_t *destPointer = pBuffer + sizeof (ecma_Length_t);
|
||||
size_t copyChunkChars = JERRY_MIN(sizeof (pFirstChunk->Data) / sizeof (ecma_Char_t),
|
||||
uint8_t *destPointer = pBuffer + sizeof (ecma_length_t);
|
||||
size_t copyChunkChars = JERRY_MIN(sizeof (pFirstChunk->Data) / sizeof (ecma_char_t),
|
||||
charsLeft);
|
||||
__memcpy( destPointer, pFirstChunk->Data, copyChunkChars * sizeof (ecma_Char_t));
|
||||
destPointer += copyChunkChars * sizeof (ecma_Char_t);
|
||||
__memcpy( destPointer, pFirstChunk->Data, copyChunkChars * sizeof (ecma_char_t));
|
||||
destPointer += copyChunkChars * sizeof (ecma_char_t);
|
||||
charsLeft -= copyChunkChars;
|
||||
|
||||
ecma_ArrayNonFirstChunk_t *pNonFirstChunk = ecma_GetPointer( pFirstChunk->Header.pNextChunk);
|
||||
ecma_array_non_first_chunk_t *pNonFirstChunk = ecma_get_pointer( pFirstChunk->Header.pNextChunk);
|
||||
|
||||
while ( charsLeft > 0 )
|
||||
{
|
||||
JERRY_ASSERT( charsLeft < stringLength );
|
||||
|
||||
copyChunkChars = JERRY_MIN(sizeof (pNonFirstChunk->Data) / sizeof (ecma_Char_t),
|
||||
copyChunkChars = JERRY_MIN(sizeof (pNonFirstChunk->Data) / sizeof (ecma_char_t),
|
||||
charsLeft);
|
||||
__memcpy( destPointer, pNonFirstChunk->Data, copyChunkChars * sizeof (ecma_Char_t));
|
||||
destPointer += copyChunkChars * sizeof (ecma_Char_t);
|
||||
__memcpy( destPointer, pNonFirstChunk->Data, copyChunkChars * sizeof (ecma_char_t));
|
||||
destPointer += copyChunkChars * sizeof (ecma_char_t);
|
||||
charsLeft -= copyChunkChars;
|
||||
|
||||
pNonFirstChunk = ecma_GetPointer( pNonFirstChunk->pNextChunk);
|
||||
pNonFirstChunk = ecma_get_pointer( pNonFirstChunk->pNextChunk);
|
||||
}
|
||||
|
||||
return (ssize_t) requiredBufferSize;
|
||||
} /* ecma_CopyEcmaStringCharsToBuffer */
|
||||
} /* ecma_copy_ecma_string_chars_to_buffer */
|
||||
|
||||
/**
|
||||
* Duplicate an ecma-string.
|
||||
*
|
||||
* @return pointer to new ecma-string's first chunk
|
||||
*/
|
||||
ecma_ArrayFirstChunk_t*
|
||||
ecma_DuplicateEcmaString( ecma_ArrayFirstChunk_t *pFirstChunk) /**< first chunk of string to duplicate */
|
||||
ecma_array_first_chunk_t*
|
||||
ecma_duplicate_ecma_string( ecma_array_first_chunk_t *pFirstChunk) /**< first chunk of string to duplicate */
|
||||
{
|
||||
JERRY_ASSERT( pFirstChunk != NULL );
|
||||
|
||||
ecma_ArrayFirstChunk_t *pFirstChunkCopy = ecma_AllocArrayFirstChunk();
|
||||
__memcpy( pFirstChunkCopy, pFirstChunk, sizeof (ecma_ArrayFirstChunk_t));
|
||||
ecma_array_first_chunk_t *pFirstChunkCopy = ecma_alloc_array_first_chunk();
|
||||
__memcpy( pFirstChunkCopy, pFirstChunk, sizeof (ecma_array_first_chunk_t));
|
||||
|
||||
ecma_ArrayNonFirstChunk_t *pNonFirstChunk, *pNonFirstChunkCopy;
|
||||
pNonFirstChunk = ecma_GetPointer( pFirstChunk->Header.pNextChunk);
|
||||
ecma_array_non_first_chunk_t *pNonFirstChunk, *pNonFirstChunkCopy;
|
||||
pNonFirstChunk = ecma_get_pointer( pFirstChunk->Header.pNextChunk);
|
||||
uint16_t *pNextPointer = &pFirstChunkCopy->Header.pNextChunk;
|
||||
|
||||
while ( pNonFirstChunk != NULL )
|
||||
{
|
||||
pNonFirstChunkCopy = ecma_AllocArrayNonFirstChunk();
|
||||
ecma_SetPointer( *pNextPointer, pNonFirstChunkCopy);
|
||||
pNonFirstChunkCopy = ecma_alloc_array_non_first_chunk();
|
||||
ecma_set_pointer( *pNextPointer, pNonFirstChunkCopy);
|
||||
pNextPointer = &pNonFirstChunkCopy->pNextChunk;
|
||||
|
||||
__memcpy( pNonFirstChunkCopy, pNonFirstChunk, sizeof (ecma_ArrayNonFirstChunk_t));
|
||||
__memcpy( pNonFirstChunkCopy, pNonFirstChunk, sizeof (ecma_array_non_first_chunk_t));
|
||||
|
||||
pNonFirstChunk = ecma_GetPointer( pNonFirstChunk->pNextChunk);
|
||||
pNonFirstChunk = ecma_get_pointer( pNonFirstChunk->pNextChunk);
|
||||
}
|
||||
|
||||
*pNextPointer = ECMA_NULL_POINTER;
|
||||
|
||||
return pFirstChunkCopy;
|
||||
} /* ecma_DuplicateEcmaString */
|
||||
} /* ecma_duplicate_ecma_string */
|
||||
|
||||
/**
|
||||
* Compare zero-terminated string to ecma-string
|
||||
@@ -610,11 +610,11 @@ ecma_DuplicateEcmaString( ecma_ArrayFirstChunk_t *pFirstChunk) /**< first chunk
|
||||
* false - otherwise.
|
||||
*/
|
||||
bool
|
||||
ecma_CompareEcmaStringToEcmaString(const ecma_ArrayFirstChunk_t *string1_p, /* ecma-string */
|
||||
const ecma_ArrayFirstChunk_t *string2_p) /* ecma-string */
|
||||
ecma_compare_ecma_string_to_ecma_string(const ecma_array_first_chunk_t *string1_p, /* ecma-string */
|
||||
const ecma_array_first_chunk_t *string2_p) /* ecma-string */
|
||||
{
|
||||
JERRY_UNIMPLEMENTED_REF_UNUSED_VARS( string1_p, string2_p);
|
||||
} /* ecma_CompareEcmaStringToEcmaString */
|
||||
} /* ecma_compare_ecma_string_to_ecma_string */
|
||||
|
||||
/**
|
||||
* Compare zero-terminated string to ecma-string
|
||||
@@ -623,22 +623,22 @@ ecma_CompareEcmaStringToEcmaString(const ecma_ArrayFirstChunk_t *string1_p, /* e
|
||||
* false - otherwise.
|
||||
*/
|
||||
bool
|
||||
ecma_CompareZtStringToEcmaString(const ecma_Char_t *pString, /**< zero-terminated string */
|
||||
const ecma_ArrayFirstChunk_t *pEcmaString) /* ecma-string */
|
||||
ecma_compare_zt_string_to_ecma_string(const ecma_char_t *pString, /**< zero-terminated string */
|
||||
const ecma_array_first_chunk_t *pEcmaString) /* ecma-string */
|
||||
{
|
||||
JERRY_ASSERT( pString != NULL );
|
||||
JERRY_ASSERT( pEcmaString != NULL );
|
||||
|
||||
const ecma_Char_t *str_iter_p = pString;
|
||||
ecma_Length_t ecma_str_len = pEcmaString->Header.UnitNumber;
|
||||
const ecma_Char_t *current_chunk_chars_cur = (ecma_Char_t*) pEcmaString->Data,
|
||||
*current_chunk_chars_end = (ecma_Char_t*) (pEcmaString->Data
|
||||
const ecma_char_t *str_iter_p = pString;
|
||||
ecma_length_t ecma_str_len = pEcmaString->Header.UnitNumber;
|
||||
const ecma_char_t *current_chunk_chars_cur = (ecma_char_t*) pEcmaString->Data,
|
||||
*current_chunk_chars_end = (ecma_char_t*) (pEcmaString->Data
|
||||
+ sizeof(pEcmaString->Data));
|
||||
|
||||
JERRY_STATIC_ASSERT( ECMA_POINTER_FIELD_WIDTH <= sizeof(uint16_t) * JERRY_BITSINBYTE );
|
||||
const uint16_t *next_chunk_compressed_pointer_p = &pEcmaString->Header.pNextChunk;
|
||||
|
||||
for ( ecma_Length_t str_index = 0;
|
||||
for ( ecma_length_t str_index = 0;
|
||||
str_index < ecma_str_len;
|
||||
str_index++, str_iter_p++, current_chunk_chars_cur++ )
|
||||
{
|
||||
@@ -647,12 +647,12 @@ ecma_CompareZtStringToEcmaString(const ecma_Char_t *pString, /**< zero-terminate
|
||||
if ( current_chunk_chars_cur == current_chunk_chars_end )
|
||||
{
|
||||
/* switching to next chunk */
|
||||
ecma_ArrayNonFirstChunk_t *next_chunk_p = ecma_GetPointer( *next_chunk_compressed_pointer_p);
|
||||
ecma_array_non_first_chunk_t *next_chunk_p = ecma_get_pointer( *next_chunk_compressed_pointer_p);
|
||||
|
||||
JERRY_ASSERT( next_chunk_p != NULL );
|
||||
|
||||
current_chunk_chars_cur = (ecma_Char_t*) pEcmaString->Data;
|
||||
current_chunk_chars_end = (ecma_Char_t*) (next_chunk_p->Data + sizeof(next_chunk_p->Data));
|
||||
current_chunk_chars_cur = (ecma_char_t*) pEcmaString->Data;
|
||||
current_chunk_chars_end = (ecma_char_t*) (next_chunk_p->Data + sizeof(next_chunk_p->Data));
|
||||
|
||||
next_chunk_compressed_pointer_p = &next_chunk_p->pNextChunk;
|
||||
}
|
||||
@@ -676,29 +676,29 @@ ecma_CompareZtStringToEcmaString(const ecma_Char_t *pString, /**< zero-terminate
|
||||
* Otherwise zero-terminated string is longer.
|
||||
*/
|
||||
return ( *str_iter_p == 0 );
|
||||
} /* ecma_CompareZtStringToEcmaString */
|
||||
} /* ecma_compare_zt_string_to_ecma_string */
|
||||
|
||||
/**
|
||||
* Free all chunks of an array
|
||||
*/
|
||||
void
|
||||
ecma_FreeArray( ecma_ArrayFirstChunk_t *pFirstChunk) /**< first chunk of the array */
|
||||
ecma_free_array( ecma_array_first_chunk_t *pFirstChunk) /**< first chunk of the array */
|
||||
{
|
||||
JERRY_ASSERT( pFirstChunk != NULL );
|
||||
|
||||
ecma_ArrayNonFirstChunk_t *pNonFirstChunk = ecma_GetPointer( pFirstChunk->Header.pNextChunk);
|
||||
ecma_array_non_first_chunk_t *pNonFirstChunk = ecma_get_pointer( pFirstChunk->Header.pNextChunk);
|
||||
|
||||
ecma_DeallocArrayFirstChunk( pFirstChunk);
|
||||
ecma_dealloc_array_first_chunk( pFirstChunk);
|
||||
|
||||
while ( pNonFirstChunk != NULL )
|
||||
{
|
||||
ecma_ArrayNonFirstChunk_t *pNextChunk = ecma_GetPointer( pNonFirstChunk->pNextChunk);
|
||||
ecma_array_non_first_chunk_t *pNextChunk = ecma_get_pointer( pNonFirstChunk->pNextChunk);
|
||||
|
||||
ecma_DeallocArrayNonFirstChunk( pNonFirstChunk);
|
||||
ecma_dealloc_array_non_first_chunk( pNonFirstChunk);
|
||||
|
||||
pNonFirstChunk = pNextChunk;
|
||||
}
|
||||
} /* ecma_FreeArray */
|
||||
} /* ecma_free_array */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
Reference in New Issue
Block a user