Mercurial > code
diff extern/duktape/duktape.h @ 501:4c786b58eacd
Import duktape 1.4.0
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 28 Jan 2016 09:25:19 +0100 |
parents | e2cefd0ee511 |
children |
line wrap: on
line diff
--- a/extern/duktape/duktape.h Wed Jan 27 19:53:10 2016 +0100 +++ b/extern/duktape/duktape.h Thu Jan 28 09:25:19 2016 +0100 @@ -1,11 +1,12 @@ /* - * Duktape public API for Duktape 1.3.0. + * Duktape public API for Duktape 1.4.0. * 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 675165f35ea3a5bac34ff4d0a58b007cc2f442dc (v1.3.0). + * Git commit cad6f595382a0cc1a7e4207794ade5be11b3e397 (v1.4.0). + * Git branch master. * * See Duktape AUTHORS.rst and LICENSE.txt for copyright and * licensing information. @@ -19,7 +20,7 @@ * * (http://opensource.org/licenses/MIT) * - * Copyright (c) 2013-2015 by Duktape authors (see AUTHORS.rst) + * Copyright (c) 2013-2016 by Duktape authors (see AUTHORS.rst) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -70,6 +71,7 @@ * * Legimet <legimet.calc@gmail.com> * * Karl Skomski <karl@skomski.com> * * Bruce Pascoe <fatcerberus1@gmail.com> + * * Ren\u00e9 Hollander <rene@rene8888.at> * * Other contributions * =================== @@ -106,6 +108,7 @@ * * https://github.com/sstruchtrup * * Michael Drake (https://github.com/tlsa) * * https://github.com/chris-y + * * Laurent Zubiaur (https://github.com/lzubiaur) * * If you are accidentally missing from this list, send me an e-mail * (``sami.vaarala@iki.fi``) and I'll fix the omission. @@ -210,13 +213,16 @@ * 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 10300L +#define DUK_VERSION 10400L -/* 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.3.0" +#define DUK_GIT_COMMIT "cad6f595382a0cc1a7e4207794ade5be11b3e397" +#define DUK_GIT_DESCRIBE "v1.4.0" +#define DUK_GIT_BRANCH "master" /* Duktape debug protocol version used by this build. */ #define DUK_DEBUG_PROTOCOL_VERSION 1 @@ -238,6 +244,7 @@ #define DUK_API_ENTRY_STACK 64 /* Value types, used by e.g. duk_get_type() */ +#define DUK_TYPE_MIN 0 #define DUK_TYPE_NONE 0 /* no value, e.g. invalid index */ #define DUK_TYPE_UNDEFINED 1 /* Ecmascript undefined */ #define DUK_TYPE_NULL 2 /* Ecmascript null */ @@ -248,6 +255,7 @@ #define DUK_TYPE_BUFFER 7 /* fixed or dynamic, garbage collected byte buffer */ #define DUK_TYPE_POINTER 8 /* raw void pointer */ #define DUK_TYPE_LIGHTFUNC 9 /* lightweight function pointer */ +#define DUK_TYPE_MAX 9 /* Value mask types, used by e.g. duk_get_type_mask() */ #define DUK_TYPE_MASK_NONE (1 << DUK_TYPE_NONE) @@ -297,6 +305,12 @@ #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 */ @@ -544,7 +558,7 @@ 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_BUF_FLAG_DYNAMIC : 0); + 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 /*flags*/) #define duk_push_dynamic_buffer(ctx,size) \ @@ -611,7 +625,8 @@ DUK_EXTERNAL_DECL duk_bool_t duk_is_bound_function(duk_context *ctx, duk_idx_t index); 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); +#define duk_is_callable(ctx,index) \ + duk_is_function((ctx), (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); @@ -638,6 +653,18 @@ DUK_EXTERNAL_DECL duk_errcode_t duk_get_error_code(duk_context *ctx, duk_idx_t index); #define duk_is_error(ctx,index) \ (duk_get_error_code((ctx), (index)) != 0) +#define duk_is_eval_error(ctx,index) \ + (duk_get_error_code((ctx), (index)) == DUK_ERR_EVAL_ERROR) +#define duk_is_range_error(ctx,index) \ + (duk_get_error_code((ctx), (index)) == DUK_ERR_RANGE_ERROR) +#define duk_is_reference_error(ctx,index) \ + (duk_get_error_code((ctx), (index)) == DUK_ERR_REFERENCE_ERROR) +#define duk_is_syntax_error(ctx,index) \ + (duk_get_error_code((ctx), (index)) == DUK_ERR_SYNTAX_ERROR) +#define duk_is_type_error(ctx,index) \ + (duk_get_error_code((ctx), (index)) == DUK_ERR_TYPE_ERROR) +#define duk_is_uri_error(ctx,index) \ + (duk_get_error_code((ctx), (index)) == DUK_ERR_URI_ERROR) /* * Get operations: no coercion, returns default value for invalid @@ -682,6 +709,9 @@ DUK_EXTERNAL_DECL void *duk_require_pointer(duk_context *ctx, duk_idx_t index); DUK_EXTERNAL_DECL duk_c_function duk_require_c_function(duk_context *ctx, duk_idx_t index); DUK_EXTERNAL_DECL duk_context *duk_require_context(duk_context *ctx, duk_idx_t index); +DUK_EXTERNAL_DECL void duk_require_function(duk_context *ctx, duk_idx_t index); +#define duk_require_callable(ctx,index) \ + duk_require_function((ctx), (index)) DUK_EXTERNAL_DECL void *duk_require_heapptr(duk_context *ctx, duk_idx_t index); #define duk_require_object_coercible(ctx,index) \ @@ -1203,13 +1233,13 @@ union duk_double_union { double d; float f[2]; -#ifdef DUK_USE_64BIT_OPS +#if defined(DUK_USE_64BIT_OPS) duk_uint64_t ull[1]; #endif duk_uint32_t ui[2]; duk_uint16_t us[4]; duk_uint8_t uc[8]; -#ifdef DUK_USE_PACKED_TVAL_POSSIBLE +#if defined(DUK_USE_PACKED_TVAL) void *vp[2]; /* used by packed duk_tval, assumes sizeof(void *) == 4 */ #endif }; @@ -1348,7 +1378,7 @@ * * 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. * @@ -1356,7 +1386,8 @@ * 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