|
|
@@ -1,11 +1,12 @@
|
|
|
/*
|
|
|
- * Duktape public API for Duktape 1.2.99.
|
|
|
+ * Duktape public API for Duktape 1.3.99.
|
|
|
* See the API reference for documentation on call semantics.
|
|
|
* The exposed API is inside the DUK_API_PUBLIC_H_INCLUDED
|
|
|
* include guard. Other parts of the header are Duktape
|
|
|
* internal and related to platform/compiler/feature detection.
|
|
|
*
|
|
|
- * Git commit 50171d671af34f2c403acf61c6dc83f2d2561e24 (v1.2.0-398-g50171d6).
|
|
|
+ * Git commit df5e369cbd20005700281f008e49ab09725677ef (v1.3.0-202-gdf5e369-dirty).
|
|
|
+ * Git branch master.
|
|
|
*
|
|
|
* See Duktape AUTHORS.rst and LICENSE.txt for copyright and
|
|
|
* licensing information.
|
|
|
@@ -59,8 +60,9 @@
|
|
|
* Please include an e-mail address, a link to your GitHub profile, or something
|
|
|
* similar to allow your contribution to be identified accurately.
|
|
|
*
|
|
|
- * The following people have contributed code and agreed to irrevocably license
|
|
|
- * their contributions under the Duktape ``LICENSE.txt`` (in order of appearance):
|
|
|
+ * The following people have contributed code, website contents, or Wiki contents,
|
|
|
+ * and agreed to irrevocably license their contributions under the Duktape
|
|
|
+ * ``LICENSE.txt`` (in order of appearance):
|
|
|
*
|
|
|
* * Sami Vaarala <[email protected]>
|
|
|
* * Niki Dobrev
|
|
|
@@ -68,6 +70,7 @@
|
|
|
* * L\u00e1szl\u00f3 Lang\u00f3 <[email protected]>
|
|
|
* * Legimet <[email protected]>
|
|
|
* * Karl Skomski <[email protected]>
|
|
|
+ * * Bruce Pascoe <[email protected]>
|
|
|
*
|
|
|
* Other contributions
|
|
|
* ===================
|
|
|
@@ -208,13 +211,16 @@ struct duk_number_list_entry {
|
|
|
* 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).
|
|
|
*/
|
|
|
-#define DUK_VERSION 10299L
|
|
|
+#define DUK_VERSION 10399L
|
|
|
|
|
|
-/* Git describe for Duktape build. Useful for non-official snapshot builds
|
|
|
- * so that application code can easily log which Duktape snapshot was used.
|
|
|
- * Not available in the Ecmascript environment.
|
|
|
+/* Git commit, describe, and branch for Duktape build. Useful for
|
|
|
+ * non-official snapshot builds so that application code can easily log
|
|
|
+ * which Duktape snapshot was used. Not available in the Ecmascript
|
|
|
+ * environment.
|
|
|
*/
|
|
|
-#define DUK_GIT_DESCRIBE "v1.2.0-398-g50171d6"
|
|
|
+#define DUK_GIT_COMMIT "df5e369cbd20005700281f008e49ab09725677ef"
|
|
|
+#define DUK_GIT_DESCRIBE "v1.3.0-202-gdf5e369-dirty"
|
|
|
+#define DUK_GIT_BRANCH "master"
|
|
|
|
|
|
/* Duktape debug protocol version used by this build. */
|
|
|
#define DUK_DEBUG_PROTOCOL_VERSION 1
|
|
|
@@ -295,6 +301,12 @@ struct duk_number_list_entry {
|
|
|
#define DUK_DEFPROP_HAVE_GETTER (1 << 7) /* set getter (given on value stack) */
|
|
|
#define DUK_DEFPROP_HAVE_SETTER (1 << 8) /* set setter (given on value stack) */
|
|
|
#define DUK_DEFPROP_FORCE (1 << 9) /* force change if possible, may still fail for e.g. virtual properties */
|
|
|
+#define DUK_DEFPROP_SET_WRITABLE (DUK_DEFPROP_HAVE_WRITABLE | DUK_DEFPROP_WRITABLE)
|
|
|
+#define DUK_DEFPROP_CLEAR_WRITABLE DUK_DEFPROP_HAVE_WRITABLE
|
|
|
+#define DUK_DEFPROP_SET_ENUMERABLE (DUK_DEFPROP_HAVE_ENUMERABLE | DUK_DEFPROP_ENUMERABLE)
|
|
|
+#define DUK_DEFPROP_CLEAR_ENUMERABLE DUK_DEFPROP_HAVE_ENUMERABLE
|
|
|
+#define DUK_DEFPROP_SET_CONFIGURABLE (DUK_DEFPROP_HAVE_CONFIGURABLE | DUK_DEFPROP_CONFIGURABLE)
|
|
|
+#define DUK_DEFPROP_CLEAR_CONFIGURABLE DUK_DEFPROP_HAVE_CONFIGURABLE
|
|
|
|
|
|
/* Flags for duk_push_thread_raw() */
|
|
|
#define DUK_THREAD_NEW_GLOBAL_ENV (1 << 0) /* create a new global environment */
|
|
|
@@ -536,16 +548,36 @@ DUK_EXTERNAL_DECL duk_idx_t duk_push_error_object_va_raw(duk_context *ctx, duk_e
|
|
|
duk_push_error_object_va_raw((ctx), (err_code), (const char *) (__FILE__), (duk_int_t) (__LINE__), (fmt), (ap))
|
|
|
|
|
|
#define DUK_BUF_FLAG_DYNAMIC (1 << 0) /* internal flag: dynamic buffer */
|
|
|
-#define DUK_BUF_FLAG_NOZERO (1 << 1) /* internal flag: don't zero allocated buffer */
|
|
|
+#define DUK_BUF_FLAG_EXTERNAL (1 << 1) /* internal flag: external buffer */
|
|
|
+#define DUK_BUF_FLAG_NOZERO (1 << 2) /* internal flag: don't zero allocated buffer */
|
|
|
|
|
|
DUK_EXTERNAL_DECL void *duk_push_buffer_raw(duk_context *ctx, duk_size_t size, duk_small_uint_t flags);
|
|
|
|
|
|
#define duk_push_buffer(ctx,size,dynamic) \
|
|
|
- duk_push_buffer_raw((ctx), (size), (dynamic));
|
|
|
+ duk_push_buffer_raw((ctx), (size), (dynamic) ? DUK_BUF_FLAG_DYNAMIC : 0);
|
|
|
#define duk_push_fixed_buffer(ctx,size) \
|
|
|
- duk_push_buffer_raw((ctx), (size), 0 /*dynamic*/)
|
|
|
+ duk_push_buffer_raw((ctx), (size), 0 /*flags*/)
|
|
|
#define duk_push_dynamic_buffer(ctx,size) \
|
|
|
- duk_push_buffer_raw((ctx), (size), 1 /*dynamic*/)
|
|
|
+ duk_push_buffer_raw((ctx), (size), DUK_BUF_FLAG_DYNAMIC /*flags*/)
|
|
|
+#define duk_push_external_buffer(ctx) \
|
|
|
+ ((void) duk_push_buffer_raw((ctx), 0, DUK_BUF_FLAG_DYNAMIC | DUK_BUF_FLAG_EXTERNAL))
|
|
|
+
|
|
|
+#define DUK_BUFOBJ_CREATE_ARRBUF (1 << 4) /* internal flag: create backing ArrayBuffer; keep in one byte */
|
|
|
+#define DUK_BUFOBJ_DUKTAPE_BUFFER 0
|
|
|
+#define DUK_BUFOBJ_NODEJS_BUFFER 1
|
|
|
+#define DUK_BUFOBJ_ARRAYBUFFER 2
|
|
|
+#define DUK_BUFOBJ_DATAVIEW (3 | DUK_BUFOBJ_CREATE_ARRBUF)
|
|
|
+#define DUK_BUFOBJ_INT8ARRAY (4 | DUK_BUFOBJ_CREATE_ARRBUF)
|
|
|
+#define DUK_BUFOBJ_UINT8ARRAY (5 | DUK_BUFOBJ_CREATE_ARRBUF)
|
|
|
+#define DUK_BUFOBJ_UINT8CLAMPEDARRAY (6 | DUK_BUFOBJ_CREATE_ARRBUF)
|
|
|
+#define DUK_BUFOBJ_INT16ARRAY (7 | DUK_BUFOBJ_CREATE_ARRBUF)
|
|
|
+#define DUK_BUFOBJ_UINT16ARRAY (8 | DUK_BUFOBJ_CREATE_ARRBUF)
|
|
|
+#define DUK_BUFOBJ_INT32ARRAY (9 | DUK_BUFOBJ_CREATE_ARRBUF)
|
|
|
+#define DUK_BUFOBJ_UINT32ARRAY (10 | DUK_BUFOBJ_CREATE_ARRBUF)
|
|
|
+#define DUK_BUFOBJ_FLOAT32ARRAY (11 | DUK_BUFOBJ_CREATE_ARRBUF)
|
|
|
+#define DUK_BUFOBJ_FLOAT64ARRAY (12 | DUK_BUFOBJ_CREATE_ARRBUF)
|
|
|
+
|
|
|
+DUK_EXTERNAL_DECL void duk_push_buffer_object(duk_context *ctx, duk_idx_t idx_buffer, duk_size_t byte_offset, duk_size_t byte_length, duk_uint_t flags);
|
|
|
|
|
|
DUK_EXTERNAL_DECL duk_idx_t duk_push_heapptr(duk_context *ctx, void *ptr);
|
|
|
|
|
|
@@ -592,8 +624,18 @@ DUK_EXTERNAL_DECL duk_bool_t duk_is_thread(duk_context *ctx, duk_idx_t index);
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_is_callable(duk_context *ctx, duk_idx_t index);
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_is_dynamic_buffer(duk_context *ctx, duk_idx_t index);
|
|
|
DUK_EXTERNAL_DECL duk_bool_t duk_is_fixed_buffer(duk_context *ctx, duk_idx_t index);
|
|
|
+DUK_EXTERNAL_DECL duk_bool_t duk_is_external_buffer(duk_context *ctx, duk_idx_t index);
|
|
|
+
|
|
|
+#define duk_is_primitive(ctx,index) \
|
|
|
+ duk_check_type_mask((ctx), (index), DUK_TYPE_MASK_UNDEFINED | \
|
|
|
+ DUK_TYPE_MASK_NULL | \
|
|
|
+ DUK_TYPE_MASK_BOOLEAN | \
|
|
|
+ DUK_TYPE_MASK_NUMBER | \
|
|
|
+ DUK_TYPE_MASK_STRING | \
|
|
|
+ DUK_TYPE_MASK_BUFFER | \
|
|
|
+ DUK_TYPE_MASK_POINTER | \
|
|
|
+ DUK_TYPE_MASK_LIGHTFUNC)
|
|
|
|
|
|
-DUK_EXTERNAL_DECL duk_bool_t duk_is_primitive(duk_context *ctx, duk_idx_t index);
|
|
|
#define duk_is_object_coercible(ctx,index) \
|
|
|
duk_check_type_mask((ctx), (index), DUK_TYPE_MASK_BOOLEAN | \
|
|
|
DUK_TYPE_MASK_NUMBER | \
|
|
|
@@ -719,6 +761,7 @@ DUK_EXTERNAL_DECL void duk_json_decode(duk_context *ctx, duk_idx_t index);
|
|
|
|
|
|
DUK_EXTERNAL_DECL void *duk_resize_buffer(duk_context *ctx, duk_idx_t index, duk_size_t new_size);
|
|
|
DUK_EXTERNAL_DECL void *duk_steal_buffer(duk_context *ctx, duk_idx_t index, duk_size_t *out_size);
|
|
|
+DUK_EXTERNAL_DECL void duk_config_buffer(duk_context *ctx, duk_idx_t index, void *ptr, duk_size_t len);
|
|
|
|
|
|
/*
|
|
|
* Property access
|
|
|
@@ -1315,7 +1358,7 @@ typedef union duk_double_union duk_double_union;
|
|
|
*
|
|
|
* When packed duk_tval is used, the NaN space is used to store pointers
|
|
|
* and other tagged values in addition to NaNs. Actual NaNs are normalized
|
|
|
- * to a specific format. The macros below are used by the implementation
|
|
|
+ * to a specific quiet NaN. The macros below are used by the implementation
|
|
|
* to check and normalize NaN values when they might be created. The macros
|
|
|
* are essentially NOPs when the non-packed duk_tval representation is used.
|
|
|
*
|
|
|
@@ -1323,7 +1366,8 @@ typedef union duk_double_union duk_double_union;
|
|
|
* the packed duk_tval and works correctly for all NaNs except those that
|
|
|
* begin with 0x7ff0. Since the 'normalized NaN' values used with packed
|
|
|
* duk_tval begin with 0x7ff8, the partial check is reliable when packed
|
|
|
- * duk_tval is used.
|
|
|
+ * duk_tval is used. The 0x7ff8 prefix means the normalized NaN will be a
|
|
|
+ * quiet NaN regardless of its remaining lower bits.
|
|
|
*
|
|
|
* The ME variant below is specifically for ARM byte order, which has the
|
|
|
* feature that while doubles have a mixed byte order (32107654), unsigned
|