vendor: update go-duktape to v2.3.0

This commit is contained in:
Péter Szilágyi 2019-05-27 16:36:06 +03:00
parent fc85777a21
commit 9cd338054f
No known key found for this signature in database
GPG Key ID: E9AE538CEDF8293D
17 changed files with 4248 additions and 2408 deletions

@ -247,16 +247,16 @@ func (d *Context) CompileFile(flags uint, path string) {
}
// See: http://duktape.org/api.html#duk_compile_lstring
func (d *Context) CompileLstring(flags uint, src string, len int) {
func (d *Context) CompileLstring(flags uint, src string, lenght int) {
__src__ := C.CString(src)
C._duk_compile_lstring(d.duk_context, C.duk_uint_t(flags), __src__, C.duk_size_t(len))
C._duk_compile_lstring(d.duk_context, C.duk_uint_t(flags), __src__, C.duk_size_t(lenght))
C.free(unsafe.Pointer(__src__))
}
// See: http://duktape.org/api.html#duk_compile_lstring_filename
func (d *Context) CompileLstringFilename(flags uint, src string, len int) {
func (d *Context) CompileLstringFilename(flags uint, src string, lenght int) {
__src__ := C.CString(src)
C._duk_compile_lstring_filename(d.duk_context, C.duk_uint_t(flags), __src__, C.duk_size_t(len))
C._duk_compile_lstring_filename(d.duk_context, C.duk_uint_t(flags), __src__, C.duk_size_t(lenght))
C.free(unsafe.Pointer(__src__))
}
@ -395,16 +395,16 @@ func (d *Context) EvalFileNoresult(path string) {
}
// See: http://duktape.org/api.html#duk_eval_lstring
func (d *Context) EvalLstring(src string, len int) {
func (d *Context) EvalLstring(src string, lenght int) {
__src__ := C.CString(src)
C._duk_eval_lstring(d.duk_context, __src__, C.duk_size_t(len))
C._duk_eval_lstring(d.duk_context, __src__, C.duk_size_t(lenght))
C.free(unsafe.Pointer(__src__))
}
// See: http://duktape.org/api.html#duk_eval_lstring_noresult
func (d *Context) EvalLstringNoresult(src string, len int) {
func (d *Context) EvalLstringNoresult(src string, lenght int) {
__src__ := C.CString(src)
C._duk_eval_lstring_noresult(d.duk_context, __src__, C.duk_size_t(len))
C._duk_eval_lstring_noresult(d.duk_context, __src__, C.duk_size_t(lenght))
C.free(unsafe.Pointer(__src__))
}
@ -801,17 +801,17 @@ func (d *Context) PcompileFile(flags uint, path string) error {
}
// See: http://duktape.org/api.html#duk_pcompile_lstring
func (d *Context) PcompileLstring(flags uint, src string, len int) error {
func (d *Context) PcompileLstring(flags uint, src string, lenght int) error {
__src__ := C.CString(src)
result := int(C._duk_pcompile_lstring(d.duk_context, C.duk_uint_t(flags), __src__, C.duk_size_t(len)))
result := int(C._duk_pcompile_lstring(d.duk_context, C.duk_uint_t(flags), __src__, C.duk_size_t(lenght)))
C.free(unsafe.Pointer(__src__))
return d.castStringToError(result)
}
// See: http://duktape.org/api.html#duk_pcompile_lstring_filename
func (d *Context) PcompileLstringFilename(flags uint, src string, len int) error {
func (d *Context) PcompileLstringFilename(flags uint, src string, lenght int) error {
__src__ := C.CString(src)
result := int(C._duk_pcompile_lstring_filename(d.duk_context, C.duk_uint_t(flags), __src__, C.duk_size_t(len)))
result := int(C._duk_pcompile_lstring_filename(d.duk_context, C.duk_uint_t(flags), __src__, C.duk_size_t(lenght)))
C.free(unsafe.Pointer(__src__))
return d.castStringToError(result)
}
@ -821,8 +821,7 @@ func (d *Context) PcompileString(flags uint, src string) error {
__src__ := C.CString(src)
result := int(C._duk_pcompile_string(d.duk_context, C.duk_uint_t(flags), __src__))
C.free(unsafe.Pointer(__src__))
fmt.Println("result herhehreh", result)
return nil //d.castStringToError(result)
return d.castStringToError(result)
}
// See: http://duktape.org/api.html#duk_pcompile_string_filename
@ -856,18 +855,18 @@ func (d *Context) PevalFileNoresult(path string) int {
}
// See: http://duktape.org/api.html#duk_peval_lstring
func (d *Context) PevalLstring(src string, len int) error {
func (d *Context) PevalLstring(src string, lenght int) error {
__src__ := C.CString(src)
result := int(C._duk_peval_lstring(d.duk_context, __src__, C.duk_size_t(len)))
result := int(C._duk_peval_lstring(d.duk_context, __src__, C.duk_size_t(lenght)))
C.free(unsafe.Pointer(__src__))
return d.castStringToError(result)
}
// See: http://duktape.org/api.html#duk_peval_lstring_noresult
func (d *Context) PevalLstringNoresult(src string, len int) int {
func (d *Context) PevalLstringNoresult(src string, lenght int) int {
__src__ := C.CString(src)
result := int(C._duk_peval_lstring_noresult(d.duk_context, __src__, C.duk_size_t(len)))
result := int(C._duk_peval_lstring_noresult(d.duk_context, __src__, C.duk_size_t(lenght)))
C.free(unsafe.Pointer(__src__))
return result
}
@ -1040,10 +1039,10 @@ func (d *Context) PushInt(val int) {
}
// See: http://duktape.org/api.html#duk_push_lstring
func (d *Context) PushLstring(str string, len int) string {
func (d *Context) PushLstring(str string, lenght int) string {
__str__ := C.CString(str)
var result string
if s := C.duk_push_lstring(d.duk_context, __str__, C.duk_size_t(len)); s != nil {
if s := C.duk_push_lstring(d.duk_context, __str__, C.duk_size_t(lenght)); s != nil {
result = C.GoString(s)
}
C.free(unsafe.Pointer(__str__))
@ -1590,6 +1589,16 @@ func (d *Context) PushExternalBuffer() {
C._duk_push_external_buffer(d.duk_context)
}
// See: http://duktape.org/api.html#duk_config_buffer
func (d *Context) ConfigBuffer(bufferIdx int, buffer []byte) {
C.duk_config_buffer(
d.duk_context,
C.duk_idx_t(bufferIdx),
unsafe.Pointer(&buffer[0]),
C.duk_size_t(len(buffer)),
)
}
/**
* Unimplemented.
*
@ -1608,7 +1617,6 @@ func (d *Context) PushExternalBuffer() {
* Realloc see: http://duktape.org/api.html#duk_realloc
* ReallocRaw see: http://duktape.org/api.html#duk_realloc_raw
* RequireCFunction see: http://duktape.org/api.html#duk_require_c_function
* ConfigBuffer see: http://duktape.org/api.html#duk_config_buffer
* GetBufferData see: http://duktape.org/api.html#duk_get_buffer_data
* StealBuffer see: http://duktape.org/api.html#duk_steal_buffer
* RequireBufferData see: http://duktape.org/api.html#duk_require_buffer_data

@ -1,72 +1,75 @@
package duktape
/*
#cgo !windows CFLAGS: -std=c99 -O3 -Wall -Wno-unused-value -fomit-frame-pointer -fstrict-aliasing
#cgo windows CFLAGS: -O3 -Wall -Wno-unused-value -fomit-frame-pointer -fstrict-aliasing
#include "duktape.h"
*/
import "C"
const (
CompileEval uint = 1 << iota
CompileFunction
CompileStrict
CompileSafe
CompileNoResult
CompileNoSource
CompileStrlen
CompileEval uint = C.DUK_COMPILE_EVAL
CompileFunction uint = C.DUK_COMPILE_FUNCTION
CompileStrict uint = C.DUK_COMPILE_STRICT
CompileShebang uint = C.DUK_COMPILE_SHEBANG
CompileSafe uint = C.DUK_COMPILE_SAFE
CompileNoResult uint = C.DUK_COMPILE_NORESULT
CompileNoSource uint = C.DUK_COMPILE_NOSOURCE
CompileStrlen uint = C.DUK_COMPILE_STRLEN
CompileNoFileName uint = C.DUK_COMPILE_NOFILENAME
CompileFuncExpr uint = C.DUK_COMPILE_FUNCEXPR
)
const (
TypeNone Type = iota
TypeUndefined
TypeNull
TypeBoolean
TypeNumber
TypeString
TypeObject
TypeBuffer
TypePointer
TypeLightFunc
TypeNone Type = C.DUK_TYPE_NONE
TypeUndefined Type = C.DUK_TYPE_UNDEFINED
TypeNull Type = C.DUK_TYPE_NULL
TypeBoolean Type = C.DUK_TYPE_BOOLEAN
TypeNumber Type = C.DUK_TYPE_NUMBER
TypeString Type = C.DUK_TYPE_STRING
TypeObject Type = C.DUK_TYPE_OBJECT
TypeBuffer Type = C.DUK_TYPE_BUFFER
TypePointer Type = C.DUK_TYPE_POINTER
TypeLightFunc Type = C.DUK_TYPE_LIGHTFUNC
)
const (
TypeMaskNone uint = 1 << iota
TypeMaskUndefined
TypeMaskNull
TypeMaskBoolean
TypeMaskNumber
TypeMaskString
TypeMaskObject
TypeMaskBuffer
TypeMaskPointer
TypeMaskLightFunc
TypeMaskNone uint = C.DUK_TYPE_MASK_NONE
TypeMaskUndefined uint = C.DUK_TYPE_MASK_UNDEFINED
TypeMaskNull uint = C.DUK_TYPE_MASK_NULL
TypeMaskBoolean uint = C.DUK_TYPE_MASK_BOOLEAN
TypeMaskNumber uint = C.DUK_TYPE_MASK_NUMBER
TypeMaskString uint = C.DUK_TYPE_MASK_STRING
TypeMaskObject uint = C.DUK_TYPE_MASK_OBJECT
TypeMaskBuffer uint = C.DUK_TYPE_MASK_BUFFER
TypeMaskPointer uint = C.DUK_TYPE_MASK_POINTER
TypeMaskLightFunc uint = C.DUK_TYPE_MASK_LIGHTFUNC
)
const (
EnumIncludeNonenumerable uint = 1 << iota
EnumIncludeInternal
EnumOwnPropertiesOnly
EnumArrayIndicesOnly
EnumSortArrayIndices
NoProxyBehavior
EnumIncludeNonenumerable uint = C.DUK_ENUM_INCLUDE_NONENUMERABLE
EnumIncludeHidden uint = C.DUK_ENUM_INCLUDE_HIDDEN
EnumIncludeSymbols uint = C.DUK_ENUM_INCLUDE_SYMBOLS
EnumExcludeStrings uint = C.DUK_ENUM_EXCLUDE_STRINGS
EnumOwnPropertiesOnly uint = C.DUK_ENUM_OWN_PROPERTIES_ONLY
EnumArrayIndicesOnly uint = C.DUK_ENUM_ARRAY_INDICES_ONLY
EnumSortArrayIndices uint = C.DUK_ENUM_SORT_ARRAY_INDICES
NoProxyBehavior uint = C.DUK_ENUM_NO_PROXY_BEHAVIOR
)
const (
ErrNone int = 0
// Internal to Duktape
ErrUnimplemented int = 50 + iota
ErrUnsupported
ErrInternal
ErrAlloc
ErrAssertion
ErrAPI
ErrUncaughtError
)
const (
// Common prototypes
ErrError int = 1 + iota
ErrEval
ErrRange
ErrReference
ErrSyntax
ErrType
ErrURI
ErrNone int = C.DUK_ERR_NONE
ErrError int = C.DUK_ERR_ERROR
ErrEval int = C.DUK_ERR_EVAL_ERROR
ErrRange int = C.DUK_ERR_RANGE_ERROR
ErrReference int = C.DUK_ERR_REFERENCE_ERROR
ErrSyntax int = C.DUK_ERR_SYNTAX_ERROR
ErrType int = C.DUK_ERR_TYPE_ERROR
ErrURI int = C.DUK_ERR_URI_ERROR
)
const (
@ -81,18 +84,18 @@ const (
)
const (
ErrRetError int = -(ErrError + iota)
ErrRetEval
ErrRetRange
ErrRetReference
ErrRetSyntax
ErrRetType
ErrRetURI
ErrRetError int = -(ErrError)
ErrRetEval int = -(ErrEval)
ErrRetRange int = -(ErrRange)
ErrRetReference int = -(ErrReference)
ErrRetSyntax int = -(ErrSyntax)
ErrRetType int = -(ErrType)
ErrRetURI int = -(ErrURI)
)
const (
ExecSuccess = iota
ExecError
ExecSuccess int = C.DUK_EXEC_SUCCESS
ExecError int = C.DUK_EXEC_ERROR
)
const (
@ -105,17 +108,16 @@ const (
)
const (
BufobjDuktapeAuffer = 0
BufobjNodejsAuffer = 1
BufobjArraybuffer = 2
BufobjDataview = 3
BufobjInt8array = 4
BufobjUint8array = 5
BufobjUint8clampedarray = 6
BufobjInt16array = 7
BufobjUint16array = 8
BufobjInt32array = 9
BufobjUint32array = 10
BufobjFloat32array = 11
BufobjFloat64array = 12
BufObjArrayBuffer int = C.DUK_BUFOBJ_ARRAYBUFFER
BufObjNodejsBuffer int = C.DUK_BUFOBJ_NODEJS_BUFFER
BufObjDataView int = C.DUK_BUFOBJ_DATAVIEW
BufobjInt8Array int = C.DUK_BUFOBJ_INT8ARRAY
BufobjUint8Array int = C.DUK_BUFOBJ_UINT8ARRAY
BufobjUint8ClampedArray int = C.DUK_BUFOBJ_UINT8CLAMPEDARRAY
BufObjInt16Array int = C.DUK_BUFOBJ_INT16ARRAY
BufObjUint16Array int = C.DUK_BUFOBJ_UINT16ARRAY
BufObjInt32Array int = C.DUK_BUFOBJ_INT32ARRAY
BufObjUint32Array int = C.DUK_BUFOBJ_UINT32ARRAY
BufObjFloat32Array int = C.DUK_BUFOBJ_FLOAT32ARRAY
BufObjFloat64Array int = C.DUK_BUFOBJ_FLOAT64ARRAY
)

@ -3,6 +3,10 @@
#include "duktape.h"
#if defined(__cplusplus)
extern "C" {
#endif
/* 32-bit (big endian) marker used at the end of pool entries so that wasted
* space can be detected. Waste tracking must be enabled explicitly.
*/
@ -220,4 +224,8 @@ static DUK__ALLOC_POOL_ALWAYS_INLINE void *duk_alloc_pool_dec16(duk_uint16_t val
}
#endif
#if defined(__cplusplus)
}
#endif /* end 'extern "C"' wrapper */
#endif /* DUK_ALLOC_POOL_H_INCLUDED */

@ -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

@ -13,10 +13,6 @@
/* XXX: Add some form of log level filtering. */
/* XXX: For now logs everything to stdout, V8/Node.js logs debug/info level
* to stdout, warn and above to stderr. Should this extra do the same?
*/
/* XXX: Should all output be written via e.g. console.write(formattedMsg)?
* This would make it easier for user code to redirect all console output
* to a custom backend.
@ -25,12 +21,10 @@
/* XXX: Init console object using duk_def_prop() when that call is available. */
static duk_ret_t duk__console_log_helper(duk_context *ctx, const char *error_name) {
duk_idx_t i, n;
duk_uint_t flags;
flags = (duk_uint_t) duk_get_current_magic(ctx);
n = duk_get_top(ctx);
duk_uint_t flags = (duk_uint_t) duk_get_current_magic(ctx);
FILE *output = (flags & DUK_CONSOLE_STDOUT_ONLY) ? stdout : stderr;
duk_idx_t n = duk_get_top(ctx);
duk_idx_t i;
duk_get_global_string(ctx, "console");
duk_get_prop_string(ctx, -1, "format");
@ -59,9 +53,9 @@ static duk_ret_t duk__console_log_helper(duk_context *ctx, const char *error_nam
duk_get_prop_string(ctx, -1, "stack");
}
fprintf(stdout, "%s\n", duk_to_string(ctx, -1));
fprintf(output, "%s\n", duk_to_string(ctx, -1));
if (flags & DUK_CONSOLE_FLUSH) {
fflush(stdout);
fflush(output);
}
return 0;
}
@ -110,6 +104,17 @@ static void duk__console_reg_vararg_func(duk_context *ctx, duk_c_function func,
}
void duk_console_init(duk_context *ctx, duk_uint_t flags) {
duk_uint_t flags_orig;
/* If both DUK_CONSOLE_STDOUT_ONLY and DUK_CONSOLE_STDERR_ONLY where specified,
* just turn off DUK_CONSOLE_STDOUT_ONLY and keep DUK_CONSOLE_STDERR_ONLY.
*/
if ((flags & DUK_CONSOLE_STDOUT_ONLY) && (flags & DUK_CONSOLE_STDERR_ONLY)) {
flags &= ~DUK_CONSOLE_STDOUT_ONLY;
}
/* Remember the (possibly corrected) flags we received. */
flags_orig = flags;
duk_push_object(ctx);
/* Custom function to format objects; user can replace.
@ -128,11 +133,22 @@ void duk_console_init(duk_context *ctx, duk_uint_t flags) {
"})(Duktape.enc)");
duk_put_prop_string(ctx, -2, "format");
flags = flags_orig;
if (!(flags & DUK_CONSOLE_STDOUT_ONLY) && !(flags & DUK_CONSOLE_STDERR_ONLY)) {
/* No output indicators were specified; these levels go to stdout. */
flags |= DUK_CONSOLE_STDOUT_ONLY;
}
duk__console_reg_vararg_func(ctx, duk__console_assert, "assert", flags);
duk__console_reg_vararg_func(ctx, duk__console_log, "log", flags);
duk__console_reg_vararg_func(ctx, duk__console_log, "debug", flags); /* alias to console.log */
duk__console_reg_vararg_func(ctx, duk__console_trace, "trace", flags);
duk__console_reg_vararg_func(ctx, duk__console_info, "info", flags);
flags = flags_orig;
if (!(flags & DUK_CONSOLE_STDOUT_ONLY) && !(flags & DUK_CONSOLE_STDERR_ONLY)) {
/* No output indicators were specified; these levels go to stderr. */
flags |= DUK_CONSOLE_STDERR_ONLY;
}
duk__console_reg_vararg_func(ctx, duk__console_warn, "warn", flags);
duk__console_reg_vararg_func(ctx, duk__console_error, "error", flags);
duk__console_reg_vararg_func(ctx, duk__console_error, "exception", flags); /* alias to console.error */

@ -3,12 +3,27 @@
#include "duktape.h"
#if defined(__cplusplus)
extern "C" {
#endif
/* Use a proxy wrapper to make undefined methods (console.foo()) no-ops. */
#define DUK_CONSOLE_PROXY_WRAPPER (1 << 0)
#define DUK_CONSOLE_PROXY_WRAPPER (1U << 0)
/* Flush output after every call. */
#define DUK_CONSOLE_FLUSH (1 << 1)
#define DUK_CONSOLE_FLUSH (1U << 1)
/* Send output to stdout only (default is mixed stdout/stderr). */
#define DUK_CONSOLE_STDOUT_ONLY (1U << 2)
/* Send output to stderr only (default is mixed stdout/stderr). */
#define DUK_CONSOLE_STDERR_ONLY (1U << 3)
/* Initialize the console system */
extern void duk_console_init(duk_context *ctx, duk_uint_t flags);
#if defined(__cplusplus)
}
#endif /* end 'extern "C"' wrapper */
#endif /* DUK_CONSOLE_H_INCLUDED */

@ -3,7 +3,11 @@
#include "duktape.h"
/* Log levels */
#if defined(__cplusplus)
extern "C" {
#endif
/* Log levels. */
#define DUK_LOG_TRACE 0
#define DUK_LOG_DEBUG 1
#define DUK_LOG_INFO 2
@ -17,4 +21,8 @@ extern void duk_logging_init(duk_context *ctx, duk_uint_t flags);
extern void duk_log_va(duk_context *ctx, duk_int_t level, const char *fmt, va_list ap);
extern void duk_log(duk_context *ctx, duk_int_t level, const char *fmt, ...);
#if defined(__cplusplus)
}
#endif /* end 'extern "C"' wrapper */
#endif /* DUK_LOGGING_H_INCLUDED */

@ -4,9 +4,17 @@
#include <stdarg.h> /* va_list etc */
#include <stddef.h> /* size_t */
#if defined(__cplusplus)
extern "C" {
#endif
extern int duk_minimal_sprintf(char *str, const char *format, ...);
extern int duk_minimal_snprintf(char *str, size_t size, const char *format, ...);
extern int duk_minimal_vsnprintf(char *str, size_t size, const char *format, va_list ap);
extern int duk_minimal_sscanf(const char *str, const char *format, ...);
#if defined(__cplusplus)
}
#endif /* end 'extern "C"' wrapper */
#endif /* DUK_MINIMAL_PRINTF_H_INCLUDED */

@ -263,7 +263,7 @@ static duk_ret_t duk__require(duk_context *ctx) {
* done with Object.defineProperty().
*
* XXX: require.id could also be just made non-configurable, as there
* is no practical reason to touch it (at least from Ecmascript code).
* is no practical reason to touch it (at least from ECMAScript code).
*/
duk_push_c_function(ctx, duk__require, 1 /*nargs*/);
duk_push_string(ctx, "name");
@ -307,7 +307,7 @@ static duk_ret_t duk__require(duk_context *ctx) {
* Call user provided module search function and build the wrapped
* module source code (if necessary). The module search function
* can be used to implement pure Ecmacsript, pure C, and mixed
* Ecmascript/C modules.
* ECMAScript/C modules.
*
* The module search function can operate on the exports table directly
* (e.g. DLL code can register values to it). It can also return a

@ -3,6 +3,10 @@
#include "duktape.h"
#if defined(__cplusplus)
extern "C" {
#endif
/* Maximum length of CommonJS module identifier to resolve. Length includes
* both current module ID, requested (possibly relative) module ID, and a
* slash in between.
@ -11,4 +15,8 @@
extern void duk_module_duktape_init(duk_context *ctx);
#if defined(__cplusplus)
}
#endif /* end 'extern "C"' wrapper */
#endif /* DUK_MODULE_DUKTAPE_H_INCLUDED */

@ -3,7 +3,15 @@
#include "duktape.h"
#if defined(__cplusplus)
extern "C" {
#endif
extern duk_ret_t duk_module_node_peval_main(duk_context *ctx, const char *path);
extern void duk_module_node_init(duk_context *ctx);
#if defined(__cplusplus)
}
#endif /* end 'extern "C"' wrapper */
#endif /* DUK_MODULE_NODE_H_INCLUDED */

@ -3,8 +3,16 @@
#include "duktape.h"
#if defined(__cplusplus)
extern "C" {
#endif
/* No flags at the moment. */
extern void duk_print_alert_init(duk_context *ctx, duk_uint_t flags);
#if defined(__cplusplus)
}
#endif /* end 'extern "C"' wrapper */
#endif /* DUK_PRINT_ALERT_H_INCLUDED */

@ -3,6 +3,10 @@
#include "duktape.h"
#if defined(__cplusplus)
extern "C" {
#endif
/* Straight flag rename */
#if !defined(DUK_ENUM_INCLUDE_INTERNAL)
#define DUK_ENUM_INCLUDE_INTERNAL DUK_ENUM_INCLUDE_HIDDEN
@ -25,4 +29,8 @@ extern void duk_to_defaultvalue(duk_context *ctx, duk_idx_t idx, duk_int_t hint)
#define duk_push_string_file(ctx,path) \
duk_push_string_file_raw((ctx), (path), 0)
#if defined(__cplusplus)
}
#endif /* end 'extern "C"' wrapper */
#endif /* DUK_V1_COMPAT_INCLUDED */

File diff suppressed because it is too large Load Diff

@ -199,7 +199,7 @@ func (e *Error) Error() string {
return fmt.Sprintf("%s: %s", e.Type, e.Message)
}
type Type int
type Type uint
func (t Type) IsNone() bool { return t == TypeNone }
func (t Type) IsUndefined() bool { return t == TypeUndefined }

@ -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).

6
vendor/vendor.json vendored

@ -941,10 +941,10 @@
"revisionTime": "2016-06-21T03:49:01Z"
},
{
"checksumSHA1": "vndxs5Tv09/8S+Dr2PBAiM557lI=",
"checksumSHA1": "h+m6mYCZIKnMQI24faKak5o19es=",
"path": "gopkg.in/olebedev/go-duktape.v3",
"revision": "abf0ba0be5d5d36b1f9266463cc320b9a5ab224e",
"revisionTime": "2018-03-02T12:15:09Z"
"revision": "ec84240a7772c7a122b1c58a13398210659f7c40",
"revisionTime": "2019-02-13T23:42:57Z"
},
{
"checksumSHA1": "4BwmmgQUhWtizsR2soXND0nqZ1I=",