mirror of
https://github.com/Ylianst/MeshAgent
synced 2026-01-06 02:23:59 +00:00
Updated Duktape to v2.3.0
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* duk_config.h configuration header generated by genconfig.py.
|
||||
*
|
||||
* Git commit: a459cf3c9bd1779fc01b435d69302b742675a08f
|
||||
* Git describe: v2.2.0
|
||||
* Git commit: d7fdb67f18561a50e06bafd196c6b423af9ad6fe
|
||||
* Git describe: v2.3.0
|
||||
* Git branch: master
|
||||
*
|
||||
* Supported platforms:
|
||||
@@ -218,12 +218,6 @@
|
||||
#define DUK_F_UNIX
|
||||
#endif
|
||||
|
||||
/* C++ */
|
||||
#undef DUK_F_CPP
|
||||
#if defined(__cplusplus)
|
||||
#define DUK_F_CPP
|
||||
#endif
|
||||
|
||||
/* Intel x86 (32-bit), x64 (64-bit) or x32 (64-bit but 32-bit pointers),
|
||||
* define only one of DUK_F_X86, DUK_F_X64, DUK_F_X32.
|
||||
* https://sites.google.com/site/x32abi/
|
||||
@@ -301,6 +295,12 @@
|
||||
#define DUK_F_CLANG
|
||||
#endif
|
||||
|
||||
/* C++ */
|
||||
#undef DUK_F_CPP
|
||||
#if defined(__cplusplus)
|
||||
#define DUK_F_CPP
|
||||
#endif
|
||||
|
||||
/* C99 or above */
|
||||
#undef DUK_F_C99
|
||||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
||||
@@ -836,9 +836,7 @@
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#if defined(DUK_F_CPP)
|
||||
#include <exception> /* std::exception */
|
||||
#endif
|
||||
/* <exception> is only included if needed, based on DUK_USE_xxx flags. */
|
||||
|
||||
/*
|
||||
* Architecture autodetection
|
||||
@@ -850,13 +848,16 @@
|
||||
#if !defined(DUK_USE_BYTEORDER)
|
||||
#define DUK_USE_BYTEORDER 1
|
||||
#endif
|
||||
/* XXX: This is technically not guaranteed because it's possible to configure
|
||||
* an x86 to require aligned accesses with Alignment Check (AC) flag.
|
||||
*/
|
||||
#if !defined(DUK_USE_ALIGN_BY)
|
||||
#define DUK_USE_ALIGN_BY 1
|
||||
#endif
|
||||
|
||||
#define DUK_USE_PACKED_TVAL
|
||||
|
||||
/* FreeBSD, -m32, and clang prior to 5.0 has union aliasing issues which
|
||||
* break duk_tval copying. Disable packed duk_tval automatically.
|
||||
*/
|
||||
#if defined(DUK_F_FREEBSD) && defined(DUK_F_X86) && \
|
||||
defined(__clang__) && defined(__clang_major__) && (__clang_major__ < 5)
|
||||
#undef DUK_USE_PACKED_TVAL
|
||||
#endif
|
||||
#define DUK_F_PACKED_TVAL_PROVIDED
|
||||
#elif defined(DUK_F_X64)
|
||||
/* --- x64 --- */
|
||||
@@ -864,12 +865,6 @@
|
||||
#if !defined(DUK_USE_BYTEORDER)
|
||||
#define DUK_USE_BYTEORDER 1
|
||||
#endif
|
||||
/* XXX: This is technically not guaranteed because it's possible to configure
|
||||
* an x86 to require aligned accesses with Alignment Check (AC) flag.
|
||||
*/
|
||||
#if !defined(DUK_USE_ALIGN_BY)
|
||||
#define DUK_USE_ALIGN_BY 1
|
||||
#endif
|
||||
#undef DUK_USE_PACKED_TVAL
|
||||
#define DUK_F_PACKED_TVAL_PROVIDED
|
||||
#elif defined(DUK_F_X32)
|
||||
@@ -878,48 +873,30 @@
|
||||
#if !defined(DUK_USE_BYTEORDER)
|
||||
#define DUK_USE_BYTEORDER 1
|
||||
#endif
|
||||
/* XXX: This is technically not guaranteed because it's possible to configure
|
||||
* an x86 to require aligned accesses with Alignment Check (AC) flag.
|
||||
*/
|
||||
#if !defined(DUK_USE_ALIGN_BY)
|
||||
#define DUK_USE_ALIGN_BY 1
|
||||
#endif
|
||||
#define DUK_USE_PACKED_TVAL
|
||||
#define DUK_F_PACKED_TVAL_PROVIDED
|
||||
#elif defined(DUK_F_ARM32)
|
||||
/* --- ARM 32-bit --- */
|
||||
#define DUK_USE_ARCH_STRING "arm32"
|
||||
/* Byte order varies, so rely on autodetect. */
|
||||
#if !defined(DUK_USE_ALIGN_BY)
|
||||
#define DUK_USE_ALIGN_BY 4
|
||||
#endif
|
||||
#define DUK_USE_PACKED_TVAL
|
||||
#define DUK_F_PACKED_TVAL_PROVIDED
|
||||
#elif defined(DUK_F_ARM64)
|
||||
/* --- ARM 64-bit --- */
|
||||
#define DUK_USE_ARCH_STRING "arm64"
|
||||
/* Byte order varies, so rely on autodetect. */
|
||||
#if !defined(DUK_USE_ALIGN_BY)
|
||||
#define DUK_USE_ALIGN_BY 8
|
||||
#endif
|
||||
#undef DUK_USE_PACKED_TVAL
|
||||
#define DUK_F_PACKED_TVAL_PROVIDED
|
||||
#elif defined(DUK_F_MIPS32)
|
||||
/* --- MIPS 32-bit --- */
|
||||
#define DUK_USE_ARCH_STRING "mips32"
|
||||
/* MIPS byte order varies so rely on autodetection. */
|
||||
#if !defined(DUK_USE_ALIGN_BY)
|
||||
#define DUK_USE_ALIGN_BY 8
|
||||
#endif
|
||||
#define DUK_USE_PACKED_TVAL
|
||||
#define DUK_F_PACKED_TVAL_PROVIDED
|
||||
#elif defined(DUK_F_MIPS64)
|
||||
/* --- MIPS 64-bit --- */
|
||||
#define DUK_USE_ARCH_STRING "mips64"
|
||||
/* MIPS byte order varies so rely on autodetection. */
|
||||
#if !defined(DUK_USE_ALIGN_BY)
|
||||
#define DUK_USE_ALIGN_BY 8
|
||||
#endif
|
||||
#undef DUK_USE_PACKED_TVAL
|
||||
#define DUK_F_PACKED_TVAL_PROVIDED
|
||||
#elif defined(DUK_F_PPC32)
|
||||
@@ -928,9 +905,6 @@
|
||||
#if !defined(DUK_USE_BYTEORDER)
|
||||
#define DUK_USE_BYTEORDER 3
|
||||
#endif
|
||||
#if !defined(DUK_USE_ALIGN_BY)
|
||||
#define DUK_USE_ALIGN_BY 8
|
||||
#endif
|
||||
#define DUK_USE_PACKED_TVAL
|
||||
#define DUK_F_PACKED_TVAL_PROVIDED
|
||||
#elif defined(DUK_F_PPC64)
|
||||
@@ -939,39 +913,24 @@
|
||||
#if !defined(DUK_USE_BYTEORDER)
|
||||
#define DUK_USE_BYTEORDER 3
|
||||
#endif
|
||||
#if !defined(DUK_USE_ALIGN_BY)
|
||||
#define DUK_USE_ALIGN_BY 8
|
||||
#endif
|
||||
#undef DUK_USE_PACKED_TVAL
|
||||
#define DUK_F_PACKED_TVAL_PROVIDED
|
||||
#elif defined(DUK_F_SPARC32)
|
||||
/* --- SPARC 32-bit --- */
|
||||
#define DUK_USE_ARCH_STRING "sparc32"
|
||||
/* SPARC byte order varies so rely on autodetection. */
|
||||
#if !defined(DUK_USE_ALIGN_BY)
|
||||
#define DUK_USE_ALIGN_BY 8
|
||||
#endif
|
||||
#define DUK_USE_PACKED_TVAL
|
||||
#define DUK_F_PACKED_TVAL_PROVIDED
|
||||
#elif defined(DUK_F_SPARC64)
|
||||
/* --- SPARC 64-bit --- */
|
||||
#define DUK_USE_ARCH_STRING "sparc64"
|
||||
/* SPARC byte order varies so rely on autodetection. */
|
||||
#if !defined(DUK_USE_ALIGN_BY)
|
||||
#define DUK_USE_ALIGN_BY 8
|
||||
#endif
|
||||
#undef DUK_USE_PACKED_TVAL
|
||||
#define DUK_F_PACKED_TVAL_PROVIDED
|
||||
#elif defined(DUK_F_SUPERH)
|
||||
/* --- SuperH --- */
|
||||
#define DUK_USE_ARCH_STRING "sh"
|
||||
/* Byte order varies, rely on autodetection. */
|
||||
/* Based on 'make checkalign' there are no alignment requirements on
|
||||
* Linux SH4, but align by 4 is probably a good basic default.
|
||||
*/
|
||||
#if !defined(DUK_USE_ALIGN_BY)
|
||||
#define DUK_USE_ALIGN_BY 4
|
||||
#endif
|
||||
#define DUK_USE_PACKED_TVAL
|
||||
#define DUK_F_PACKED_TVAL_PROVIDED
|
||||
#elif defined(DUK_F_M68K)
|
||||
@@ -980,9 +939,6 @@
|
||||
#if !defined(DUK_USE_BYTEORDER)
|
||||
#define DUK_USE_BYTEORDER 3
|
||||
#endif
|
||||
#if !defined(DUK_USE_ALIGN_BY)
|
||||
#define DUK_USE_ALIGN_BY 8
|
||||
#endif
|
||||
#define DUK_USE_PACKED_TVAL
|
||||
#define DUK_F_PACKED_TVAL_PROVIDED
|
||||
#elif defined(DUK_F_EMSCRIPTEN)
|
||||
@@ -991,9 +947,6 @@
|
||||
#if !defined(DUK_USE_BYTEORDER)
|
||||
#define DUK_USE_BYTEORDER 1
|
||||
#endif
|
||||
#if !defined(DUK_USE_ALIGN_BY)
|
||||
#define DUK_USE_ALIGN_BY 8
|
||||
#endif
|
||||
#undef DUK_USE_PACKED_TVAL
|
||||
#define DUK_F_PACKED_TVAL_PROVIDED
|
||||
#else
|
||||
@@ -2005,8 +1958,8 @@ typedef duk_uint_fast16_t duk_small_uint_fast_t;
|
||||
|
||||
/* Boolean values are represented with the platform 'unsigned int'. */
|
||||
typedef duk_small_uint_t duk_bool_t;
|
||||
#define DUK_BOOL_MIN DUK_SMALL_INT_MIN
|
||||
#define DUK_BOOL_MAX DUK_SMALL_INT_MAX
|
||||
#define DUK_BOOL_MIN DUK_SMALL_UINT_MIN
|
||||
#define DUK_BOOL_MAX DUK_SMALL_UINT_MAX
|
||||
|
||||
/* Index values must have at least 32-bit signed range. */
|
||||
typedef duk_int_t duk_idx_t;
|
||||
@@ -2540,10 +2493,13 @@ typedef struct duk_hthread duk_context;
|
||||
*
|
||||
* Assume unaligned accesses are not supported unless specifically allowed
|
||||
* in the target platform. Some platforms may support unaligned accesses
|
||||
* but alignment to 4 or 8 may still be desirable.
|
||||
* but alignment to 4 or 8 may still be desirable. Note that unaligned
|
||||
* accesses (and even pointers) relative to natural alignment (regardless
|
||||
* of target alignment) are technically undefined behavior and thus
|
||||
* compiler/architecture specific.
|
||||
*/
|
||||
|
||||
/* If not provided, use safe default for alignment. */
|
||||
/* If not forced, use safe default for alignment. */
|
||||
#if !defined(DUK_USE_ALIGN_BY)
|
||||
#define DUK_USE_ALIGN_BY 8
|
||||
#endif
|
||||
@@ -2595,6 +2551,7 @@ typedef struct duk_hthread duk_context;
|
||||
*/
|
||||
#define DUK_CAUSE_SEGFAULT() do { *((volatile duk_uint32_t *) NULL) = (duk_uint32_t) 0xdeadbeefUL; } while (0)
|
||||
#endif
|
||||
|
||||
#if !defined(DUK_UNREF)
|
||||
/* Macro for suppressing warnings for potentially unreferenced variables.
|
||||
* The variables can be actually unreferenced or unreferenced in some
|
||||
@@ -2604,9 +2561,24 @@ typedef struct duk_hthread duk_context;
|
||||
*/
|
||||
#define DUK_UNREF(x) do { (void) (x); } while (0)
|
||||
#endif
|
||||
#if !defined(DUK_NORETURN)
|
||||
|
||||
/* Fillin for DUK_NORETURN; DUK_WO_NORETURN() is used to insert dummy
|
||||
* dummy statements after noreturn calls to silence harmless compiler
|
||||
* warnings, e.g.:
|
||||
*
|
||||
* DUK_ERROR_TYPE(thr, "aiee");
|
||||
* DUK_WO_NORETURN(return 0;);
|
||||
*
|
||||
* Statements inside DUK_WO_NORETURN() must NEVER be actually reachable,
|
||||
* and they're only included to satisfy the compiler.
|
||||
*/
|
||||
#if defined(DUK_NORETURN)
|
||||
#define DUK_WO_NORETURN(stmt) do { } while (0)
|
||||
#else
|
||||
#define DUK_NORETURN(decl) decl
|
||||
#define DUK_WO_NORETURN(stmt) do { stmt } while (0)
|
||||
#endif
|
||||
|
||||
#if !defined(DUK_UNREACHABLE)
|
||||
/* Don't know how to declare unreachable point, so don't do it; this
|
||||
* may cause some spurious compilation warnings (e.g. "variable used
|
||||
@@ -2614,6 +2586,7 @@ typedef struct duk_hthread duk_context;
|
||||
*/
|
||||
#define DUK_UNREACHABLE() do { } while (0)
|
||||
#endif
|
||||
|
||||
#if !defined(DUK_LOSE_CONST)
|
||||
/* Convert any input pointer into a "void *", losing a const qualifier.
|
||||
* This is not fully portable because casting through duk_uintptr_t may
|
||||
@@ -2781,8 +2754,8 @@ typedef struct duk_hthread duk_context;
|
||||
#if defined(DUK_F_PACKED_TVAL_POSSIBLE)
|
||||
#define DUK_USE_PACKED_TVAL
|
||||
#endif
|
||||
|
||||
#undef DUK_F_PACKED_TVAL_POSSIBLE
|
||||
|
||||
#endif /* DUK_F_PACKED_TVAL_PROVIDED */
|
||||
/* Object property allocation layout has implications for memory and code
|
||||
* footprint and generated code size/speed. The best layout also depends
|
||||
@@ -2817,6 +2790,7 @@ typedef struct duk_hthread duk_context;
|
||||
* Autogenerated defaults
|
||||
*/
|
||||
|
||||
#undef DUK_USE_ALLOW_UNDEFINED_BEHAVIOR
|
||||
#define DUK_USE_ARRAY_BUILTIN
|
||||
#define DUK_USE_ARRAY_FASTPATH
|
||||
#define DUK_USE_ARRAY_PROP_FASTPATH
|
||||
@@ -2825,6 +2799,7 @@ typedef struct duk_hthread duk_context;
|
||||
#define DUK_USE_AUGMENT_ERROR_THROW
|
||||
#define DUK_USE_AVOID_PLATFORM_FUNCPTRS
|
||||
#define DUK_USE_BASE64_FASTPATH
|
||||
#define DUK_USE_BASE64_SUPPORT
|
||||
#define DUK_USE_BOOLEAN_BUILTIN
|
||||
#define DUK_USE_BUFFEROBJECT_SUPPORT
|
||||
#undef DUK_USE_BUFLEN16
|
||||
@@ -2902,6 +2877,7 @@ typedef struct duk_hthread duk_context;
|
||||
#undef DUK_USE_HEAPPTR_DEC16
|
||||
#undef DUK_USE_HEAPPTR_ENC16
|
||||
#define DUK_USE_HEX_FASTPATH
|
||||
#define DUK_USE_HEX_SUPPORT
|
||||
#define DUK_USE_HOBJECT_ARRAY_ABANDON_LIMIT 2
|
||||
#define DUK_USE_HOBJECT_ARRAY_FAST_RESIZE_LIMIT 9
|
||||
#define DUK_USE_HOBJECT_ARRAY_MINGROW_ADD 16
|
||||
@@ -2932,11 +2908,10 @@ typedef struct duk_hthread duk_context;
|
||||
#define DUK_USE_JX
|
||||
#define DUK_USE_LEXER_SLIDING_WINDOW
|
||||
#undef DUK_USE_LIGHTFUNC_BUILTINS
|
||||
#define DUK_USE_LITCACHE_SIZE 256
|
||||
#define DUK_USE_MARK_AND_SWEEP_RECLIMIT 256
|
||||
#define DUK_USE_MATH_BUILTIN
|
||||
#define DUK_USE_NATIVE_CALL_RECLIMIT 1000
|
||||
#define DUK_USE_NONSTD_ARRAY_CONCAT_TRAILER
|
||||
#define DUK_USE_NONSTD_ARRAY_MAP_TRAILER
|
||||
#define DUK_USE_NONSTD_ARRAY_SPLICE_DELCOUNT
|
||||
#undef DUK_USE_NONSTD_FUNC_CALLER_PROPERTY
|
||||
#undef DUK_USE_NONSTD_FUNC_SOURCE_PROPERTY
|
||||
@@ -3011,6 +2986,15 @@ typedef struct duk_hthread duk_context;
|
||||
|
||||
/* __OVERRIDE_DEFINES__ */
|
||||
|
||||
/*
|
||||
* Conditional includes
|
||||
*/
|
||||
|
||||
#if defined(DUK_F_CPP) && defined(DUK_USE_CPP_EXCEPTIONS)
|
||||
#include <exception> /* std::exception */
|
||||
#include <stdexcept> /* std::runtime_error */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Date provider selection
|
||||
*
|
||||
@@ -3552,6 +3536,12 @@ typedef struct duk_hthread duk_context;
|
||||
#if defined(DUK_USE_MS_STRINGTABLE_RESIZE)
|
||||
#error unsupported config option used (option has been removed): DUK_USE_MS_STRINGTABLE_RESIZE
|
||||
#endif
|
||||
#if defined(DUK_USE_NONSTD_ARRAY_CONCAT_TRAILER)
|
||||
#error unsupported config option used (option has been removed): DUK_USE_NONSTD_ARRAY_CONCAT_TRAILER
|
||||
#endif
|
||||
#if defined(DUK_USE_NONSTD_ARRAY_MAP_TRAILER)
|
||||
#error unsupported config option used (option has been removed): DUK_USE_NONSTD_ARRAY_MAP_TRAILER
|
||||
#endif
|
||||
#if defined(DUK_USE_NONSTD_REGEXP_DOLLAR_ESCAPE)
|
||||
#error unsupported config option used (option has been removed): DUK_USE_NONSTD_REGEXP_DOLLAR_ESCAPE
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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,
|
||||
* supported API is between the "BEGIN PUBLIC API" and "END PUBLIC API"
|
||||
* comments. Other parts of the header are Duktape internal and related to
|
||||
* e.g. platform/compiler/feature detection.
|
||||
*
|
||||
* Git commit a459cf3c9bd1779fc01b435d69302b742675a08f (v2.2.0).
|
||||
* Git commit d7fdb67f18561a50e06bafd196c6b423af9ad6fe (v2.3.0).
|
||||
* Git branch master.
|
||||
*
|
||||
* See Duktape AUTHORS.rst and LICENSE.txt for copyright and
|
||||
@@ -21,7 +21,7 @@
|
||||
*
|
||||
* (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
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -92,6 +92,14 @@
|
||||
* * Steven Don (https://github.com/shdon)
|
||||
* * Simon Stone (https://github.com/sstone1)
|
||||
* * \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
|
||||
* ===================
|
||||
@@ -130,6 +138,8 @@
|
||||
* * https://github.com/chris-y
|
||||
* * Laurent Zubiaur (https://github.com/lzubiaur)
|
||||
* * 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
|
||||
* (``sami.vaarala@iki.fi``) and I'll fix the omission.
|
||||
@@ -150,19 +160,19 @@
|
||||
|
||||
/* Duktape version, (major * 10000) + (minor * 100) + patch. Allows C code
|
||||
* 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 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
|
||||
* 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.
|
||||
*/
|
||||
#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"
|
||||
|
||||
/* External duk_config.h provides platform/compiler/OS dependent
|
||||
@@ -258,7 +268,7 @@ struct duk_number_list_entry {
|
||||
};
|
||||
|
||||
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 day; /* day: 1-31 */
|
||||
duk_double_t hours; /* hour: 0-59 */
|
||||
@@ -294,12 +304,12 @@ struct duk_time_components {
|
||||
/* Value types, used by e.g. duk_get_type() */
|
||||
#define DUK_TYPE_MIN 0U
|
||||
#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_POINTER 8U /* raw void 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_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_new_target(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_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
|
||||
*
|
||||
* 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_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);
|
||||
#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_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_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);
|
||||
#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_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_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);
|
||||
#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_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_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);
|
||||
#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_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_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_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
|
||||
@@ -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);
|
||||
|
||||
/*
|
||||
* Ecmascript operators
|
||||
* ECMAScript operators
|
||||
*/
|
||||
|
||||
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_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
|
||||
*/
|
||||
@@ -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_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
|
||||
* 8640000000000000
|
||||
* (= 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_LEEWAY (8.64e15 + 24 * 3600e3)
|
||||
|
||||
/* Ecmascript year range:
|
||||
/* ECMAScript year range:
|
||||
* > new Date(100e6 * 24 * 3600e3).toISOString()
|
||||
* '+275760-09-13T00:00:00.000Z'
|
||||
* > 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
|
||||
|
||||
/* 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
|
||||
* depend on the specific ordering, so change with care. 16 bits are not
|
||||
* enough for all parts (year, specifically).
|
||||
|
||||
Reference in New Issue
Block a user