|
@@ -1,12 +1,12 @@
|
|
|
/*
|
|
/*
|
|
|
- * Duktape public API for Duktape 2.2.0.
|
|
|
|
|
|
|
+ * Duktape public API for Duktape 2.3.0.
|
|
|
*
|
|
*
|
|
|
* See the API reference for documentation on call semantics. The exposed,
|
|
* See the API reference for documentation on call semantics. The exposed,
|
|
|
* supported API is between the "BEGIN PUBLIC API" and "END PUBLIC API"
|
|
* supported API is between the "BEGIN PUBLIC API" and "END PUBLIC API"
|
|
|
* comments. Other parts of the header are Duktape internal and related to
|
|
* comments. Other parts of the header are Duktape internal and related to
|
|
|
* e.g. platform/compiler/feature detection.
|
|
* e.g. platform/compiler/feature detection.
|
|
|
*
|
|
*
|
|
|
- * Git commit a459cf3c9bd1779fc01b435d69302b742675a08f (v2.2.0).
|
|
|
|
|
|
|
+ * Git commit d7fdb67f18561a50e06bafd196c6b423af9ad6fe (v2.3.0).
|
|
|
* Git branch master.
|
|
* Git branch master.
|
|
|
*
|
|
*
|
|
|
* See Duktape AUTHORS.rst and LICENSE.txt for copyright and
|
|
* See Duktape AUTHORS.rst and LICENSE.txt for copyright and
|
|
@@ -18,21 +18,21 @@
|
|
|
* ===============
|
|
* ===============
|
|
|
* Duktape license
|
|
* Duktape license
|
|
|
* ===============
|
|
* ===============
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
* (http://opensource.org/licenses/MIT)
|
|
* (http://opensource.org/licenses/MIT)
|
|
|
- *
|
|
|
|
|
- * Copyright (c) 2013-2017 by Duktape authors (see AUTHORS.rst)
|
|
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
|
|
+ * Copyright (c) 2013-2018 by Duktape authors (see AUTHORS.rst)
|
|
|
|
|
+ *
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
* furnished to do so, subject to the following conditions:
|
|
* furnished to do so, subject to the following conditions:
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
* all copies or substantial portions of the Software.
|
|
* all copies or substantial portions of the Software.
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
@@ -47,24 +47,24 @@
|
|
|
* ===============
|
|
* ===============
|
|
|
* Duktape authors
|
|
* Duktape authors
|
|
|
* ===============
|
|
* ===============
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
* Copyright
|
|
* Copyright
|
|
|
* =========
|
|
* =========
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
* Duktape copyrights are held by its authors. Each author has a copyright
|
|
* Duktape copyrights are held by its authors. Each author has a copyright
|
|
|
* to their contribution, and agrees to irrevocably license the contribution
|
|
* to their contribution, and agrees to irrevocably license the contribution
|
|
|
* under the Duktape ``LICENSE.txt``.
|
|
* under the Duktape ``LICENSE.txt``.
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
* Authors
|
|
* Authors
|
|
|
* =======
|
|
* =======
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
* Please include an e-mail address, a link to your GitHub profile, or something
|
|
* Please include an e-mail address, a link to your GitHub profile, or something
|
|
|
* similar to allow your contribution to be identified accurately.
|
|
* similar to allow your contribution to be identified accurately.
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
* The following people have contributed code, website contents, or Wiki contents,
|
|
* The following people have contributed code, website contents, or Wiki contents,
|
|
|
* and agreed to irrevocably license their contributions under the Duktape
|
|
* and agreed to irrevocably license their contributions under the Duktape
|
|
|
* ``LICENSE.txt`` (in order of appearance):
|
|
* ``LICENSE.txt`` (in order of appearance):
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
* * Sami Vaarala <sami.vaarala@iki.fi>
|
|
* * Sami Vaarala <sami.vaarala@iki.fi>
|
|
|
* * Niki Dobrev
|
|
* * Niki Dobrev
|
|
|
* * Andreas \u00d6man <andreas@lonelycoder.com>
|
|
* * Andreas \u00d6man <andreas@lonelycoder.com>
|
|
@@ -92,13 +92,21 @@
|
|
|
* * Steven Don (https://github.com/shdon)
|
|
* * Steven Don (https://github.com/shdon)
|
|
|
* * Simon Stone (https://github.com/sstone1)
|
|
* * Simon Stone (https://github.com/sstone1)
|
|
|
* * \J. McC. (https://github.com/jmhmccr)
|
|
* * \J. McC. (https://github.com/jmhmccr)
|
|
|
- *
|
|
|
|
|
|
|
+ * * Jakub Nowakowski (https://github.com/jimvonmoon)
|
|
|
|
|
+ * * Tommy Nguyen (https://github.com/tn0502)
|
|
|
|
|
+ * * Fabrice Fontaine (https://github.com/ffontaine)
|
|
|
|
|
+ * * Christopher Hiller (https://github.com/boneskull)
|
|
|
|
|
+ * * Gonzalo Diethelm (https://github.com/gonzus)
|
|
|
|
|
+ * * Michal Kasperek (https://github.com/michalkas)
|
|
|
|
|
+ * * Andrew Janke (https://github.com/apjanke)
|
|
|
|
|
+ * * Steve Fan (https://github.com/stevefan1999)
|
|
|
|
|
+ *
|
|
|
* Other contributions
|
|
* Other contributions
|
|
|
* ===================
|
|
* ===================
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
* The following people have contributed something other than code (e.g. reported
|
|
* The following people have contributed something other than code (e.g. reported
|
|
|
* bugs, provided ideas, etc; roughly in order of appearance):
|
|
* bugs, provided ideas, etc; roughly in order of appearance):
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
* * Greg Burns
|
|
* * Greg Burns
|
|
|
* * Anthony Rabine
|
|
* * Anthony Rabine
|
|
|
* * Carlos Costa
|
|
* * Carlos Costa
|
|
@@ -130,7 +138,9 @@
|
|
|
* * https://github.com/chris-y
|
|
* * https://github.com/chris-y
|
|
|
* * Laurent Zubiaur (https://github.com/lzubiaur)
|
|
* * Laurent Zubiaur (https://github.com/lzubiaur)
|
|
|
* * Neil Kolban (https://github.com/nkolban)
|
|
* * Neil Kolban (https://github.com/nkolban)
|
|
|
- *
|
|
|
|
|
|
|
+ * * Wilhelm Wanecek (https://github.com/wanecek)
|
|
|
|
|
+ * * Andrew Janke (https://github.com/apjanke)
|
|
|
|
|
+ *
|
|
|
* If you are accidentally missing from this list, send me an e-mail
|
|
* If you are accidentally missing from this list, send me an e-mail
|
|
|
* (``sami.vaarala@iki.fi``) and I'll fix the omission.
|
|
* (``sami.vaarala@iki.fi``) and I'll fix the omission.
|
|
|
*/
|
|
*/
|
|
@@ -150,19 +160,19 @@
|
|
|
|
|
|
|
|
/* Duktape version, (major * 10000) + (minor * 100) + patch. Allows C code
|
|
/* Duktape version, (major * 10000) + (minor * 100) + patch. Allows C code
|
|
|
* to #if (DUK_VERSION >= NNN) against Duktape API version. The same value
|
|
* to #if (DUK_VERSION >= NNN) against Duktape API version. The same value
|
|
|
- * is also available to Ecmascript code in Duktape.version. Unofficial
|
|
|
|
|
|
|
+ * is also available to ECMAScript code in Duktape.version. Unofficial
|
|
|
* development snapshots have 99 for patch level (e.g. 0.10.99 would be a
|
|
* development snapshots have 99 for patch level (e.g. 0.10.99 would be a
|
|
|
* development version after 0.10.0 but before the next official release).
|
|
* development version after 0.10.0 but before the next official release).
|
|
|
*/
|
|
*/
|
|
|
-#define DUK_VERSION 20200L
|
|
|
|
|
|
|
+#define DUK_VERSION 20300L
|
|
|
|
|
|
|
|
/* Git commit, describe, and branch for Duktape build. Useful for
|
|
/* Git commit, describe, and branch for Duktape build. Useful for
|
|
|
* non-official snapshot builds so that application code can easily log
|
|
* non-official snapshot builds so that application code can easily log
|
|
|
- * which Duktape snapshot was used. Not available in the Ecmascript
|
|
|
|
|
|
|
+ * which Duktape snapshot was used. Not available in the ECMAScript
|
|
|
* environment.
|
|
* environment.
|
|
|
*/
|
|
*/
|
|
|
-#define DUK_GIT_COMMIT "a459cf3c9bd1779fc01b435d69302b742675a08f"
|
|
|
|
|
-#define DUK_GIT_DESCRIBE "v2.2.0"
|
|
|
|
|
|
|
+#define DUK_GIT_COMMIT "d7fdb67f18561a50e06bafd196c6b423af9ad6fe"
|
|
|
|
|
+#define DUK_GIT_DESCRIBE "v2.3.0"
|
|
|
#define DUK_GIT_BRANCH "master"
|
|
#define DUK_GIT_BRANCH "master"
|
|
|
|
|
|
|
|
/* External duk_config.h provides platform/compiler/OS dependent
|
|
/* External duk_config.h provides platform/compiler/OS dependent
|
|
@@ -258,7 +268,7 @@ struct duk_number_list_entry {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
struct duk_time_components {
|
|
struct duk_time_components {
|
|
|
- duk_double_t year; /* year, e.g. 2016, Ecmascript year range */
|
|
|
|
|
|
|
+ duk_double_t year; /* year, e.g. 2016, ECMAScript year range */
|
|
|
duk_double_t month; /* month: 1-12 */
|
|
duk_double_t month; /* month: 1-12 */
|
|
|
duk_double_t day; /* day: 1-31 */
|
|
duk_double_t day; /* day: 1-31 */
|
|
|
duk_double_t hours; /* hour: 0-59 */
|
|
duk_double_t hours; /* hour: 0-59 */
|
|
@@ -294,12 +304,12 @@ struct duk_time_components {
|
|
|
/* Value types, used by e.g. duk_get_type() */
|
|
/* Value types, used by e.g. duk_get_type() */
|
|
|
#define DUK_TYPE_MIN 0U
|
|
#define DUK_TYPE_MIN 0U
|
|
|
#define DUK_TYPE_NONE 0U /* no value, e.g. invalid index */
|
|
#define DUK_TYPE_NONE 0U /* no value, e.g. invalid index */
|
|
|
-#define DUK_TYPE_UNDEFINED 1U /* Ecmascript undefined */
|
|
|
|
|
-#define DUK_TYPE_NULL 2U /* Ecmascript null */
|
|
|
|
|
-#define DUK_TYPE_BOOLEAN 3U /* Ecmascript boolean: 0 or 1 */
|
|
|
|
|
-#define DUK_TYPE_NUMBER 4U /* Ecmascript number: double */
|
|
|
|
|
-#define DUK_TYPE_STRING 5U /* Ecmascript string: CESU-8 / extended UTF-8 encoded */
|
|
|
|
|
-#define DUK_TYPE_OBJECT 6U /* Ecmascript object: includes objects, arrays, functions, threads */
|
|
|
|
|
|
|
+#define DUK_TYPE_UNDEFINED 1U /* ECMAScript undefined */
|
|
|
|
|
+#define DUK_TYPE_NULL 2U /* ECMAScript null */
|
|
|
|
|
+#define DUK_TYPE_BOOLEAN 3U /* ECMAScript boolean: 0 or 1 */
|
|
|
|
|
+#define DUK_TYPE_NUMBER 4U /* ECMAScript number: double */
|
|
|
|
|
+#define DUK_TYPE_STRING 5U /* ECMAScript string: CESU-8 / extended UTF-8 encoded */
|
|
|
|
|
+#define DUK_TYPE_OBJECT 6U /* ECMAScript object: includes objects, arrays, functions, threads */
|
|
|
#define DUK_TYPE_BUFFER 7U /* fixed or dynamic, garbage collected byte buffer */
|
|
#define DUK_TYPE_BUFFER 7U /* fixed or dynamic, garbage collected byte buffer */
|
|
|
#define DUK_TYPE_POINTER 8U /* raw void pointer */
|
|
#define DUK_TYPE_POINTER 8U /* raw void pointer */
|
|
|
#define DUK_TYPE_LIGHTFUNC 9U /* lightweight function pointer */
|
|
#define DUK_TYPE_LIGHTFUNC 9U /* lightweight function pointer */
|
|
@@ -668,7 +678,21 @@ DUK_EXTERNAL_DECL void duk_push_pointer(duk_context *ctx, void *p);
|
|
|
DUK_EXTERNAL_DECL const char *duk_push_sprintf(duk_context *ctx, const char *fmt, ...);
|
|
DUK_EXTERNAL_DECL const char *duk_push_sprintf(duk_context *ctx, const char *fmt, ...);
|
|
|
DUK_EXTERNAL_DECL const char *duk_push_vsprintf(duk_context *ctx, const char *fmt, va_list ap);
|
|
DUK_EXTERNAL_DECL const char *duk_push_vsprintf(duk_context *ctx, const char *fmt, va_list ap);
|
|
|
|
|
|
|
|
|
|
+/* duk_push_literal() may evaluate its argument (a C string literal) more than
|
|
|
|
|
+ * once on purpose. When speed is preferred, sizeof() avoids an unnecessary
|
|
|
|
|
+ * strlen() at runtime. Sizeof("foo") == 4, so subtract 1. The argument
|
|
|
|
|
+ * must be non-NULL and should not contain internal NUL characters as the
|
|
|
|
|
+ * behavior will then depend on config options.
|
|
|
|
|
+ */
|
|
|
|
|
+#if defined(DUK_USE_PREFER_SIZE)
|
|
|
|
|
+#define duk_push_literal(ctx,cstring) duk_push_string((ctx), (cstring))
|
|
|
|
|
+#else
|
|
|
|
|
+DUK_EXTERNAL_DECL const char *duk_push_literal_raw(duk_context *ctx, const char *str, duk_size_t len);
|
|
|
|
|
+#define duk_push_literal(ctx,cstring) duk_push_literal_raw((ctx), (cstring), sizeof((cstring)) - 1U)
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
DUK_EXTERNAL_DECL void duk_push_this(duk_context *ctx);
|
|
DUK_EXTERNAL_DECL void duk_push_this(duk_context *ctx);
|
|
|
|
|
+DUK_EXTERNAL_DECL void duk_push_new_target(duk_context *ctx);
|
|
|
DUK_EXTERNAL_DECL void duk_push_current_function(duk_context *ctx);
|
|
DUK_EXTERNAL_DECL void duk_push_current_function(duk_context *ctx);
|
|
|
DUK_EXTERNAL_DECL void duk_push_current_thread(duk_context *ctx);
|
|
DUK_EXTERNAL_DECL void duk_push_current_thread(duk_context *ctx);
|
|
|
DUK_EXTERNAL_DECL void duk_push_global_object(duk_context *ctx);
|
|
DUK_EXTERNAL_DECL void duk_push_global_object(duk_context *ctx);
|
|
@@ -1000,29 +1024,55 @@ DUK_EXTERNAL_DECL void duk_config_buffer(duk_context *ctx, duk_idx_t idx, void *
|
|
|
/*
|
|
/*
|
|
|
* Property access
|
|
* Property access
|
|
|
*
|
|
*
|
|
|
- * The basic function assumes key is on stack. The _string variant takes
|
|
|
|
|
- * a C string as a property name, while the _index variant takes an array
|
|
|
|
|
- * index as a property name (e.g. 123 is equivalent to the key "123").
|
|
|
|
|
|
|
+ * The basic function assumes key is on stack. The _(l)string variant takes
|
|
|
|
|
+ * a C string as a property name; the _literal variant takes a C literal.
|
|
|
|
|
+ * The _index variant takes an array index as a property name (e.g. 123 is
|
|
|
|
|
+ * equivalent to the key "123"). The _heapptr variant takes a raw, borrowed
|
|
|
|
|
+ * heap pointer.
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_get_prop(duk_context *ctx, duk_idx_t obj_idx);
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_get_prop(duk_context *ctx, duk_idx_t obj_idx);
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_get_prop_string(duk_context *ctx, duk_idx_t obj_idx, const char *key);
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_get_prop_string(duk_context *ctx, duk_idx_t obj_idx, const char *key);
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_get_prop_lstring(duk_context *ctx, duk_idx_t obj_idx, const char *key, duk_size_t key_len);
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_get_prop_lstring(duk_context *ctx, duk_idx_t obj_idx, const char *key, duk_size_t key_len);
|
|
|
|
|
+#if defined(DUK_USE_PREFER_SIZE)
|
|
|
|
|
+#define duk_get_prop_literal(ctx,obj_idx,key) duk_get_prop_string((ctx), (obj_idx), (key))
|
|
|
|
|
+#else
|
|
|
|
|
+DUK_EXTERNAL_DECL duk_bool_t duk_get_prop_literal_raw(duk_context *ctx, duk_idx_t obj_idx, const char *key, duk_size_t key_len);
|
|
|
|
|
+#define duk_get_prop_literal(ctx,obj_idx,key) duk_get_prop_literal_raw((ctx), (obj_idx), (key), sizeof((key)) - 1U)
|
|
|
|
|
+#endif
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_get_prop_index(duk_context *ctx, duk_idx_t obj_idx, duk_uarridx_t arr_idx);
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_get_prop_index(duk_context *ctx, duk_idx_t obj_idx, duk_uarridx_t arr_idx);
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_get_prop_heapptr(duk_context *ctx, duk_idx_t obj_idx, void *ptr);
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_get_prop_heapptr(duk_context *ctx, duk_idx_t obj_idx, void *ptr);
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_put_prop(duk_context *ctx, duk_idx_t obj_idx);
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_put_prop(duk_context *ctx, duk_idx_t obj_idx);
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_put_prop_string(duk_context *ctx, duk_idx_t obj_idx, const char *key);
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_put_prop_string(duk_context *ctx, duk_idx_t obj_idx, const char *key);
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_put_prop_lstring(duk_context *ctx, duk_idx_t obj_idx, const char *key, duk_size_t key_len);
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_put_prop_lstring(duk_context *ctx, duk_idx_t obj_idx, const char *key, duk_size_t key_len);
|
|
|
|
|
+#if defined(DUK_USE_PREFER_SIZE)
|
|
|
|
|
+#define duk_put_prop_literal(ctx,obj_idx,key) duk_put_prop_string((ctx), (obj_idx), (key))
|
|
|
|
|
+#else
|
|
|
|
|
+DUK_EXTERNAL_DECL duk_bool_t duk_put_prop_literal_raw(duk_context *ctx, duk_idx_t obj_idx, const char *key, duk_size_t key_len);
|
|
|
|
|
+#define duk_put_prop_literal(ctx,obj_idx,key) duk_put_prop_literal_raw((ctx), (obj_idx), (key), sizeof((key)) - 1U)
|
|
|
|
|
+#endif
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_put_prop_index(duk_context *ctx, duk_idx_t obj_idx, duk_uarridx_t arr_idx);
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_put_prop_index(duk_context *ctx, duk_idx_t obj_idx, duk_uarridx_t arr_idx);
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_put_prop_heapptr(duk_context *ctx, duk_idx_t obj_idx, void *ptr);
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_put_prop_heapptr(duk_context *ctx, duk_idx_t obj_idx, void *ptr);
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_del_prop(duk_context *ctx, duk_idx_t obj_idx);
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_del_prop(duk_context *ctx, duk_idx_t obj_idx);
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_del_prop_string(duk_context *ctx, duk_idx_t obj_idx, const char *key);
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_del_prop_string(duk_context *ctx, duk_idx_t obj_idx, const char *key);
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_del_prop_lstring(duk_context *ctx, duk_idx_t obj_idx, const char *key, duk_size_t key_len);
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_del_prop_lstring(duk_context *ctx, duk_idx_t obj_idx, const char *key, duk_size_t key_len);
|
|
|
|
|
+#if defined(DUK_USE_PREFER_SIZE)
|
|
|
|
|
+#define duk_del_prop_literal(ctx,obj_idx,key) duk_del_prop_string((ctx), (obj_idx), (key))
|
|
|
|
|
+#else
|
|
|
|
|
+DUK_EXTERNAL_DECL duk_bool_t duk_del_prop_literal_raw(duk_context *ctx, duk_idx_t obj_idx, const char *key, duk_size_t key_len);
|
|
|
|
|
+#define duk_del_prop_literal(ctx,obj_idx,key) duk_del_prop_literal_raw((ctx), (obj_idx), (key), sizeof((key)) - 1U)
|
|
|
|
|
+#endif
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_del_prop_index(duk_context *ctx, duk_idx_t obj_idx, duk_uarridx_t arr_idx);
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_del_prop_index(duk_context *ctx, duk_idx_t obj_idx, duk_uarridx_t arr_idx);
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_del_prop_heapptr(duk_context *ctx, duk_idx_t obj_idx, void *ptr);
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_del_prop_heapptr(duk_context *ctx, duk_idx_t obj_idx, void *ptr);
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_has_prop(duk_context *ctx, duk_idx_t obj_idx);
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_has_prop(duk_context *ctx, duk_idx_t obj_idx);
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_has_prop_string(duk_context *ctx, duk_idx_t obj_idx, const char *key);
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_has_prop_string(duk_context *ctx, duk_idx_t obj_idx, const char *key);
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_has_prop_lstring(duk_context *ctx, duk_idx_t obj_idx, const char *key, duk_size_t key_len);
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_has_prop_lstring(duk_context *ctx, duk_idx_t obj_idx, const char *key, duk_size_t key_len);
|
|
|
|
|
+#if defined(DUK_USE_PREFER_SIZE)
|
|
|
|
|
+#define duk_has_prop_literal(ctx,obj_idx,key) duk_has_prop_string((ctx), (obj_idx), (key))
|
|
|
|
|
+#else
|
|
|
|
|
+DUK_EXTERNAL_DECL duk_bool_t duk_has_prop_literal_raw(duk_context *ctx, duk_idx_t obj_idx, const char *key, duk_size_t key_len);
|
|
|
|
|
+#define duk_has_prop_literal(ctx,obj_idx,key) duk_has_prop_literal_raw((ctx), (obj_idx), (key), sizeof((key)) - 1U)
|
|
|
|
|
+#endif
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_has_prop_index(duk_context *ctx, duk_idx_t obj_idx, duk_uarridx_t arr_idx);
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_has_prop_index(duk_context *ctx, duk_idx_t obj_idx, duk_uarridx_t arr_idx);
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_has_prop_heapptr(duk_context *ctx, duk_idx_t obj_idx, void *ptr);
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_has_prop_heapptr(duk_context *ctx, duk_idx_t obj_idx, void *ptr);
|
|
|
|
|
|
|
@@ -1031,8 +1081,22 @@ DUK_EXTERNAL_DECL void duk_def_prop(duk_context *ctx, duk_idx_t obj_idx, duk_uin
|
|
|
|
|
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_get_global_string(duk_context *ctx, const char *key);
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_get_global_string(duk_context *ctx, const char *key);
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_get_global_lstring(duk_context *ctx, const char *key, duk_size_t key_len);
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_get_global_lstring(duk_context *ctx, const char *key, duk_size_t key_len);
|
|
|
|
|
+#if defined(DUK_USE_PREFER_SIZE)
|
|
|
|
|
+#define duk_get_global_literal(ctx,key) duk_get_global_string((ctx), (key))
|
|
|
|
|
+#else
|
|
|
|
|
+DUK_EXTERNAL_DECL duk_bool_t duk_get_global_literal_raw(duk_context *ctx, const char *key, duk_size_t key_len);
|
|
|
|
|
+#define duk_get_global_literal(ctx,key) duk_get_global_literal_raw((ctx), (key), sizeof((key)) - 1U)
|
|
|
|
|
+#endif
|
|
|
|
|
+DUK_EXTERNAL_DECL duk_bool_t duk_get_global_heapptr(duk_context *ctx, void *ptr);
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_put_global_string(duk_context *ctx, const char *key);
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_put_global_string(duk_context *ctx, const char *key);
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_put_global_lstring(duk_context *ctx, const char *key, duk_size_t key_len);
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_put_global_lstring(duk_context *ctx, const char *key, duk_size_t key_len);
|
|
|
|
|
+#if defined(DUK_USE_PREFER_SIZE)
|
|
|
|
|
+#define duk_put_global_literal(ctx,key) duk_put_global_string((ctx), (key))
|
|
|
|
|
+#else
|
|
|
|
|
+DUK_EXTERNAL_DECL duk_bool_t duk_put_global_literal_raw(duk_context *ctx, const char *key, duk_size_t key_len);
|
|
|
|
|
+#define duk_put_global_literal(ctx,key) duk_put_global_literal_raw((ctx), (key), sizeof((key)) - 1U)
|
|
|
|
|
+#endif
|
|
|
|
|
+DUK_EXTERNAL_DECL duk_bool_t duk_put_global_heapptr(duk_context *ctx, void *ptr);
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
|
* Inspection
|
|
* Inspection
|
|
@@ -1099,7 +1163,7 @@ DUK_EXTERNAL_DECL void duk_trim(duk_context *ctx, duk_idx_t idx);
|
|
|
DUK_EXTERNAL_DECL duk_codepoint_t duk_char_code_at(duk_context *ctx, duk_idx_t idx, duk_size_t char_offset);
|
|
DUK_EXTERNAL_DECL duk_codepoint_t duk_char_code_at(duk_context *ctx, duk_idx_t idx, duk_size_t char_offset);
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
|
- * Ecmascript operators
|
|
|
|
|
|
|
+ * ECMAScript operators
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_equals(duk_context *ctx, duk_idx_t idx1, duk_idx_t idx2);
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_equals(duk_context *ctx, duk_idx_t idx1, duk_idx_t idx2);
|
|
@@ -1107,6 +1171,12 @@ DUK_EXTERNAL_DECL duk_bool_t duk_strict_equals(duk_context *ctx, duk_idx_t idx1,
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_samevalue(duk_context *ctx, duk_idx_t idx1, duk_idx_t idx2);
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_samevalue(duk_context *ctx, duk_idx_t idx1, duk_idx_t idx2);
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_instanceof(duk_context *ctx, duk_idx_t idx1, duk_idx_t idx2);
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_instanceof(duk_context *ctx, duk_idx_t idx1, duk_idx_t idx2);
|
|
|
|
|
|
|
|
|
|
+/*
|
|
|
|
|
+ * Random
|
|
|
|
|
+ */
|
|
|
|
|
+
|
|
|
|
|
+DUK_EXTERNAL_DECL duk_double_t duk_random(duk_context *ctx);
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
* Function (method) calls
|
|
* Function (method) calls
|
|
|
*/
|
|
*/
|
|
@@ -1257,7 +1327,7 @@ DUK_EXTERNAL_DECL duk_double_t duk_components_to_time(duk_context *ctx, duk_time
|
|
|
#define DUK_DATE_MSEC_HOUR (60L * 60L * 1000L)
|
|
#define DUK_DATE_MSEC_HOUR (60L * 60L * 1000L)
|
|
|
#define DUK_DATE_MSEC_DAY (24L * 60L * 60L * 1000L)
|
|
#define DUK_DATE_MSEC_DAY (24L * 60L * 60L * 1000L)
|
|
|
|
|
|
|
|
-/* Ecmascript date range is 100 million days from Epoch:
|
|
|
|
|
|
|
+/* ECMAScript date range is 100 million days from Epoch:
|
|
|
* > 100e6 * 24 * 60 * 60 * 1000 // 100M days in millisecs
|
|
* > 100e6 * 24 * 60 * 60 * 1000 // 100M days in millisecs
|
|
|
* 8640000000000000
|
|
* 8640000000000000
|
|
|
* (= 8.64e15)
|
|
* (= 8.64e15)
|
|
@@ -1265,7 +1335,7 @@ DUK_EXTERNAL_DECL duk_double_t duk_components_to_time(duk_context *ctx, duk_time
|
|
|
#define DUK_DATE_MSEC_100M_DAYS (8.64e15)
|
|
#define DUK_DATE_MSEC_100M_DAYS (8.64e15)
|
|
|
#define DUK_DATE_MSEC_100M_DAYS_LEEWAY (8.64e15 + 24 * 3600e3)
|
|
#define DUK_DATE_MSEC_100M_DAYS_LEEWAY (8.64e15 + 24 * 3600e3)
|
|
|
|
|
|
|
|
-/* Ecmascript year range:
|
|
|
|
|
|
|
+/* ECMAScript year range:
|
|
|
* > new Date(100e6 * 24 * 3600e3).toISOString()
|
|
* > new Date(100e6 * 24 * 3600e3).toISOString()
|
|
|
* '+275760-09-13T00:00:00.000Z'
|
|
* '+275760-09-13T00:00:00.000Z'
|
|
|
* > new Date(-100e6 * 24 * 3600e3).toISOString()
|
|
* > new Date(-100e6 * 24 * 3600e3).toISOString()
|
|
@@ -1275,7 +1345,7 @@ DUK_EXTERNAL_DECL duk_double_t duk_components_to_time(duk_context *ctx, duk_time
|
|
|
#define DUK_DATE_MAX_ECMA_YEAR 275760L
|
|
#define DUK_DATE_MAX_ECMA_YEAR 275760L
|
|
|
|
|
|
|
|
/* Part indices for internal breakdowns. Part order from DUK_DATE_IDX_YEAR
|
|
/* Part indices for internal breakdowns. Part order from DUK_DATE_IDX_YEAR
|
|
|
- * to DUK_DATE_IDX_MILLISECOND matches argument ordering of Ecmascript API
|
|
|
|
|
|
|
+ * to DUK_DATE_IDX_MILLISECOND matches argument ordering of ECMAScript API
|
|
|
* calls (like Date constructor call). Some functions in duk_bi_date.c
|
|
* calls (like Date constructor call). Some functions in duk_bi_date.c
|
|
|
* depend on the specific ordering, so change with care. 16 bits are not
|
|
* depend on the specific ordering, so change with care. 16 bits are not
|
|
|
* enough for all parts (year, specifically).
|
|
* enough for all parts (year, specifically).
|