Init commit for Date object.

JerryScript-DCO-1.0-Signed-off-by: Szilard Ledan szledan.u-szeged@partner.samsung.com
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
This commit is contained in:
László Langó
2015-06-12 17:58:36 +02:00
parent 8a9633dba0
commit d803c3bc82
8 changed files with 1035 additions and 7 deletions
@@ -54,6 +54,7 @@ ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_TYPE_ERROR_UL, "TypeError")
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_URI_ERROR_UL, "URIError")
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_MATH_UL, "Math")
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_JSON_U, "JSON")
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_PARSE, "parse")
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_PARSE_INT, "parseInt")
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_PARSE_FLOAT, "parseFloat")
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_IS_NAN, "isNaN")
@@ -150,12 +151,14 @@ ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_TRIM, "trim")
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_TO_FIXED_UL, "toFixed")
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_TO_EXPONENTIAL_UL, "toExponential")
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_TO_PRECISION_UL, "toPrecision")
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_NOW, "now")
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_TO_DATE_STRING_UL, "toDateString")
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_TO_TIME_STRING_UL, "toTimeString")
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_TO_LOCALE_DATE_STRING_UL, "toLocaleDateString")
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_TO_LOCALE_TIME_STRING_UL, "toLocaleTimeString")
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_GET_TIME_UL, "getTime")
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_GET_FULL_YEAR_UL, "getFullYear")
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_UTC_U, "UTC")
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_GET_UTC_FULL_YEAR_UL, "getUTCFullYear")
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_GET_MONTH_UL, "getMonth")
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_GET_UTC_MONTH_UL, "getUTCMonth")
@@ -0,0 +1,718 @@
/* Copyright 2015 Samsung Electronics Co., Ltd.
* Copyright 2015 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ecma-alloc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_DATE_BUILTIN
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-date-prototype.inc.h"
#define BUILTIN_UNDERSCORED_ID date_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
* @{
*
* \addtogroup ecmabuiltins
* @{
*
* \addtogroup dateprototype ECMA Date.prototype object built-in
* @{
*/
/**
* The Date.prototype object's 'toString' routine
*
* See also:
* ECMA-262 v5, 15.9.5.2
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_to_string (ecma_value_t this_arg) /**< this argument */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
} /* ecma_builtin_date_prototype_to_string */
/**
* The Date.prototype object's 'toDateString' routine
*
* See also:
* ECMA-262 v5, 15.9.5.3
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_to_date_string (ecma_value_t this_arg) /**< this argument */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
} /* ecma_builtin_date_prototype_to_date_string */
/**
* The Date.prototype object's 'toTimeString' routine
*
* See also:
* ECMA-262 v5, 15.9.5.4
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_to_time_string (ecma_value_t this_arg) /**< this argument */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
} /* ecma_builtin_date_prototype_to_time_string */
/**
* The Date.prototype object's 'toLocaleString' routine
*
* See also:
* ECMA-262 v5, 15.9.5.5
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_to_locale_string (ecma_value_t this_arg) /**< this argument */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
} /* ecma_builtin_date_prototype_to_locale_string */
/**
* The Date.prototype object's 'toLocaleDateString' routine
*
* See also:
* ECMA-262 v5, 15.9.5.6
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_to_locale_date_string (ecma_value_t this_arg) /**< this argument */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
} /* ecma_builtin_date_prototype_to_locale_date_string */
/**
* The Date.prototype object's 'toLocaleTimeString' routine
*
* See also:
* ECMA-262 v5, 15.9.5.7
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_to_locale_time_string (ecma_value_t this_arg) /**< this argument */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
} /* ecma_builtin_date_prototype_to_locale_time_string */
/**
* The Date.prototype object's 'valueOf' routine
*
* See also:
* ECMA-262 v5, 15.9.5.8
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_value_of (ecma_value_t this_arg) /**< this argument */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
} /* ecma_builtin_date_prototype_value_of */
/**
* The Date.prototype object's 'getTime' routine
*
* See also:
* ECMA-262 v5, 15.9.5.9
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_get_time (ecma_value_t this_arg) /**< this argument */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
} /* ecma_builtin_date_prototype_get_time */
/**
* The Date.prototype object's 'getFullYear' routine
*
* See also:
* ECMA-262 v5, 15.9.5.10
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_get_full_year (ecma_value_t this_arg) /**< this argument */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
} /* ecma_builtin_date_prototype_get_full_year */
/**
* The Date.prototype object's 'getUTCFullYear' routine
*
* See also:
* ECMA-262 v5, 15.9.5.11
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_get_utc_full_year (ecma_value_t this_arg) /**< this argument */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
} /* ecma_builtin_date_prototype_get_utc_full_year */
/**
* The Date.prototype object's 'getMonth' routine
*
* See also:
* ECMA-262 v5, 15.9.5.12
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_get_month (ecma_value_t this_arg) /**< this argument */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
} /* ecma_builtin_date_prototype_get_month */
/**
* The Date.prototype object's 'getUTCMonth' routine
*
* See also:
* ECMA-262 v5, 15.9.5.13
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_get_utc_month (ecma_value_t this_arg) /**< this argument */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
} /* ecma_builtin_date_prototype_get_utc_month */
/**
* The Date.prototype object's 'getDate' routine
*
* See also:
* ECMA-262 v5, 15.9.5.14
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_get_date (ecma_value_t this_arg) /**< this argument */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
} /* ecma_builtin_date_prototype_get_date */
/**
* The Date.prototype object's 'getUTCDate' routine
*
* See also:
* ECMA-262 v5, 15.9.5.15
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_get_utc_date (ecma_value_t this_arg) /**< this argument */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
} /* ecma_builtin_date_prototype_get_utc_date */
/**
* The Date.prototype object's 'getDay' routine
*
* See also:
* ECMA-262 v5, 15.9.5.16
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_get_day (ecma_value_t this_arg) /**< this argument */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
} /* ecma_builtin_date_prototype_get_day */
/**
* The Date.prototype object's 'getUTCDay' routine
*
* See also:
* ECMA-262 v5, 15.9.5.17
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_get_utc_day (ecma_value_t this_arg) /**< this argument */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
} /* ecma_builtin_date_prototype_get_utc_day */
/**
* The Date.prototype object's 'getHours' routine
*
* See also:
* ECMA-262 v5, 15.9.5.18
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_get_hours (ecma_value_t this_arg) /**< this argument */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
} /* ecma_builtin_date_prototype_get_hours */
/**
* The Date.prototype object's 'getUTCHours' routine
*
* See also:
* ECMA-262 v5, 15.9.5.19
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_get_utc_hours (ecma_value_t this_arg) /**< this argument */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
} /* ecma_builtin_date_prototype_get_utc_hours */
/**
* The Date.prototype object's 'getMinutes' routine
*
* See also:
* ECMA-262 v5, 15.9.5.20
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_get_minutes (ecma_value_t this_arg) /**< this argument */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
} /* ecma_builtin_date_prototype_get_minutes */
/**
* The Date.prototype object's 'getUTCMinutes' routine
*
* See also:
* ECMA-262 v5, 15.9.5.21
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_get_utc_minutes (ecma_value_t this_arg) /**< this argument */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
} /* ecma_builtin_date_prototype_get_utc_minutes */
/**
* The Date.prototype object's 'getSeconds' routine
*
* See also:
* ECMA-262 v5, 15.9.5.22
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_get_seconds (ecma_value_t this_arg) /**< this argument */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
} /* ecma_builtin_date_prototype_get_seconds */
/**
* The Date.prototype object's 'getUTCSeconds' routine
*
* See also:
* ECMA-262 v5, 15.9.5.23
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_get_utc_seconds (ecma_value_t this_arg) /**< this argument */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
} /* ecma_builtin_date_prototype_get_utc_seconds */
/**
* The Date.prototype object's 'getMilliseconds' routine
*
* See also:
* ECMA-262 v5, 15.9.5.24
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_get_milliseconds (ecma_value_t this_arg) /**< this argument */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
} /* ecma_builtin_date_prototype_get_milliseconds */
/**
* The Date.prototype object's 'getUTCMilliseconds' routine
*
* See also:
* ECMA-262 v5, 15.9.5.25
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_get_utc_milliseconds (ecma_value_t this_arg) /**< this argument */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
} /* ecma_builtin_date_prototype_get_utc_milliseconds */
/**
* The Date.prototype object's 'getTimezoneOffset' routine
*
* See also:
* ECMA-262 v5, 15.9.5.26
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_get_timezone_offset (ecma_value_t this_arg) /**< this argument */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
} /* ecma_builtin_date_prototype_get_timezone_offset */
/**
* The Date.prototype object's 'setTime' routine
*
* See also:
* ECMA-262 v5, 15.9.5.27
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_set_time (ecma_value_t this_arg, /**< this argument */
ecma_value_t arg) /**< time */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
} /* ecma_builtin_date_prototype_set_time */
/**
* The Date.prototype object's 'setMilliseconds' routine
*
* See also:
* ECMA-262 v5, 15.9.5.28
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_set_milliseconds (ecma_value_t this_arg, /**< this argument */
ecma_value_t arg) /**< millisecond */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
} /* ecma_builtin_date_prototype_set_milliseconds */
/**
* The Date.prototype object's 'setUTCMilliseconds' routine
*
* See also:
* ECMA-262 v5, 15.9.5.29
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_set_utc_milliseconds (ecma_value_t this_arg, /**< this argument */
ecma_value_t arg) /**< millisecond */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
} /* ecma_builtin_date_prototype_set_utc_milliseconds */
/**
* The Date.prototype object's 'setSeconds' routine
*
* See also:
* ECMA-262 v5, 15.9.5.30
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_set_seconds (ecma_value_t this_arg, /**< this argument */
ecma_value_t arg1, /**< second */
ecma_value_t arg2) /**< millisecond */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg1, arg2);
} /* ecma_builtin_date_prototype_set_seconds */
/**
* The Date.prototype object's 'setUTCSeconds' routine
*
* See also:
* ECMA-262 v5, 15.9.5.31
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_set_utc_seconds (ecma_value_t this_arg, /**< this argument */
ecma_value_t arg1, /**< second */
ecma_value_t arg2) /**< millisecond */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg1, arg2);
} /* ecma_builtin_date_prototype_set_utc_seconds */
/**
* The Date.prototype object's 'setMinutes' routine
*
* See also:
* ECMA-262 v5, 15.9.5.32
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_set_minutes (ecma_value_t this_arg, /**< this argument */
const ecma_value_t args[], /**< arguments list */
ecma_length_t args_number) /**< number of arguments */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, args, args_number);
} /* ecma_builtin_date_prototype_set_minutes */
/**
* The Date.prototype object's 'setUTCMinutes' routine
*
* See also:
* ECMA-262 v5, 15.9.5.33
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_set_utc_minutes (ecma_value_t this_arg, /**< this argument */
const ecma_value_t args[], /**< arguments list */
ecma_length_t args_number) /**< number of arguments */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, args, args_number);
} /* ecma_builtin_date_prototype_set_utc_minutes */
/**
* The Date.prototype object's 'setHours' routine
*
* See also:
* ECMA-262 v5, 15.9.5.34
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_set_hours (ecma_value_t this_arg, /**< this argument */
const ecma_value_t args[], /**< arguments list */
ecma_length_t args_number) /**< number of arguments */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, args, args_number);
} /* ecma_builtin_date_prototype_set_hours */
/**
* The Date.prototype object's 'setUTCHours' routine
*
* See also:
* ECMA-262 v5, 15.9.5.35
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_set_utc_hours (ecma_value_t this_arg, /**< this argument */
const ecma_value_t args[], /**< arguments list */
ecma_length_t args_number) /**< number of arguments */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, args, args_number);
} /* ecma_builtin_date_prototype_set_utc_hours */
/**
* The Date.prototype object's 'setDate' routine
*
* See also:
* ECMA-262 v5, 15.9.5.36
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_set_date (ecma_value_t this_arg, /**< this argument */
ecma_value_t arg) /**< date */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
} /* ecma_builtin_date_prototype_set_date */
/**
* The Date.prototype object's 'setUTCDate' routine
*
* See also:
* ECMA-262 v5, 15.9.5.37
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_set_utc_date (ecma_value_t this_arg, /**< this argument */
ecma_value_t arg) /**< date */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
} /* ecma_builtin_date_prototype_set_utc_date */
/**
* The Date.prototype object's 'setMonth' routine
*
* See also:
* ECMA-262 v5, 15.9.5.38
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_set_month (ecma_value_t this_arg, /**< this argument */
ecma_value_t arg1, /**< month */
ecma_value_t arg2) /**< day */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg1, arg2);
} /* ecma_builtin_date_prototype_set_month */
/**
* The Date.prototype object's 'setUTCMonth' routine
*
* See also:
* ECMA-262 v5, 15.9.5.39
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_set_utc_month (ecma_value_t this_arg, /**< this argument */
ecma_value_t arg1, /**< month */
ecma_value_t arg2) /**< day */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg1, arg2);
} /* ecma_builtin_date_prototype_set_utc_month */
/**
* The Date.prototype object's 'setFullYear' routine
*
* See also:
* ECMA-262 v5, 15.9.5.40
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_set_full_year (ecma_value_t this_arg, /**< this argument */
const ecma_value_t args[], /**< arguments list */
ecma_length_t args_number) /**< number of arguments */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, args, args_number);
} /* ecma_builtin_date_prototype_set_full_year */
/**
* The Date.prototype object's 'setUTCFullYear' routine
*
* See also:
* ECMA-262 v5, 15.9.5.41
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_set_utc_full_year (ecma_value_t this_arg, /**< this argument */
const ecma_value_t args[], /**< arguments list */
ecma_length_t args_number) /**< number of arguments */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, args, args_number);
} /* ecma_builtin_date_prototype_set_utc_full_year */
/**
* The Date.prototype object's 'toUTCString' routine
*
* See also:
* ECMA-262 v5, 15.9.5.42
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_to_utc_string (ecma_value_t this_arg) /**< this argument */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
} /* ecma_builtin_date_prototype_to_utc_string */
/**
* The Date.prototype object's 'toISOString' routine
*
* See also:
* ECMA-262 v5, 15.9.5.43
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_to_iso_string (ecma_value_t this_arg) /**< this argument */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
} /* ecma_builtin_date_prototype_to_iso_string */
/**
* The Date.prototype object's 'toJSON' routine
*
* See also:
* ECMA-262 v5, 15.9.5.44
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_prototype_to_json (ecma_value_t this_arg, /**< this argument */
ecma_value_t arg) /**< key */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
} /* ecma_builtin_date_prototype_to_json */
/**
* @}
* @}
* @}
*/
#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_DATE_BUILTIN */
@@ -0,0 +1,92 @@
/* Copyright 2015 Samsung Electronics Co., Ltd.
* Copyright 2015 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Date.prototype built-in description
*/
#ifndef OBJECT_ID
# define OBJECT_ID(builtin_object_id)
#endif /* !OBJECT_ID */
#ifndef OBJECT_VALUE
# define OBJECT_VALUE(name, obj_getter, prop_writable, prop_enumerable, prop_configurable)
#endif /* !OBJECT_VALUE */
#ifndef ROUTINE
# define ROUTINE(name, c_function_name, args_number, length_prop_value)
#endif /* !ROUTINE */
/* Object identifier */
OBJECT_ID (ECMA_BUILTIN_ID_DATE_PROTOTYPE)
OBJECT_VALUE (ECMA_MAGIC_STRING_CONSTRUCTOR,
ecma_builtin_get (ECMA_BUILTIN_ID_DATE),
ECMA_PROPERTY_WRITABLE,
ECMA_PROPERTY_NOT_ENUMERABLE,
ECMA_PROPERTY_CONFIGURABLE)
ROUTINE (ECMA_MAGIC_STRING_TO_STRING_UL, ecma_builtin_date_prototype_to_string, 0, 0)
ROUTINE (ECMA_MAGIC_STRING_TO_DATE_STRING_UL, ecma_builtin_date_prototype_to_date_string, 0, 0)
ROUTINE (ECMA_MAGIC_STRING_TO_TIME_STRING_UL, ecma_builtin_date_prototype_to_time_string, 0, 0)
ROUTINE (ECMA_MAGIC_STRING_TO_LOCALE_STRING_UL, ecma_builtin_date_prototype_to_locale_string, 0, 0)
ROUTINE (ECMA_MAGIC_STRING_TO_LOCALE_DATE_STRING_UL, ecma_builtin_date_prototype_to_locale_date_string, 0, 0)
ROUTINE (ECMA_MAGIC_STRING_TO_LOCALE_TIME_STRING_UL, ecma_builtin_date_prototype_to_locale_time_string, 0, 0)
ROUTINE (ECMA_MAGIC_STRING_VALUE_OF_UL, ecma_builtin_date_prototype_value_of, 0, 0)
ROUTINE (ECMA_MAGIC_STRING_GET_TIME_UL, ecma_builtin_date_prototype_get_time, 0, 0)
ROUTINE (ECMA_MAGIC_STRING_GET_FULL_YEAR_UL, ecma_builtin_date_prototype_get_full_year, 0, 0)
ROUTINE (ECMA_MAGIC_STRING_GET_UTC_FULL_YEAR_UL, ecma_builtin_date_prototype_get_utc_full_year, 0, 0)
ROUTINE (ECMA_MAGIC_STRING_GET_MONTH_UL, ecma_builtin_date_prototype_get_month, 0, 0)
ROUTINE (ECMA_MAGIC_STRING_GET_UTC_MONTH_UL, ecma_builtin_date_prototype_get_utc_month, 0, 0)
ROUTINE (ECMA_MAGIC_STRING_GET_DATE_UL, ecma_builtin_date_prototype_get_date, 0, 0)
ROUTINE (ECMA_MAGIC_STRING_GET_UTC_DATE_UL, ecma_builtin_date_prototype_get_utc_date, 0, 0)
ROUTINE (ECMA_MAGIC_STRING_GET_DAY_UL, ecma_builtin_date_prototype_get_day, 0, 0)
ROUTINE (ECMA_MAGIC_STRING_GET_UTC_DAY_UL, ecma_builtin_date_prototype_get_utc_day, 0, 0)
ROUTINE (ECMA_MAGIC_STRING_GET_HOURS_UL, ecma_builtin_date_prototype_get_hours, 0, 0)
ROUTINE (ECMA_MAGIC_STRING_GET_UTC_HOURS_UL, ecma_builtin_date_prototype_get_utc_hours, 0, 0)
ROUTINE (ECMA_MAGIC_STRING_GET_MINUTES_UL, ecma_builtin_date_prototype_get_minutes, 0, 0)
ROUTINE (ECMA_MAGIC_STRING_GET_UTC_MINUTES_UL, ecma_builtin_date_prototype_get_utc_minutes, 0, 0)
ROUTINE (ECMA_MAGIC_STRING_GET_SECONDS_UL, ecma_builtin_date_prototype_get_seconds, 0, 0)
ROUTINE (ECMA_MAGIC_STRING_GET_UTC_SECONDS_UL, ecma_builtin_date_prototype_get_utc_seconds, 0, 0)
ROUTINE (ECMA_MAGIC_STRING_GET_MILLISECONDS_UL, ecma_builtin_date_prototype_get_milliseconds, 0, 0)
ROUTINE (ECMA_MAGIC_STRING_GET_UTC_MILLISECONDS_UL, ecma_builtin_date_prototype_get_utc_milliseconds, 0, 0)
ROUTINE (ECMA_MAGIC_STRING_GET_TIMEZONE_OFFSET_UL, ecma_builtin_date_prototype_get_timezone_offset, 0, 0)
ROUTINE (ECMA_MAGIC_STRING_SET_TIME_UL, ecma_builtin_date_prototype_set_time, 1, 1)
ROUTINE (ECMA_MAGIC_STRING_SET_MILLISECONDS_UL, ecma_builtin_date_prototype_set_milliseconds, 1, 1)
ROUTINE (ECMA_MAGIC_STRING_SET_UTC_MILLISECONDS_UL, ecma_builtin_date_prototype_set_utc_milliseconds, 1, 1)
ROUTINE (ECMA_MAGIC_STRING_SET_SECONDS_UL, ecma_builtin_date_prototype_set_seconds, 2, 2)
ROUTINE (ECMA_MAGIC_STRING_SET_UTC_SECONDS_UL, ecma_builtin_date_prototype_set_utc_seconds, 2, 2)
ROUTINE (ECMA_MAGIC_STRING_SET_MINUTES_UL, ecma_builtin_date_prototype_set_minutes, NON_FIXED, 3)
ROUTINE (ECMA_MAGIC_STRING_SET_UTC_MINUTES_UL, ecma_builtin_date_prototype_set_utc_minutes, NON_FIXED, 3)
ROUTINE (ECMA_MAGIC_STRING_SET_HOURS_UL, ecma_builtin_date_prototype_set_hours, NON_FIXED, 4)
ROUTINE (ECMA_MAGIC_STRING_SET_UTC_HOURS_UL, ecma_builtin_date_prototype_set_utc_hours, NON_FIXED, 4)
ROUTINE (ECMA_MAGIC_STRING_SET_DATE_UL, ecma_builtin_date_prototype_set_date, 1, 1)
ROUTINE (ECMA_MAGIC_STRING_SET_UTC_DATE_UL, ecma_builtin_date_prototype_set_utc_date, 1, 1)
ROUTINE (ECMA_MAGIC_STRING_SET_MONTH_UL, ecma_builtin_date_prototype_set_month, 2, 2)
ROUTINE (ECMA_MAGIC_STRING_SET_UTC_MONTH_UL, ecma_builtin_date_prototype_set_utc_month, 2, 2)
ROUTINE (ECMA_MAGIC_STRING_SET_FULL_YEAR_UL, ecma_builtin_date_prototype_set_full_year, NON_FIXED, 3)
ROUTINE (ECMA_MAGIC_STRING_SET_UTC_FULL_YEAR_UL, ecma_builtin_date_prototype_set_utc_full_year, NON_FIXED, 3)
ROUTINE (ECMA_MAGIC_STRING_TO_UTC_STRING_UL, ecma_builtin_date_prototype_to_utc_string, 0, 0)
ROUTINE (ECMA_MAGIC_STRING_TO_ISO_STRING_UL, ecma_builtin_date_prototype_to_iso_string, 0, 0)
ROUTINE (ECMA_MAGIC_STRING_TO_JSON_UL, ecma_builtin_date_prototype_to_json, 1, 1)
#undef OBJECT_ID
#undef SIMPLE_VALUE
#undef NUMBER_VALUE
#undef STRING_VALUE
#undef OBJECT_VALUE
#undef CP_UNIMPLEMENTED_VALUE
#undef ROUTINE
@@ -0,0 +1,118 @@
/* Copyright 2015 Samsung Electronics Co., Ltd.
* Copyright 2015 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ecma-alloc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_DATE_BUILTIN
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-date.inc.h"
#define BUILTIN_UNDERSCORED_ID date
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
* @{
*
* \addtogroup ecmabuiltins
* @{
*
* \addtogroup date ECMA Date object built-in
* @{
*/
/**
* The Date object's 'parse' routine
*
* See also:
* ECMA-262 v5, 15.9.4.2
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_parse (ecma_value_t this_arg, /**< this argument */
ecma_value_t arg) /**< string */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
} /* ecma_builtin_date_parse */
/**
* The Date object's 'UTC' routine
*
* See also:
* ECMA-262 v5, 15.9.4.3
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_utc (ecma_value_t this_arg, /**< this argument */
const ecma_value_t args[], /**< arguments list */
ecma_length_t args_number) /**< number of arguments */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, args, args_number);
} /* ecma_builtin_date_utc */
/**
* The Date object's 'now' routine
*
* See also:
* ECMA-262 v5, 15.9.4.4
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_date_now (ecma_value_t this_arg) /**< this argument */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
} /* ecma_builtin_date_now */
/**
* Handle calling [[Call]] of built-in Date object
*
* @return completion-value
*/
ecma_completion_value_t
ecma_builtin_date_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
ecma_length_t arguments_list_len) /**< number of arguments */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (arguments_list_p, arguments_list_len);
} /* ecma_builtin_date_dispatch_call */
/**
* Handle calling [[Construct]] of built-in Date object
*
* @return completion-value
*/
ecma_completion_value_t
ecma_builtin_date_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
ecma_length_t arguments_list_len) /**< number of arguments */
{
ECMA_BUILTIN_CP_UNIMPLEMENTED (arguments_list_p, arguments_list_len);
} /* ecma_builtin_date_dispatch_construct */
/**
* @}
* @}
* @}
*/
#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_DATE_BUILTIN */
@@ -0,0 +1,63 @@
/* Copyright 2015 Samsung Electronics Co., Ltd.
* Copyright 2015 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Date built-in description
*/
#ifndef OBJECT_ID
# define OBJECT_ID(builtin_object_id)
#endif /* !OBJECT_ID */
#ifndef OBJECT_VALUE
# define OBJECT_VALUE(name, obj_getter, prop_writable, prop_enumerable, prop_configurable)
#endif /* !OBJECT_VALUE */
#ifndef NUMBER_VALUE
# define NUMBER_VALUE(name, number_value, prop_writable, prop_enumerable, prop_configurable)
#endif /* !NUMBER_VALUE */
#ifndef ROUTINE
# define ROUTINE(name, c_function_name, args_number, length_prop_value)
#endif /* !ROUTINE */
/* Object identifier */
OBJECT_ID (ECMA_BUILTIN_ID_DATE)
// ECMA-262 v5, 15.9.4.1
OBJECT_VALUE (ECMA_MAGIC_STRING_PROTOTYPE,
ecma_builtin_get (ECMA_BUILTIN_ID_DATE_PROTOTYPE),
ECMA_PROPERTY_NOT_WRITABLE,
ECMA_PROPERTY_NOT_ENUMERABLE,
ECMA_PROPERTY_NOT_CONFIGURABLE)
NUMBER_VALUE (ECMA_MAGIC_STRING_LENGTH,
7,
ECMA_PROPERTY_NOT_WRITABLE,
ECMA_PROPERTY_NOT_ENUMERABLE,
ECMA_PROPERTY_NOT_CONFIGURABLE)
ROUTINE (ECMA_MAGIC_STRING_PARSE, ecma_builtin_date_parse, 1, 1)
ROUTINE (ECMA_MAGIC_STRING_UTC_U, ecma_builtin_date_utc, NON_FIXED, 7)
ROUTINE (ECMA_MAGIC_STRING_NOW, ecma_builtin_date_now, 0, 0)
#undef OBJECT_ID
#undef SIMPLE_VALUE
#undef NUMBER_VALUE
#undef STRING_VALUE
#undef OBJECT_VALUE
#undef CP_UNIMPLEMENTED_VALUE
#undef ROUTINE
@@ -124,6 +124,15 @@ OBJECT_VALUE (ECMA_MAGIC_STRING_NUMBER_UL,
ECMA_PROPERTY_CONFIGURABLE)
#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_NUMBER_BUILTIN */
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_DATE_BUILTIN
// ECMA-262 v5, 15.1.4.7
OBJECT_VALUE (ECMA_MAGIC_STRING_DATE_UL,
ecma_builtin_get (ECMA_BUILTIN_ID_DATE),
ECMA_PROPERTY_WRITABLE,
ECMA_PROPERTY_NOT_ENUMERABLE,
ECMA_PROPERTY_CONFIGURABLE)
#endif /* CONFIG_ECMA_COMPACT_PROFILE_DISABLE_DATE_BUILTIN */
// Implementation-defined property for accessing the engine's extensions */
OBJECT_VALUE (ECMA_MAGIC_STRING_JERRY_UL,
ecma_builtin_get (ECMA_BUILTIN_ID_JERRY),
@@ -131,13 +140,6 @@ OBJECT_VALUE (ECMA_MAGIC_STRING_JERRY_UL,
ECMA_PROPERTY_NOT_ENUMERABLE,
ECMA_PROPERTY_NOT_CONFIGURABLE)
// ECMA-262 v5, 15.1.4.7
CP_UNIMPLEMENTED_VALUE (ECMA_MAGIC_STRING_DATE_UL,
ecma_builtin_get (ECMA_BUILTIN_ID_DATE),
ECMA_PROPERTY_WRITABLE,
ECMA_PROPERTY_NOT_ENUMERABLE,
ECMA_PROPERTY_CONFIGURABLE)
// ECMA-262 v5, 15.1.4.8
CP_UNIMPLEMENTED_VALUE (ECMA_MAGIC_STRING_REG_EXP_UL,
ecma_builtin_get (ECMA_BUILTIN_ID_REGEXP),
@@ -155,6 +155,20 @@ ecma_builtin_init_object (ecma_builtin_id_t obj_builtin_id, /**< built-in ID */
}
#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_BOOLEAN_BUILTIN */
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_DATE_BUILTIN
case ECMA_BUILTIN_ID_DATE_PROTOTYPE:
{
ecma_number_t *prim_prop_num_value_p = ecma_alloc_number ();
*prim_prop_num_value_p = ECMA_NUMBER_ZERO;
ecma_property_t *prim_value_prop_p;
prim_value_prop_p = ecma_create_internal_property (object_obj_p,
ECMA_INTERNAL_PROPERTY_PRIMITIVE_NUMBER_VALUE);
ECMA_SET_POINTER (prim_value_prop_p->u.internal_property.value, prim_prop_num_value_p);
break;
}
#endif /* CONFIG_ECMA_COMPACT_PROFILE_DISABLE_DATE_BUILTIN */
default:
{
break;
@@ -130,6 +130,24 @@ BUILTIN (ECMA_BUILTIN_ID_MATH,
math)
#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_MATH_BUILTIN */
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_DATE_BUILTIN
/* The Date.prototype object (15.9.4) */
BUILTIN (ECMA_BUILTIN_ID_DATE_PROTOTYPE,
ECMA_OBJECT_TYPE_GENERAL,
ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,
true,
true,
date_prototype)
/* The Date object (15.9.3) */
BUILTIN (ECMA_BUILTIN_ID_DATE,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
true,
true,
date)
#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_DATE_BUILTIN*/
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS
/* The Error.prototype object (15.11.4) */
BUILTIN (ECMA_BUILTIN_ID_ERROR_PROTOTYPE,