You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ph...@apache.org on 2018/01/02 18:28:07 UTC
[12/51] [partial] nifi-minifi-cpp git commit: MINIFICPP-351: Remove
Civetweb third party directory
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/ede68a10/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hstring.h
----------------------------------------------------------------------
diff --git a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hstring.h b/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hstring.h
deleted file mode 100644
index f80ec34..0000000
--- a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hstring.h
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Heap string representation.
- *
- * Strings are byte sequences ordinarily stored in extended UTF-8 format,
- * allowing values larger than the official UTF-8 range (used internally)
- * and also allowing UTF-8 encoding of surrogate pairs (CESU-8 format).
- * Strings may also be invalid UTF-8 altogether which is the case e.g. with
- * strings used as internal property names and raw buffers converted to
- * strings. In such cases the 'clen' field contains an inaccurate value.
- *
- * Ecmascript requires support for 32-bit long strings. However, since each
- * 16-bit codepoint can take 3 bytes in CESU-8, this representation can only
- * support about 1.4G codepoint long strings in extreme cases. This is not
- * really a practical issue.
- */
-
-#ifndef DUK_HSTRING_H_INCLUDED
-#define DUK_HSTRING_H_INCLUDED
-
-/* Impose a maximum string length for now. Restricted artificially to
- * ensure adding a heap header length won't overflow size_t. The limit
- * should be synchronized with DUK_HBUFFER_MAX_BYTELEN.
- *
- * E5.1 makes provisions to support strings longer than 4G characters.
- * This limit should be eliminated on 64-bit platforms (and increased
- * closer to maximum support on 32-bit platforms).
- */
-
-#if defined(DUK_USE_STRLEN16)
-#define DUK_HSTRING_MAX_BYTELEN (0x0000ffffUL)
-#else
-#define DUK_HSTRING_MAX_BYTELEN (0x7fffffffUL)
-#endif
-
-/* XXX: could add flags for "is valid CESU-8" (Ecmascript compatible strings),
- * "is valid UTF-8", "is valid extended UTF-8" (internal strings are not,
- * regexp bytecode is), and "contains non-BMP characters". These are not
- * needed right now.
- */
-
-#define DUK_HSTRING_FLAG_ASCII DUK_HEAPHDR_USER_FLAG(0) /* string is ASCII, clen == blen */
-#define DUK_HSTRING_FLAG_ARRIDX DUK_HEAPHDR_USER_FLAG(1) /* string is a valid array index */
-#define DUK_HSTRING_FLAG_INTERNAL DUK_HEAPHDR_USER_FLAG(2) /* string is internal */
-#define DUK_HSTRING_FLAG_RESERVED_WORD DUK_HEAPHDR_USER_FLAG(3) /* string is a reserved word (non-strict) */
-#define DUK_HSTRING_FLAG_STRICT_RESERVED_WORD DUK_HEAPHDR_USER_FLAG(4) /* string is a reserved word (strict) */
-#define DUK_HSTRING_FLAG_EVAL_OR_ARGUMENTS DUK_HEAPHDR_USER_FLAG(5) /* string is 'eval' or 'arguments' */
-#define DUK_HSTRING_FLAG_EXTDATA DUK_HEAPHDR_USER_FLAG(6) /* string data is external (duk_hstring_external) */
-
-#define DUK_HSTRING_HAS_ASCII(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_ASCII)
-#define DUK_HSTRING_HAS_ARRIDX(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_ARRIDX)
-#define DUK_HSTRING_HAS_INTERNAL(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_INTERNAL)
-#define DUK_HSTRING_HAS_RESERVED_WORD(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_RESERVED_WORD)
-#define DUK_HSTRING_HAS_STRICT_RESERVED_WORD(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_STRICT_RESERVED_WORD)
-#define DUK_HSTRING_HAS_EVAL_OR_ARGUMENTS(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_EVAL_OR_ARGUMENTS)
-#define DUK_HSTRING_HAS_EXTDATA(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_EXTDATA)
-
-#define DUK_HSTRING_SET_ASCII(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_ASCII)
-#define DUK_HSTRING_SET_ARRIDX(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_ARRIDX)
-#define DUK_HSTRING_SET_INTERNAL(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_INTERNAL)
-#define DUK_HSTRING_SET_RESERVED_WORD(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_RESERVED_WORD)
-#define DUK_HSTRING_SET_STRICT_RESERVED_WORD(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_STRICT_RESERVED_WORD)
-#define DUK_HSTRING_SET_EVAL_OR_ARGUMENTS(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_EVAL_OR_ARGUMENTS)
-#define DUK_HSTRING_SET_EXTDATA(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_EXTDATA)
-
-#define DUK_HSTRING_CLEAR_ASCII(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_ASCII)
-#define DUK_HSTRING_CLEAR_ARRIDX(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_ARRIDX)
-#define DUK_HSTRING_CLEAR_INTERNAL(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_INTERNAL)
-#define DUK_HSTRING_CLEAR_RESERVED_WORD(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_RESERVED_WORD)
-#define DUK_HSTRING_CLEAR_STRICT_RESERVED_WORD(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_STRICT_RESERVED_WORD)
-#define DUK_HSTRING_CLEAR_EVAL_OR_ARGUMENTS(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_EVAL_OR_ARGUMENTS)
-#define DUK_HSTRING_CLEAR_EXTDATA(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_EXTDATA)
-
-#if 0 /* Slightly smaller code without explicit flag, but explicit flag
- * is very useful when 'clen' is dropped.
- */
-#define DUK_HSTRING_IS_ASCII(x) (DUK_HSTRING_GET_BYTELEN((x)) == DUK_HSTRING_GET_CHARLEN((x)))
-#endif
-#define DUK_HSTRING_IS_ASCII(x) DUK_HSTRING_HAS_ASCII((x))
-#define DUK_HSTRING_IS_EMPTY(x) (DUK_HSTRING_GET_BYTELEN((x)) == 0)
-
-#if defined(DUK_USE_STRHASH16)
-#define DUK_HSTRING_GET_HASH(x) ((x)->hdr.h_flags >> 16)
-#define DUK_HSTRING_SET_HASH(x,v) do { \
- (x)->hdr.h_flags = ((x)->hdr.h_flags & 0x0000ffffUL) | ((v) << 16); \
- } while (0)
-#else
-#define DUK_HSTRING_GET_HASH(x) ((x)->hash)
-#define DUK_HSTRING_SET_HASH(x,v) do { \
- (x)->hash = (v); \
- } while (0)
-#endif
-
-#if defined(DUK_USE_STRLEN16)
-#define DUK_HSTRING_GET_BYTELEN(x) ((x)->hdr.h_strextra16)
-#define DUK_HSTRING_SET_BYTELEN(x,v) do { \
- (x)->hdr.h_strextra16 = (v); \
- } while (0)
-#if defined(DUK_USE_HSTRING_CLEN)
-#define DUK_HSTRING_GET_CHARLEN(x) ((x)->clen16)
-#define DUK_HSTRING_SET_CHARLEN(x,v) do { \
- (x)->clen16 = (v); \
- } while (0)
-#else
-#define DUK_HSTRING_GET_CHARLEN(x) duk_hstring_get_charlen((x))
-#define DUK_HSTRING_SET_CHARLEN(x,v) do { \
- DUK_ASSERT(0); /* should never be called */ \
- } while (0)
-#endif
-#else
-#define DUK_HSTRING_GET_BYTELEN(x) ((x)->blen)
-#define DUK_HSTRING_SET_BYTELEN(x,v) do { \
- (x)->blen = (v); \
- } while (0)
-#define DUK_HSTRING_GET_CHARLEN(x) ((x)->clen)
-#define DUK_HSTRING_SET_CHARLEN(x,v) do { \
- (x)->clen = (v); \
- } while (0)
-#endif
-
-#if defined(DUK_USE_HSTRING_EXTDATA)
-#define DUK_HSTRING_GET_EXTDATA(x) \
- ((x)->extdata)
-#define DUK_HSTRING_GET_DATA(x) \
- (DUK_HSTRING_HAS_EXTDATA((x)) ? \
- DUK_HSTRING_GET_EXTDATA((const duk_hstring_external *) (x)) : ((const duk_uint8_t *) ((x) + 1)))
-#else
-#define DUK_HSTRING_GET_DATA(x) \
- ((const duk_uint8_t *) ((x) + 1))
-#endif
-
-#define DUK_HSTRING_GET_DATA_END(x) \
- (DUK_HSTRING_GET_DATA((x)) + (x)->blen)
-
-/* marker value; in E5 2^32-1 is not a valid array index (2^32-2 is highest valid) */
-#define DUK_HSTRING_NO_ARRAY_INDEX (0xffffffffUL)
-
-/* get array index related to string (or return DUK_HSTRING_NO_ARRAY_INDEX);
- * avoids helper call if string has no array index value.
- */
-#define DUK_HSTRING_GET_ARRIDX_FAST(h) \
- (DUK_HSTRING_HAS_ARRIDX((h)) ? duk_js_to_arrayindex_string_helper((h)) : DUK_HSTRING_NO_ARRAY_INDEX)
-
-/* slower but more compact variant */
-#define DUK_HSTRING_GET_ARRIDX_SLOW(h) \
- (duk_js_to_arrayindex_string_helper((h)))
-
-/*
- * Misc
- */
-
-struct duk_hstring {
- /* Smaller heaphdr than for other objects, because strings are held
- * in string intern table which requires no link pointers. Much of
- * the 32-bit flags field is unused by flags, so we can stuff a 16-bit
- * field in there.
- */
- duk_heaphdr_string hdr;
-
- /* Note: we could try to stuff a partial hash (e.g. 16 bits) into the
- * shared heap header. Good hashing needs more hash bits though.
- */
-
- /* string hash */
-#if defined(DUK_USE_STRHASH16)
- /* If 16-bit hash is in use, stuff it into duk_heaphdr_string flags. */
-#else
- duk_uint32_t hash;
-#endif
-
- /* length in bytes (not counting NUL term) */
-#if defined(DUK_USE_STRLEN16)
- /* placed in duk_heaphdr_string */
-#else
- duk_uint32_t blen;
-#endif
-
- /* length in codepoints (must be E5 compatible) */
-#if defined(DUK_USE_STRLEN16)
-#if defined(DUK_USE_HSTRING_CLEN)
- duk_uint16_t clen16;
-#else
- /* computed live */
-#endif
-#else
- duk_uint32_t clen;
-#endif
-
- /*
- * String value of 'blen+1' bytes follows (+1 for NUL termination
- * convenience for C API). No alignment needs to be guaranteed
- * for strings, but fields above should guarantee alignment-by-4
- * (but not alignment-by-8).
- */
-};
-
-/* The external string struct is defined even when the feature is inactive. */
-struct duk_hstring_external {
- duk_hstring str;
-
- /*
- * For an external string, the NUL-terminated string data is stored
- * externally. The user must guarantee that data behind this pointer
- * doesn't change while it's used.
- */
-
- const duk_uint8_t *extdata;
-};
-
-/*
- * Prototypes
- */
-
-DUK_INTERNAL_DECL duk_ucodepoint_t duk_hstring_char_code_at_raw(duk_hthread *thr, duk_hstring *h, duk_uint_t pos);
-
-#if !defined(DUK_USE_HSTRING_CLEN)
-DUK_INTERNAL_DECL duk_size_t duk_hstring_get_charlen(duk_hstring *h);
-#endif
-
-#endif /* DUK_HSTRING_H_INCLUDED */
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/ede68a10/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hstring_misc.c
----------------------------------------------------------------------
diff --git a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hstring_misc.c b/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hstring_misc.c
deleted file mode 100644
index b685147..0000000
--- a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hstring_misc.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Misc support functions
- */
-
-#include "duk_internal.h"
-
-DUK_INTERNAL duk_ucodepoint_t duk_hstring_char_code_at_raw(duk_hthread *thr, duk_hstring *h, duk_uint_t pos) {
- duk_uint32_t boff;
- const duk_uint8_t *p, *p_start, *p_end;
- duk_ucodepoint_t cp;
-
- /* Caller must check character offset to be inside the string. */
- DUK_ASSERT(thr != NULL);
- DUK_ASSERT(h != NULL);
- DUK_ASSERT_DISABLE(pos >= 0); /* unsigned */
- DUK_ASSERT(pos < (duk_uint_t) DUK_HSTRING_GET_CHARLEN(h));
-
- boff = duk_heap_strcache_offset_char2byte(thr, h, (duk_uint32_t) pos);
- DUK_DDD(DUK_DDDPRINT("charCodeAt: pos=%ld -> boff=%ld, str=%!O",
- (long) pos, (long) boff, (duk_heaphdr *) h));
- DUK_ASSERT_DISABLE(boff >= 0);
- DUK_ASSERT(boff < DUK_HSTRING_GET_BYTELEN(h));
-
- p_start = DUK_HSTRING_GET_DATA(h);
- p_end = p_start + DUK_HSTRING_GET_BYTELEN(h);
- p = p_start + boff;
- DUK_DDD(DUK_DDDPRINT("p_start=%p, p_end=%p, p=%p",
- (const void *) p_start, (const void *) p_end,
- (const void *) p));
-
- /* This may throw an error though not for valid E5 strings. */
- cp = duk_unicode_decode_xutf8_checked(thr, &p, p_start, p_end);
- return cp;
-}
-
-#if !defined(DUK_USE_HSTRING_CLEN)
-DUK_INTERNAL duk_size_t duk_hstring_get_charlen(duk_hstring *h) {
- if (DUK_HSTRING_HAS_ASCII(h)) {
- /* Most practical strings will go here. */
- return DUK_HSTRING_GET_BYTELEN(h);
- } else {
- return duk_unicode_unvalidated_utf8_length(DUK_HSTRING_GET_DATA(h), DUK_HSTRING_GET_BYTELEN(h));
- }
-}
-#endif /* !DUK_USE_HSTRING_CLEN */
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/ede68a10/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hthread.h
----------------------------------------------------------------------
diff --git a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hthread.h b/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hthread.h
deleted file mode 100644
index d904c64..0000000
--- a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hthread.h
+++ /dev/null
@@ -1,380 +0,0 @@
-/*
- * Heap thread object representation.
- *
- * duk_hthread is also the 'context' (duk_context) for exposed APIs
- * which mostly operate on the topmost frame of the value stack.
- */
-
-#ifndef DUK_HTHREAD_H_INCLUDED
-#define DUK_HTHREAD_H_INCLUDED
-
-/*
- * Stack constants
- */
-
-#define DUK_VALSTACK_GROW_STEP 128 /* roughly 1 kiB */
-#define DUK_VALSTACK_SHRINK_THRESHOLD 256 /* roughly 2 kiB */
-#define DUK_VALSTACK_SHRINK_SPARE 64 /* roughly 0.5 kiB */
-#define DUK_VALSTACK_INITIAL_SIZE 128 /* roughly 1.0 kiB -> but rounds up to DUK_VALSTACK_GROW_STEP in practice */
-#define DUK_VALSTACK_INTERNAL_EXTRA 64 /* internal extra elements assumed on function entry,
- * always added to user-defined 'extra' for e.g. the
- * duk_check_stack() call.
- */
-#define DUK_VALSTACK_API_ENTRY_MINIMUM DUK_API_ENTRY_STACK
- /* number of elements guaranteed to be user accessible
- * (in addition to call arguments) on Duktape/C function entry.
- */
-
-/* Note: DUK_VALSTACK_INITIAL_SIZE must be >= DUK_VALSTACK_API_ENTRY_MINIMUM
- * + DUK_VALSTACK_INTERNAL_EXTRA so that the initial stack conforms to spare
- * requirements.
- */
-
-#define DUK_VALSTACK_DEFAULT_MAX 1000000L
-
-#define DUK_CALLSTACK_GROW_STEP 8 /* roughly 256 bytes */
-#define DUK_CALLSTACK_SHRINK_THRESHOLD 16 /* roughly 512 bytes */
-#define DUK_CALLSTACK_SHRINK_SPARE 8 /* roughly 256 bytes */
-#define DUK_CALLSTACK_INITIAL_SIZE 8
-#define DUK_CALLSTACK_DEFAULT_MAX 10000L
-
-#define DUK_CATCHSTACK_GROW_STEP 4 /* roughly 64 bytes */
-#define DUK_CATCHSTACK_SHRINK_THRESHOLD 8 /* roughly 128 bytes */
-#define DUK_CATCHSTACK_SHRINK_SPARE 4 /* roughly 64 bytes */
-#define DUK_CATCHSTACK_INITIAL_SIZE 4
-#define DUK_CATCHSTACK_DEFAULT_MAX 10000L
-
-/*
- * Activation defines
- */
-
-#define DUK_ACT_FLAG_STRICT (1 << 0) /* function executes in strict mode */
-#define DUK_ACT_FLAG_TAILCALLED (1 << 1) /* activation has tail called one or more times */
-#define DUK_ACT_FLAG_CONSTRUCT (1 << 2) /* function executes as a constructor (called via "new") */
-#define DUK_ACT_FLAG_PREVENT_YIELD (1 << 3) /* activation prevents yield (native call or "new") */
-#define DUK_ACT_FLAG_DIRECT_EVAL (1 << 4) /* activation is a direct eval call */
-#define DUK_ACT_FLAG_BREAKPOINT_ACTIVE (1 << 5) /* activation has active breakpoint(s) */
-
-#define DUK_ACT_GET_FUNC(act) ((act)->func)
-
-/*
- * Flags for __FILE__ / __LINE__ registered into tracedata
- */
-
-#define DUK_TB_FLAG_NOBLAME_FILELINE (1 << 0) /* don't report __FILE__ / __LINE__ as fileName/lineNumber */
-
-/*
- * Catcher defines
- */
-
-/* flags field: LLLLLLFT, L = label (24 bits), F = flags (4 bits), T = type (4 bits) */
-#define DUK_CAT_TYPE_MASK 0x0000000fUL
-#define DUK_CAT_TYPE_BITS 4
-#define DUK_CAT_LABEL_MASK 0xffffff00UL
-#define DUK_CAT_LABEL_BITS 24
-#define DUK_CAT_LABEL_SHIFT 8
-
-#define DUK_CAT_FLAG_CATCH_ENABLED (1 << 4) /* catch part will catch */
-#define DUK_CAT_FLAG_FINALLY_ENABLED (1 << 5) /* finally part will catch */
-#define DUK_CAT_FLAG_CATCH_BINDING_ENABLED (1 << 6) /* request to create catch binding */
-#define DUK_CAT_FLAG_LEXENV_ACTIVE (1 << 7) /* catch or with binding is currently active */
-
-#define DUK_CAT_TYPE_UNKNOWN 0
-#define DUK_CAT_TYPE_TCF 1
-#define DUK_CAT_TYPE_LABEL 2
-
-#define DUK_CAT_GET_TYPE(c) ((c)->flags & DUK_CAT_TYPE_MASK)
-#define DUK_CAT_GET_LABEL(c) (((c)->flags & DUK_CAT_LABEL_MASK) >> DUK_CAT_LABEL_SHIFT)
-
-#define DUK_CAT_HAS_CATCH_ENABLED(c) ((c)->flags & DUK_CAT_FLAG_CATCH_ENABLED)
-#define DUK_CAT_HAS_FINALLY_ENABLED(c) ((c)->flags & DUK_CAT_FLAG_FINALLY_ENABLED)
-#define DUK_CAT_HAS_CATCH_BINDING_ENABLED(c) ((c)->flags & DUK_CAT_FLAG_CATCH_BINDING_ENABLED)
-#define DUK_CAT_HAS_LEXENV_ACTIVE(c) ((c)->flags & DUK_CAT_FLAG_LEXENV_ACTIVE)
-
-#define DUK_CAT_SET_CATCH_ENABLED(c) do { \
- (c)->flags |= DUK_CAT_FLAG_CATCH_ENABLED; \
- } while (0)
-#define DUK_CAT_SET_FINALLY_ENABLED(c) do { \
- (c)->flags |= DUK_CAT_FLAG_FINALLY_ENABLED; \
- } while (0)
-#define DUK_CAT_SET_CATCH_BINDING_ENABLED(c) do { \
- (c)->flags |= DUK_CAT_FLAG_CATCH_BINDING_ENABLED; \
- } while (0)
-#define DUK_CAT_SET_LEXENV_ACTIVE(c) do { \
- (c)->flags |= DUK_CAT_FLAG_LEXENV_ACTIVE; \
- } while (0)
-
-#define DUK_CAT_CLEAR_CATCH_ENABLED(c) do { \
- (c)->flags &= ~DUK_CAT_FLAG_CATCH_ENABLED; \
- } while (0)
-#define DUK_CAT_CLEAR_FINALLY_ENABLED(c) do { \
- (c)->flags &= ~DUK_CAT_FLAG_FINALLY_ENABLED; \
- } while (0)
-#define DUK_CAT_CLEAR_CATCH_BINDING_ENABLED(c) do { \
- (c)->flags &= ~DUK_CAT_FLAG_CATCH_BINDING_ENABLED; \
- } while (0)
-#define DUK_CAT_CLEAR_LEXENV_ACTIVE(c) do { \
- (c)->flags &= ~DUK_CAT_FLAG_LEXENV_ACTIVE; \
- } while (0)
-
-/*
- * Thread defines
- */
-
-#if defined(DUK_USE_ROM_STRINGS)
-#define DUK_HTHREAD_GET_STRING(thr,idx) \
- ((duk_hstring *) DUK_LOSE_CONST(duk_rom_strings_stridx[(idx)]))
-#else /* DUK_USE_ROM_STRINGS */
-#if defined(DUK_USE_HEAPPTR16)
-#define DUK_HTHREAD_GET_STRING(thr,idx) \
- ((duk_hstring *) DUK_USE_HEAPPTR_DEC16((thr)->heap->heap_udata, (thr)->strs16[(idx)]))
-#else
-#define DUK_HTHREAD_GET_STRING(thr,idx) \
- ((thr)->strs[(idx)])
-#endif
-#endif /* DUK_USE_ROM_STRINGS */
-
-#define DUK_HTHREAD_GET_CURRENT_ACTIVATION(thr) (&(thr)->callstack[(thr)->callstack_top - 1])
-
-/* values for the state field */
-#define DUK_HTHREAD_STATE_INACTIVE 1 /* thread not currently running */
-#define DUK_HTHREAD_STATE_RUNNING 2 /* thread currently running (only one at a time) */
-#define DUK_HTHREAD_STATE_RESUMED 3 /* thread resumed another thread (active but not running) */
-#define DUK_HTHREAD_STATE_YIELDED 4 /* thread has yielded */
-#define DUK_HTHREAD_STATE_TERMINATED 5 /* thread has terminated */
-
-/* Executor interrupt default interval when nothing else requires a
- * smaller value. The default interval must be small enough to allow
- * for reasonable execution timeout checking but large enough to keep
- * impact on execution performance low.
- */
-#if defined(DUK_USE_INTERRUPT_COUNTER)
-#define DUK_HTHREAD_INTCTR_DEFAULT (256L * 1024L)
-#endif
-
-/*
- * Assert context is valid: non-NULL pointer, fields look sane.
- *
- * This is used by public API call entrypoints to catch invalid 'ctx' pointers
- * as early as possible; invalid 'ctx' pointers cause very odd and difficult to
- * diagnose behavior so it's worth checking even when the check is not 100%.
- */
-
-#if defined(DUK_USE_PREFER_SIZE)
-#define DUK_ASSERT_CTX_VSSIZE(ctx) /*nop*/
-#else
-#define DUK_ASSERT_CTX_VSSIZE(ctx) \
- DUK_ASSERT((duk_size_t) (((duk_hthread *) (ctx))->valstack_end - ((duk_hthread *) (ctx))->valstack) == \
- ((duk_hthread *) (ctx))->valstack_size)
-#endif
-#define DUK_ASSERT_CTX_VALID(ctx) do { \
- DUK_ASSERT((ctx) != NULL); \
- DUK_ASSERT(DUK_HEAPHDR_GET_TYPE((duk_heaphdr *) (ctx)) == DUK_HTYPE_OBJECT); \
- DUK_ASSERT(DUK_HOBJECT_IS_THREAD((duk_hobject *) (ctx))); \
- DUK_ASSERT(((duk_hthread *) (ctx))->unused1 == 0); \
- DUK_ASSERT(((duk_hthread *) (ctx))->unused2 == 0); \
- DUK_ASSERT(((duk_hthread *) (ctx))->valstack != NULL); \
- DUK_ASSERT(((duk_hthread *) (ctx))->valstack_end >= ((duk_hthread *) (ctx))->valstack); \
- DUK_ASSERT(((duk_hthread *) (ctx))->valstack_top >= ((duk_hthread *) (ctx))->valstack); \
- DUK_ASSERT(((duk_hthread *) (ctx))->valstack_top >= ((duk_hthread *) (ctx))->valstack_bottom); \
- DUK_ASSERT(((duk_hthread *) (ctx))->valstack_end >= ((duk_hthread *) (ctx))->valstack_top); \
- DUK_ASSERT_CTX_VSSIZE((ctx)); \
- } while (0)
-
-/*
- * Struct defines
- */
-
-/* XXX: for a memory-code tradeoff, remove 'func' and make it's access either a function
- * or a macro. This would make the activation 32 bytes long on 32-bit platforms again.
- */
-
-/* Note: it's nice if size is 2^N (at least for 32-bit platforms). */
-struct duk_activation {
- duk_tval tv_func; /* borrowed: full duk_tval for function being executed; for lightfuncs */
- duk_hobject *func; /* borrowed: function being executed; for bound function calls, this is the final, real function, NULL for lightfuncs */
- duk_hobject *var_env; /* current variable environment (may be NULL if delayed) */
- duk_hobject *lex_env; /* current lexical environment (may be NULL if delayed) */
-#ifdef DUK_USE_NONSTD_FUNC_CALLER_PROPERTY
- /* Previous value of 'func' caller, restored when unwound. Only in use
- * when 'func' is non-strict.
- */
- duk_hobject *prev_caller;
-#endif
-
- duk_instr_t *curr_pc; /* next instruction to execute (points to 'func' bytecode, stable pointer), NULL for native calls */
-#if defined(DUK_USE_DEBUGGER_SUPPORT)
- duk_uint32_t prev_line; /* needed for stepping */
-#endif
- duk_small_uint_t flags;
-
- /* idx_bottom and idx_retval are only used for book-keeping of
- * Ecmascript-initiated calls, to allow returning to an Ecmascript
- * function properly. They are duk_size_t to match the convention
- * that value stack sizes are duk_size_t and local frame indices
- * are duk_idx_t.
- */
-
- /* Bottom of valstack for this activation, used to reset
- * valstack_bottom on return; index is absolute. Note:
- * idx_top not needed because top is set to 'nregs' always
- * when returning to an Ecmascript activation.
- */
- duk_size_t idx_bottom;
-
- /* Return value when returning to this activation (points to caller
- * reg, not callee reg); index is absolute (only set if activation is
- * not topmost).
- *
- * Note: idx_bottom is always set, while idx_retval is only applicable
- * for activations below the topmost one. Currently idx_retval for
- * the topmost activation is considered garbage (and it not initialized
- * on entry or cleared on return; may contain previous or garbage
- * values).
- */
- duk_size_t idx_retval;
-
- /* Current 'this' binding is the value just below idx_bottom.
- * Previously, 'this' binding was handled with an index to the
- * (calling) valstack. This works for everything except tail
- * calls, which must not "cumulate" valstack temps.
- */
-};
-
-/* Note: it's nice if size is 2^N (not 4x4 = 16 bytes on 32 bit) */
-struct duk_catcher {
- duk_hstring *h_varname; /* borrowed reference to catch variable name (or NULL if none) */
- /* (reference is valid as long activation exists) */
- duk_instr_t *pc_base; /* resume execution from pc_base or pc_base+1 (points to 'func' bytecode, stable pointer) */
- duk_size_t callstack_index; /* callstack index of related activation */
- duk_size_t idx_base; /* idx_base and idx_base+1 get completion value and type */
- duk_uint32_t flags; /* type and control flags, label number */
-};
-
-struct duk_hthread {
- /* Shared object part */
- duk_hobject obj;
-
- /* Pointer to bytecode executor's 'curr_pc' variable. Used to copy
- * the current PC back into the topmost activation when activation
- * state is about to change (or "syncing" is otherwise needed). This
- * is rather awkward but important for performance, see execution.rst.
- */
- duk_instr_t **ptr_curr_pc;
-
- /* Backpointers. */
- duk_heap *heap;
-
- /* Current strictness flag: affects API calls. */
- duk_uint8_t strict;
-
- /* Thread state. */
- duk_uint8_t state;
- duk_uint8_t unused1;
- duk_uint8_t unused2;
-
- /* Sanity limits for stack sizes. */
- duk_size_t valstack_max;
- duk_size_t callstack_max;
- duk_size_t catchstack_max;
-
- /* XXX: Valstack, callstack, and catchstack are currently assumed
- * to have non-NULL pointers. Relaxing this would not lead to big
- * benefits (except perhaps for terminated threads).
- */
-
- /* Value stack: these are expressed as pointers for faster stack manipulation.
- * [valstack,valstack_top[ is GC-reachable, [valstack_top,valstack_end[ is
- * not GC-reachable but kept initialized as 'undefined'.
- */
- duk_tval *valstack; /* start of valstack allocation */
- duk_tval *valstack_end; /* end of valstack allocation (exclusive) */
- duk_tval *valstack_bottom; /* bottom of current frame */
- duk_tval *valstack_top; /* top of current frame (exclusive) */
-#if !defined(DUK_USE_PREFER_SIZE)
- duk_size_t valstack_size; /* cached: valstack_end - valstack (in entries, not bytes) */
-#endif
-
- /* Call stack. [0,callstack_top[ is GC reachable. */
- duk_activation *callstack;
- duk_size_t callstack_size; /* allocation size */
- duk_size_t callstack_top; /* next to use, highest used is top - 1 */
- duk_size_t callstack_preventcount; /* number of activation records in callstack preventing a yield */
-
- /* Catch stack. [0,catchstack_top[ is GC reachable. */
- duk_catcher *catchstack;
- duk_size_t catchstack_size; /* allocation size */
- duk_size_t catchstack_top; /* next to use, highest used is top - 1 */
-
- /* Yield/resume book-keeping. */
- duk_hthread *resumer; /* who resumed us (if any) */
-
- /* Current compiler state (if any), used for augmenting SyntaxErrors. */
- duk_compiler_ctx *compile_ctx;
-
-#if defined(DUK_USE_INTERRUPT_COUNTER)
- /* Interrupt counter for triggering a slow path check for execution
- * timeout, debugger interaction such as breakpoints, etc. The value
- * is valid for the current running thread, and both the init and
- * counter values are copied whenever a thread switch occurs. It's
- * important for the counter to be conveniently accessible for the
- * bytecode executor inner loop for performance reasons.
- */
- duk_int_t interrupt_counter; /* countdown state */
- duk_int_t interrupt_init; /* start value for current countdown */
-#endif
-
- /* Builtin-objects; may or may not be shared with other threads,
- * threads existing in different "compartments" will have different
- * built-ins. Must be stored on a per-thread basis because there
- * is no intermediate structure for a thread group / compartment.
- * This takes quite a lot of space, currently 43x4 = 172 bytes on
- * 32-bit platforms.
- *
- * In some cases the builtins array could be ROM based, but it's
- * sometimes edited (e.g. for sandboxing) so it's better to keep
- * this array in RAM.
- */
- duk_hobject *builtins[DUK_NUM_BUILTINS];
-
- /* Convenience copies from heap/vm for faster access. */
-#if defined(DUK_USE_ROM_STRINGS)
- /* No field needed when strings are in ROM. */
-#else
-#if defined(DUK_USE_HEAPPTR16)
- duk_uint16_t *strs16;
-#else
- duk_hstring **strs;
-#endif
-#endif
-};
-
-/*
- * Prototypes
- */
-
-DUK_INTERNAL_DECL void duk_hthread_copy_builtin_objects(duk_hthread *thr_from, duk_hthread *thr_to);
-DUK_INTERNAL_DECL void duk_hthread_create_builtin_objects(duk_hthread *thr);
-DUK_INTERNAL_DECL duk_bool_t duk_hthread_init_stacks(duk_heap *heap, duk_hthread *thr);
-DUK_INTERNAL_DECL void duk_hthread_terminate(duk_hthread *thr);
-
-DUK_INTERNAL_DECL void duk_hthread_callstack_grow(duk_hthread *thr);
-DUK_INTERNAL_DECL void duk_hthread_callstack_shrink_check(duk_hthread *thr);
-DUK_INTERNAL_DECL void duk_hthread_callstack_unwind(duk_hthread *thr, duk_size_t new_top);
-DUK_INTERNAL_DECL void duk_hthread_catchstack_grow(duk_hthread *thr);
-DUK_INTERNAL_DECL void duk_hthread_catchstack_shrink_check(duk_hthread *thr);
-DUK_INTERNAL_DECL void duk_hthread_catchstack_unwind(duk_hthread *thr, duk_size_t new_top);
-
-DUK_INTERNAL_DECL duk_activation *duk_hthread_get_current_activation(duk_hthread *thr);
-DUK_INTERNAL_DECL void *duk_hthread_get_valstack_ptr(duk_heap *heap, void *ud); /* indirect allocs */
-DUK_INTERNAL_DECL void *duk_hthread_get_callstack_ptr(duk_heap *heap, void *ud); /* indirect allocs */
-DUK_INTERNAL_DECL void *duk_hthread_get_catchstack_ptr(duk_heap *heap, void *ud); /* indirect allocs */
-
-#if defined(DUK_USE_DEBUGGER_SUPPORT)
-DUK_INTERNAL_DECL duk_uint_fast32_t duk_hthread_get_act_curr_pc(duk_hthread *thr, duk_activation *act);
-#endif
-DUK_INTERNAL_DECL duk_uint_fast32_t duk_hthread_get_act_prev_pc(duk_hthread *thr, duk_activation *act);
-DUK_INTERNAL_DECL void duk_hthread_sync_currpc(duk_hthread *thr);
-DUK_INTERNAL_DECL void duk_hthread_sync_and_null_currpc(duk_hthread *thr);
-
-#endif /* DUK_HTHREAD_H_INCLUDED */
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/ede68a10/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hthread_alloc.c
----------------------------------------------------------------------
diff --git a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hthread_alloc.c b/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hthread_alloc.c
deleted file mode 100644
index 32857ef..0000000
--- a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hthread_alloc.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * duk_hthread allocation and freeing.
- */
-
-#include "duk_internal.h"
-
-/*
- * Allocate initial stacks for a thread. Note that 'thr' must be reachable
- * as a garbage collection may be triggered by the allocation attempts.
- * Returns zero (without leaking memory) if init fails.
- */
-
-DUK_INTERNAL duk_bool_t duk_hthread_init_stacks(duk_heap *heap, duk_hthread *thr) {
- duk_size_t alloc_size;
- duk_size_t i;
-
- DUK_ASSERT(heap != NULL);
- DUK_ASSERT(thr != NULL);
- DUK_ASSERT(thr->valstack == NULL);
- DUK_ASSERT(thr->valstack_end == NULL);
- DUK_ASSERT(thr->valstack_bottom == NULL);
- DUK_ASSERT(thr->valstack_top == NULL);
- DUK_ASSERT(thr->callstack == NULL);
- DUK_ASSERT(thr->catchstack == NULL);
-
- /* valstack */
- alloc_size = sizeof(duk_tval) * DUK_VALSTACK_INITIAL_SIZE;
- thr->valstack = (duk_tval *) DUK_ALLOC(heap, alloc_size);
- if (!thr->valstack) {
- goto fail;
- }
- DUK_MEMZERO(thr->valstack, alloc_size);
- thr->valstack_end = thr->valstack + DUK_VALSTACK_INITIAL_SIZE;
-#if !defined(DUK_USE_PREFER_SIZE)
- thr->valstack_size = DUK_VALSTACK_INITIAL_SIZE;
-#endif
- thr->valstack_bottom = thr->valstack;
- thr->valstack_top = thr->valstack;
-
- for (i = 0; i < DUK_VALSTACK_INITIAL_SIZE; i++) {
- DUK_TVAL_SET_UNDEFINED(&thr->valstack[i]);
- }
-
- /* callstack */
- alloc_size = sizeof(duk_activation) * DUK_CALLSTACK_INITIAL_SIZE;
- thr->callstack = (duk_activation *) DUK_ALLOC(heap, alloc_size);
- if (!thr->callstack) {
- goto fail;
- }
- DUK_MEMZERO(thr->callstack, alloc_size);
- thr->callstack_size = DUK_CALLSTACK_INITIAL_SIZE;
- DUK_ASSERT(thr->callstack_top == 0);
-
- /* catchstack */
- alloc_size = sizeof(duk_catcher) * DUK_CATCHSTACK_INITIAL_SIZE;
- thr->catchstack = (duk_catcher *) DUK_ALLOC(heap, alloc_size);
- if (!thr->catchstack) {
- goto fail;
- }
- DUK_MEMZERO(thr->catchstack, alloc_size);
- thr->catchstack_size = DUK_CATCHSTACK_INITIAL_SIZE;
- DUK_ASSERT(thr->catchstack_top == 0);
-
- return 1;
-
- fail:
- DUK_FREE(heap, thr->valstack);
- DUK_FREE(heap, thr->callstack);
- DUK_FREE(heap, thr->catchstack);
-
- thr->valstack = NULL;
- thr->callstack = NULL;
- thr->catchstack = NULL;
- return 0;
-}
-
-/* For indirect allocs. */
-
-DUK_INTERNAL void *duk_hthread_get_valstack_ptr(duk_heap *heap, void *ud) {
- duk_hthread *thr = (duk_hthread *) ud;
- DUK_UNREF(heap);
- return (void *) thr->valstack;
-}
-
-DUK_INTERNAL void *duk_hthread_get_callstack_ptr(duk_heap *heap, void *ud) {
- duk_hthread *thr = (duk_hthread *) ud;
- DUK_UNREF(heap);
- return (void *) thr->callstack;
-}
-
-DUK_INTERNAL void *duk_hthread_get_catchstack_ptr(duk_heap *heap, void *ud) {
- duk_hthread *thr = (duk_hthread *) ud;
- DUK_UNREF(heap);
- return (void *) thr->catchstack;
-}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/ede68a10/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hthread_builtins.c
----------------------------------------------------------------------
diff --git a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hthread_builtins.c b/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hthread_builtins.c
deleted file mode 100644
index e8d57d8..0000000
--- a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hthread_builtins.c
+++ /dev/null
@@ -1,836 +0,0 @@
-/*
- * Initialize built-in objects. Current thread must have a valstack
- * and initialization errors may longjmp, so a setjmp() catch point
- * must exist.
- */
-
-#include "duk_internal.h"
-
-/*
- * Encoding constants, must match genbuiltins.py
- */
-
-#define DUK__CLASS_BITS 5
-#define DUK__BIDX_BITS 7
-#define DUK__STRIDX_BITS 9 /* XXX: try to optimize to 8 (would now be possible, <200 used) */
-#define DUK__NATIDX_BITS 8
-#define DUK__NUM_NORMAL_PROPS_BITS 6
-#define DUK__NUM_FUNC_PROPS_BITS 6
-#define DUK__PROP_FLAGS_BITS 3
-#define DUK__STRING_LENGTH_BITS 8
-#define DUK__STRING_CHAR_BITS 7
-#define DUK__LENGTH_PROP_BITS 3
-#define DUK__NARGS_BITS 3
-#define DUK__PROP_TYPE_BITS 3
-#define DUK__MAGIC_BITS 16
-
-#define DUK__NARGS_VARARGS_MARKER 0x07
-#define DUK__NO_CLASS_MARKER 0x00 /* 0 = DUK_HOBJECT_CLASS_UNUSED */
-#define DUK__NO_BIDX_MARKER 0x7f
-#define DUK__NO_STRIDX_MARKER 0xff
-
-#define DUK__PROP_TYPE_DOUBLE 0
-#define DUK__PROP_TYPE_STRING 1
-#define DUK__PROP_TYPE_STRIDX 2
-#define DUK__PROP_TYPE_BUILTIN 3
-#define DUK__PROP_TYPE_UNDEFINED 4
-#define DUK__PROP_TYPE_BOOLEAN_TRUE 5
-#define DUK__PROP_TYPE_BOOLEAN_FALSE 6
-#define DUK__PROP_TYPE_ACCESSOR 7
-
-/*
- * Create built-in objects by parsing an init bitstream generated
- * by genbuiltins.py.
- */
-
-#if defined(DUK_USE_ROM_OBJECTS)
-#if defined(DUK_USE_ROM_GLOBAL_CLONE) || defined(DUK_USE_ROM_GLOBAL_INHERIT)
-DUK_LOCAL void duk__duplicate_ram_global_object(duk_hthread *thr) {
- duk_context *ctx;
- duk_hobject *h1;
-#if defined(DUK_USE_ROM_GLOBAL_CLONE)
- duk_hobject *h2;
- duk_uint8_t *props;
- duk_size_t alloc_size;
-#endif
-
- ctx = (duk_context *) thr;
-
- /* XXX: refactor into internal helper, duk_clone_hobject() */
-
-#if defined(DUK_USE_ROM_GLOBAL_INHERIT)
- /* Inherit from ROM-based global object: less RAM usage, less transparent. */
- duk_push_object_helper(ctx,
- DUK_HOBJECT_FLAG_EXTENSIBLE |
- DUK_HOBJECT_CLASS_AS_FLAGS(DUK_HOBJECT_CLASS_GLOBAL),
- DUK_BIDX_GLOBAL);
- h1 = duk_get_hobject(ctx, -1);
- DUK_ASSERT(h1 != NULL);
-#elif defined(DUK_USE_ROM_GLOBAL_CLONE)
- /* Clone the properties of the ROM-based global object to create a
- * fully RAM-based global object. Uses more memory than the inherit
- * model but more compliant.
- */
- duk_push_object_helper(ctx,
- DUK_HOBJECT_FLAG_EXTENSIBLE |
- DUK_HOBJECT_CLASS_AS_FLAGS(DUK_HOBJECT_CLASS_GLOBAL),
- DUK_BIDX_OBJECT_PROTOTYPE);
- h1 = duk_get_hobject(ctx, -1);
- DUK_ASSERT(h1 != NULL);
- h2 = thr->builtins[DUK_BIDX_GLOBAL];
- DUK_ASSERT(h2 != NULL);
-
- /* Copy the property table verbatim; this handles attributes etc.
- * For ROM objects it's not necessary (or possible) to update
- * refcounts so leave them as is.
- */
- alloc_size = DUK_HOBJECT_P_ALLOC_SIZE(h2);
- DUK_ASSERT(alloc_size > 0);
- props = DUK_ALLOC(thr->heap, alloc_size);
- if (!props) {
- DUK_ERROR_ALLOC_DEFMSG(thr);
- return;
- }
- DUK_ASSERT(DUK_HOBJECT_GET_PROPS(thr->heap, h2) != NULL);
- DUK_MEMCPY((void *) props, (const void *) DUK_HOBJECT_GET_PROPS(thr->heap, h2), alloc_size);
-
- /* XXX: keep property attributes or tweak them here?
- * Properties will now be non-configurable even when they're
- * normally configurable for the global object.
- */
-
- DUK_ASSERT(DUK_HOBJECT_GET_PROPS(thr->heap, h1) == NULL);
- DUK_HOBJECT_SET_PROPS(thr->heap, h1, props);
- DUK_HOBJECT_SET_ESIZE(h1, DUK_HOBJECT_GET_ESIZE(h2));
- DUK_HOBJECT_SET_ENEXT(h1, DUK_HOBJECT_GET_ENEXT(h2));
- DUK_HOBJECT_SET_ASIZE(h1, DUK_HOBJECT_GET_ASIZE(h2));
- DUK_HOBJECT_SET_HSIZE(h1, DUK_HOBJECT_GET_HSIZE(h2));
-#else
-#error internal error in defines
-#endif
-
- duk_hobject_compact_props(thr, h1);
- DUK_ASSERT(thr->builtins[DUK_BIDX_GLOBAL] != NULL);
- DUK_ASSERT(!DUK_HEAPHDR_NEEDS_REFCOUNT_UPDATE((duk_heaphdr *) thr->builtins[DUK_BIDX_GLOBAL])); /* no need to decref */
- thr->builtins[DUK_BIDX_GLOBAL] = h1;
- DUK_HOBJECT_INCREF(thr, h1);
- DUK_D(DUK_DPRINT("duplicated global object: %!O", h1));
-
-
- /* Create a fresh object environment for the global scope. This is
- * needed so that the global scope points to the newly created RAM-based
- * global object.
- */
- duk_push_object_helper(ctx,
- DUK_HOBJECT_FLAG_EXTENSIBLE |
- DUK_HOBJECT_CLASS_AS_FLAGS(DUK_HOBJECT_CLASS_OBJENV),
- -1); /* no prototype */
- h1 = duk_get_hobject(ctx, -1);
- DUK_ASSERT(h1 != NULL);
- duk_dup(ctx, -2);
- duk_dup(ctx, -1); /* -> [ ... new_global new_globalenv new_global new_global ] */
- duk_xdef_prop_stridx(thr, -3, DUK_STRIDX_INT_TARGET, DUK_PROPDESC_FLAGS_NONE);
- duk_xdef_prop_stridx(thr, -2, DUK_STRIDX_INT_THIS, DUK_PROPDESC_FLAGS_NONE); /* always provideThis=true */
-
- duk_hobject_compact_props(thr, h1);
- DUK_ASSERT(thr->builtins[DUK_BIDX_GLOBAL_ENV] != NULL);
- DUK_ASSERT(!DUK_HEAPHDR_NEEDS_REFCOUNT_UPDATE((duk_heaphdr *) thr->builtins[DUK_BIDX_GLOBAL_ENV])); /* no need to decref */
- thr->builtins[DUK_BIDX_GLOBAL_ENV] = h1;
- DUK_HOBJECT_INCREF(thr, h1);
- DUK_D(DUK_DPRINT("duplicated global env: %!O", h1));
-
- duk_pop_2(ctx);
-}
-#endif /* DUK_USE_ROM_GLOBAL_CLONE || DUK_USE_ROM_GLOBAL_INHERIT */
-
-DUK_INTERNAL void duk_hthread_create_builtin_objects(duk_hthread *thr) {
- /* Setup builtins from ROM objects. All heaps/threads will share
- * the same readonly objects.
- */
- duk_small_uint_t i;
-
- for (i = 0; i < DUK_NUM_BUILTINS; i++) {
- duk_hobject *h;
- h = (duk_hobject *) DUK_LOSE_CONST(duk_rom_builtins_bidx[i]);
- DUK_ASSERT(h != NULL);
- thr->builtins[i] = h;
- }
-
-#if defined(DUK_USE_ROM_GLOBAL_CLONE) || defined(DUK_USE_ROM_GLOBAL_INHERIT)
- /* By default the global object is read-only which is often much
- * more of an issue than having read-only built-in objects (like
- * RegExp, Date, etc). Use a RAM-based copy of the global object
- * and the global environment object for convenience.
- */
- duk__duplicate_ram_global_object(thr);
-#endif
-}
-#else /* DUK_USE_ROM_OBJECTS */
-DUK_LOCAL void duk__push_stridx(duk_context *ctx, duk_bitdecoder_ctx *bd) {
- duk_small_uint_t n;
-
- n = (duk_small_uint_t) duk_bd_decode(bd, DUK__STRIDX_BITS);
- DUK_ASSERT_DISABLE(n >= 0); /* unsigned */
- DUK_ASSERT(n < DUK_HEAP_NUM_STRINGS);
- duk_push_hstring_stridx(ctx, n);
-}
-DUK_LOCAL void duk__push_string(duk_context *ctx, duk_bitdecoder_ctx *bd) {
- duk_small_uint_t n;
- duk_small_uint_t i;
- duk_uint8_t *p;
-
- n = (duk_small_uint_t) duk_bd_decode(bd, DUK__STRING_LENGTH_BITS);
- p = (duk_uint8_t *) duk_push_fixed_buffer(ctx, n);
- for (i = 0; i < n; i++) {
- *p++ = (duk_uint8_t) duk_bd_decode(bd, DUK__STRING_CHAR_BITS);
- }
- duk_to_string(ctx, -1);
-}
-DUK_LOCAL void duk__push_stridx_or_string(duk_context *ctx, duk_bitdecoder_ctx *bd) {
- if (duk_bd_decode_flag(bd)) {
- duk__push_string(ctx, bd);
- } else {
- duk__push_stridx(ctx, bd);
- }
-}
-DUK_LOCAL void duk__push_double(duk_context *ctx, duk_bitdecoder_ctx *bd) {
- duk_double_union du;
- duk_small_uint_t i;
-
- for (i = 0; i < 8; i++) {
- /* Encoding endianness must match target memory layout,
- * build scripts and genbuiltins.py must ensure this.
- */
- du.uc[i] = (duk_uint8_t) duk_bd_decode(bd, 8);
- }
-
- duk_push_number(ctx, du.d); /* push operation normalizes NaNs */
-}
-
-DUK_INTERNAL void duk_hthread_create_builtin_objects(duk_hthread *thr) {
- duk_context *ctx = (duk_context *) thr;
- duk_bitdecoder_ctx bd_ctx;
- duk_bitdecoder_ctx *bd = &bd_ctx; /* convenience */
- duk_hobject *h;
- duk_small_uint_t i, j;
-
- DUK_D(DUK_DPRINT("INITBUILTINS BEGIN: DUK_NUM_BUILTINS=%d, DUK_NUM_BUILTINS_ALL=%d", (int) DUK_NUM_BUILTINS, (int) DUK_NUM_ALL_BUILTINS));
-
- DUK_MEMZERO(&bd_ctx, sizeof(bd_ctx));
- bd->data = (const duk_uint8_t *) duk_builtins_data;
- bd->length = (duk_size_t) DUK_BUILTINS_DATA_LENGTH;
-
- /*
- * First create all built-in bare objects on the empty valstack.
- *
- * Built-ins in the index range [0,DUK_NUM_BUILTINS-1] have value
- * stack indices matching their eventual thr->builtins[] index.
- *
- * Built-ins in the index range [DUK_NUM_BUILTINS,DUK_NUM_ALL_BUILTINS]
- * will exist on the value stack during init but won't be placed
- * into thr->builtins[]. These are objects referenced in some way
- * from thr->builtins[] roots but which don't need to be indexed by
- * Duktape through thr->builtins[] (e.g. user custom objects).
- */
-
- duk_require_stack(ctx, DUK_NUM_ALL_BUILTINS);
-
- DUK_DD(DUK_DDPRINT("create empty built-ins"));
- DUK_ASSERT_TOP(ctx, 0);
- for (i = 0; i < DUK_NUM_ALL_BUILTINS; i++) {
- duk_small_uint_t class_num;
- duk_small_int_t len = -1; /* must be signed */
-
- class_num = (duk_small_uint_t) duk_bd_decode(bd, DUK__CLASS_BITS);
- len = (duk_small_int_t) duk_bd_decode_flagged(bd, DUK__LENGTH_PROP_BITS, (duk_int32_t) -1 /*def_value*/);
-
- if (class_num == DUK_HOBJECT_CLASS_FUNCTION) {
- duk_small_uint_t natidx;
- duk_int_t c_nargs; /* must hold DUK_VARARGS */
- duk_c_function c_func;
- duk_int16_t magic;
-
- DUK_DDD(DUK_DDDPRINT("len=%ld", (long) len));
- DUK_ASSERT(len >= 0);
-
- natidx = (duk_small_uint_t) duk_bd_decode(bd, DUK__NATIDX_BITS);
- c_func = duk_bi_native_functions[natidx];
-
- c_nargs = (duk_small_uint_t) duk_bd_decode_flagged(bd, DUK__NARGS_BITS, len /*def_value*/);
- if (c_nargs == DUK__NARGS_VARARGS_MARKER) {
- c_nargs = DUK_VARARGS;
- }
-
- /* XXX: set magic directly here? (it could share the c_nargs arg) */
- duk_push_c_function_noexotic(ctx, c_func, c_nargs);
-
- h = duk_require_hobject(ctx, -1);
- DUK_ASSERT(h != NULL);
-
- /* Currently all built-in native functions are strict.
- * duk_push_c_function() now sets strict flag, so
- * assert for it.
- */
- DUK_ASSERT(DUK_HOBJECT_HAS_STRICT(h));
-
- /* XXX: function properties */
-
- /* Built-in 'name' is not writable by default. Function '.name'
- * is writable to allow user code to set a '.name' on a native
- * function.
- */
- duk__push_stridx_or_string(ctx, bd);
- duk_xdef_prop_stridx(ctx,
- -2,
- DUK_STRIDX_NAME,
- (i == DUK_BIDX_FUNCTION_PROTOTYPE) ?
- DUK_PROPDESC_FLAGS_W : DUK_PROPDESC_FLAGS_NONE);
-
- /* Almost all global level Function objects are constructable
- * but not all: Function.prototype is a non-constructable,
- * callable Function.
- */
- if (duk_bd_decode_flag(bd)) {
- DUK_ASSERT(DUK_HOBJECT_HAS_CONSTRUCTABLE(h));
- } else {
- DUK_HOBJECT_CLEAR_CONSTRUCTABLE(h);
- }
-
- /* Cast converts magic to 16-bit signed value */
- magic = (duk_int16_t) duk_bd_decode_flagged(bd, DUK__MAGIC_BITS, 0 /*def_value*/);
- ((duk_hnativefunction *) h)->magic = magic;
- } else {
- /* XXX: ARRAY_PART for Array prototype? */
-
- duk_push_object_helper(ctx,
- DUK_HOBJECT_FLAG_EXTENSIBLE,
- -1); /* no prototype or class yet */
-
- h = duk_require_hobject(ctx, -1);
- DUK_ASSERT(h != NULL);
- }
-
- DUK_HOBJECT_SET_CLASS_NUMBER(h, class_num);
-
- if (i < DUK_NUM_BUILTINS) {
- thr->builtins[i] = h;
- DUK_HOBJECT_INCREF(thr, &h->hdr);
- }
-
- if (len >= 0) {
- /*
- * For top-level objects, 'length' property has the following
- * default attributes: non-writable, non-enumerable, non-configurable
- * (E5 Section 15).
- *
- * However, 'length' property for Array.prototype has attributes
- * expected of an Array instance which are different: writable,
- * non-enumerable, non-configurable (E5 Section 15.4.5.2).
- *
- * This is currently determined implicitly based on class; there are
- * no attribute flags in the init data.
- */
-
- duk_push_int(ctx, len);
- duk_xdef_prop_stridx(ctx,
- -2,
- DUK_STRIDX_LENGTH,
- (class_num == DUK_HOBJECT_CLASS_ARRAY ? /* only Array.prototype matches */
- DUK_PROPDESC_FLAGS_W : DUK_PROPDESC_FLAGS_NONE));
- }
-
- /* enable exotic behaviors last */
-
- if (class_num == DUK_HOBJECT_CLASS_ARRAY) {
- DUK_HOBJECT_SET_EXOTIC_ARRAY(h);
- }
- if (class_num == DUK_HOBJECT_CLASS_STRING) {
- DUK_HOBJECT_SET_EXOTIC_STRINGOBJ(h);
- }
-
- /* some assertions */
-
- DUK_ASSERT(DUK_HOBJECT_HAS_EXTENSIBLE(h));
- /* DUK_HOBJECT_FLAG_CONSTRUCTABLE varies */
- DUK_ASSERT(!DUK_HOBJECT_HAS_BOUND(h));
- DUK_ASSERT(!DUK_HOBJECT_HAS_COMPILEDFUNCTION(h));
- /* DUK_HOBJECT_FLAG_NATIVEFUNCTION varies */
- DUK_ASSERT(!DUK_HOBJECT_HAS_THREAD(h));
- DUK_ASSERT(!DUK_HOBJECT_HAS_ARRAY_PART(h)); /* currently, even for Array.prototype */
- /* DUK_HOBJECT_FLAG_STRICT varies */
- DUK_ASSERT(!DUK_HOBJECT_HAS_NATIVEFUNCTION(h) || /* all native functions have NEWENV */
- DUK_HOBJECT_HAS_NEWENV(h));
- DUK_ASSERT(!DUK_HOBJECT_HAS_NAMEBINDING(h));
- DUK_ASSERT(!DUK_HOBJECT_HAS_CREATEARGS(h));
- DUK_ASSERT(!DUK_HOBJECT_HAS_ENVRECCLOSED(h));
- /* DUK_HOBJECT_FLAG_EXOTIC_ARRAY varies */
- /* DUK_HOBJECT_FLAG_EXOTIC_STRINGOBJ varies */
- DUK_ASSERT(!DUK_HOBJECT_HAS_EXOTIC_ARGUMENTS(h));
-
- DUK_DDD(DUK_DDDPRINT("created built-in %ld, class=%ld, length=%ld", (long) i, (long) class_num, (long) len));
- }
-
- /*
- * Then decode the builtins init data (see genbuiltins.py) to
- * init objects
- */
-
- DUK_DD(DUK_DDPRINT("initialize built-in object properties"));
- for (i = 0; i < DUK_NUM_ALL_BUILTINS; i++) {
- duk_small_uint_t t;
- duk_small_uint_t num;
-
- DUK_DDD(DUK_DDDPRINT("initializing built-in object at index %ld", (long) i));
- h = duk_require_hobject(ctx, i);
- DUK_ASSERT(h != NULL);
-
- t = (duk_small_uint_t) duk_bd_decode(bd, DUK__BIDX_BITS);
- if (t != DUK__NO_BIDX_MARKER) {
- DUK_DDD(DUK_DDDPRINT("set internal prototype: built-in %ld", (long) t));
- DUK_HOBJECT_SET_PROTOTYPE_UPDREF(thr, h, duk_require_hobject(ctx, t));
- }
-
- t = (duk_small_uint_t) duk_bd_decode(bd, DUK__BIDX_BITS);
- if (t != DUK__NO_BIDX_MARKER) {
- /* 'prototype' property for all built-in objects (which have it) has attributes:
- * [[Writable]] = false,
- * [[Enumerable]] = false,
- * [[Configurable]] = false
- */
- DUK_DDD(DUK_DDDPRINT("set external prototype: built-in %ld", (long) t));
- duk_xdef_prop_stridx_builtin(ctx, i, DUK_STRIDX_PROTOTYPE, t, DUK_PROPDESC_FLAGS_NONE);
- }
-
- t = (duk_small_uint_t) duk_bd_decode(bd, DUK__BIDX_BITS);
- if (t != DUK__NO_BIDX_MARKER) {
- /* 'constructor' property for all built-in objects (which have it) has attributes:
- * [[Writable]] = true,
- * [[Enumerable]] = false,
- * [[Configurable]] = true
- */
- DUK_DDD(DUK_DDDPRINT("set external constructor: built-in %ld", (long) t));
- duk_xdef_prop_stridx_builtin(ctx, i, DUK_STRIDX_CONSTRUCTOR, t, DUK_PROPDESC_FLAGS_WC);
- }
-
- /* normal valued properties */
- num = (duk_small_uint_t) duk_bd_decode(bd, DUK__NUM_NORMAL_PROPS_BITS);
- DUK_DDD(DUK_DDDPRINT("built-in object %ld, %ld normal valued properties", (long) i, (long) num));
- for (j = 0; j < num; j++) {
- duk_small_uint_t prop_flags;
-
- duk__push_stridx_or_string(ctx, bd);
-
- /*
- * Property attribute defaults are defined in E5 Section 15 (first
- * few pages); there is a default for all properties and a special
- * default for 'length' properties. Variation from the defaults is
- * signaled using a single flag bit in the bitstream.
- */
-
- if (duk_bd_decode_flag(bd)) {
- prop_flags = (duk_small_uint_t) duk_bd_decode(bd, DUK__PROP_FLAGS_BITS);
- } else {
- prop_flags = DUK_PROPDESC_FLAGS_WC;
- }
-
- t = (duk_small_uint_t) duk_bd_decode(bd, DUK__PROP_TYPE_BITS);
-
- DUK_DDD(DUK_DDDPRINT("built-in %ld, normal-valued property %ld, key %!T, flags 0x%02lx, type %ld",
- (long) i, (long) j, duk_get_tval(ctx, -1), (unsigned long) prop_flags, (long) t));
-
- switch (t) {
- case DUK__PROP_TYPE_DOUBLE: {
- duk__push_double(ctx, bd);
- break;
- }
- case DUK__PROP_TYPE_STRING: {
- duk__push_string(ctx, bd);
- break;
- }
- case DUK__PROP_TYPE_STRIDX: {
- duk__push_stridx(ctx, bd);
- break;
- }
- case DUK__PROP_TYPE_BUILTIN: {
- duk_small_uint_t bidx;
-
- bidx = (duk_small_uint_t) duk_bd_decode(bd, DUK__BIDX_BITS);
- DUK_ASSERT(bidx != DUK__NO_BIDX_MARKER);
- duk_dup(ctx, (duk_idx_t) bidx);
- break;
- }
- case DUK__PROP_TYPE_UNDEFINED: {
- duk_push_undefined(ctx);
- break;
- }
- case DUK__PROP_TYPE_BOOLEAN_TRUE: {
- duk_push_true(ctx);
- break;
- }
- case DUK__PROP_TYPE_BOOLEAN_FALSE: {
- duk_push_false(ctx);
- break;
- }
- case DUK__PROP_TYPE_ACCESSOR: {
- duk_small_uint_t natidx_getter = (duk_small_uint_t) duk_bd_decode(bd, DUK__NATIDX_BITS);
- duk_small_uint_t natidx_setter = (duk_small_uint_t) duk_bd_decode(bd, DUK__NATIDX_BITS);
- duk_c_function c_func_getter;
- duk_c_function c_func_setter;
-
- /* XXX: this is a bit awkward because there is no exposed helper
- * in the API style, only this internal helper.
- */
- DUK_DDD(DUK_DDDPRINT("built-in accessor property: objidx=%ld, key=%!T, getteridx=%ld, setteridx=%ld, flags=0x%04lx",
- (long) i, duk_get_tval(ctx, -1), (long) natidx_getter, (long) natidx_setter, (unsigned long) prop_flags));
-
- c_func_getter = duk_bi_native_functions[natidx_getter];
- c_func_setter = duk_bi_native_functions[natidx_setter];
- duk_push_c_function_noconstruct_noexotic(ctx, c_func_getter, 0); /* always 0 args */
- duk_push_c_function_noconstruct_noexotic(ctx, c_func_setter, 1); /* always 1 arg */
-
- /* XXX: magic for getter/setter? use duk_def_prop()? */
-
- DUK_ASSERT((prop_flags & DUK_PROPDESC_FLAG_WRITABLE) == 0); /* genbuiltins.py ensures */
-
- prop_flags |= DUK_PROPDESC_FLAG_ACCESSOR; /* accessor flag not encoded explicitly */
- duk_hobject_define_accessor_internal(thr,
- duk_require_hobject(ctx, i),
- duk_get_hstring(ctx, -3),
- duk_require_hobject(ctx, -2),
- duk_require_hobject(ctx, -1),
- prop_flags);
- duk_pop_3(ctx); /* key, getter and setter, now reachable through object */
- goto skip_value;
- }
- default: {
- /* exhaustive */
- DUK_UNREACHABLE();
- }
- }
-
- DUK_ASSERT((prop_flags & DUK_PROPDESC_FLAG_ACCESSOR) == 0);
- duk_xdef_prop(ctx, i, prop_flags);
-
- skip_value:
- continue; /* avoid empty label at the end of a compound statement */
- }
-
- /* native function properties */
- num = (duk_small_uint_t) duk_bd_decode(bd, DUK__NUM_FUNC_PROPS_BITS);
- DUK_DDD(DUK_DDDPRINT("built-in object %ld, %ld function valued properties", (long) i, (long) num));
- for (j = 0; j < num; j++) {
- duk_hstring *h_key;
- duk_small_uint_t natidx;
- duk_int_t c_nargs; /* must hold DUK_VARARGS */
- duk_small_uint_t c_length;
- duk_int16_t magic;
- duk_c_function c_func;
- duk_hnativefunction *h_func;
-#if defined(DUK_USE_LIGHTFUNC_BUILTINS)
- duk_small_int_t lightfunc_eligible;
-#endif
-
- duk__push_stridx_or_string(ctx, bd);
- h_key = duk_get_hstring(ctx, -1);
- DUK_ASSERT(h_key != NULL);
- DUK_UNREF(h_key);
- natidx = (duk_small_uint_t) duk_bd_decode(bd, DUK__NATIDX_BITS);
-
- c_length = (duk_small_uint_t) duk_bd_decode(bd, DUK__LENGTH_PROP_BITS);
- c_nargs = (duk_int_t) duk_bd_decode_flagged(bd, DUK__NARGS_BITS, (duk_int32_t) c_length /*def_value*/);
- if (c_nargs == DUK__NARGS_VARARGS_MARKER) {
- c_nargs = DUK_VARARGS;
- }
-
- c_func = duk_bi_native_functions[natidx];
-
- DUK_DDD(DUK_DDDPRINT("built-in %ld, function-valued property %ld, key %!O, natidx %ld, length %ld, nargs %ld",
- (long) i, (long) j, (duk_heaphdr *) h_key, (long) natidx, (long) c_length,
- (c_nargs == DUK_VARARGS ? (long) -1 : (long) c_nargs)));
-
- /* Cast converts magic to 16-bit signed value */
- magic = (duk_int16_t) duk_bd_decode_flagged(bd, DUK__MAGIC_BITS, 0);
-
-#if defined(DUK_USE_LIGHTFUNC_BUILTINS)
- lightfunc_eligible =
- ((c_nargs >= DUK_LFUNC_NARGS_MIN && c_nargs <= DUK_LFUNC_NARGS_MAX) || (c_nargs == DUK_VARARGS)) &&
- (c_length <= DUK_LFUNC_LENGTH_MAX) &&
- (magic >= DUK_LFUNC_MAGIC_MIN && magic <= DUK_LFUNC_MAGIC_MAX);
-
- if (h_key == DUK_HTHREAD_STRING_EVAL(thr) ||
- h_key == DUK_HTHREAD_STRING_YIELD(thr) ||
- h_key == DUK_HTHREAD_STRING_RESUME(thr) ||
- h_key == DUK_HTHREAD_STRING_REQUIRE(thr)) {
- /* These functions have trouble working as lightfuncs.
- * Some of them have specific asserts and some may have
- * additional properties (e.g. 'require.id' may be written).
- */
- DUK_D(DUK_DPRINT("reject as lightfunc: key=%!O, i=%d, j=%d", (duk_heaphdr *) h_key, (int) i, (int) j));
- lightfunc_eligible = 0;
- }
-
- if (lightfunc_eligible) {
- duk_tval tv_lfunc;
- duk_small_uint_t lf_nargs = (c_nargs == DUK_VARARGS ? DUK_LFUNC_NARGS_VARARGS : c_nargs);
- duk_small_uint_t lf_flags = DUK_LFUNC_FLAGS_PACK(magic, c_length, lf_nargs);
- DUK_TVAL_SET_LIGHTFUNC(&tv_lfunc, c_func, lf_flags);
- duk_push_tval(ctx, &tv_lfunc);
- DUK_D(DUK_DPRINT("built-in function eligible as light function: i=%d, j=%d c_length=%ld, c_nargs=%ld, magic=%ld -> %!iT", (int) i, (int) j, (long) c_length, (long) c_nargs, (long) magic, duk_get_tval(ctx, -1)));
- goto lightfunc_skip;
- }
-
- DUK_D(DUK_DPRINT("built-in function NOT ELIGIBLE as light function: i=%d, j=%d c_length=%ld, c_nargs=%ld, magic=%ld", (int) i, (int) j, (long) c_length, (long) c_nargs, (long) magic));
-#endif /* DUK_USE_LIGHTFUNC_BUILTINS */
-
- /* [ (builtin objects) name ] */
-
- duk_push_c_function_noconstruct_noexotic(ctx, c_func, c_nargs);
- h_func = duk_require_hnativefunction(ctx, -1);
- DUK_UNREF(h_func);
-
- /* Currently all built-in native functions are strict.
- * This doesn't matter for many functions, but e.g.
- * String.prototype.charAt (and other string functions)
- * rely on being strict so that their 'this' binding is
- * not automatically coerced.
- */
- DUK_HOBJECT_SET_STRICT((duk_hobject *) h_func);
-
- /* No built-in functions are constructable except the top
- * level ones (Number, etc).
- */
- DUK_ASSERT(!DUK_HOBJECT_HAS_CONSTRUCTABLE((duk_hobject *) h_func));
-
- /* XXX: any way to avoid decoding magic bit; there are quite
- * many function properties and relatively few with magic values.
- */
- h_func->magic = magic;
-
- /* [ (builtin objects) name func ] */
-
- duk_push_int(ctx, c_length);
- duk_xdef_prop_stridx(ctx, -2, DUK_STRIDX_LENGTH, DUK_PROPDESC_FLAGS_NONE);
-
- duk_dup(ctx, -2);
- duk_xdef_prop_stridx(ctx, -2, DUK_STRIDX_NAME, DUK_PROPDESC_FLAGS_NONE);
-
- /* XXX: other properties of function instances; 'arguments', 'caller'. */
-
- DUK_DD(DUK_DDPRINT("built-in object %ld, function property %ld -> %!T",
- (long) i, (long) j, (duk_tval *) duk_get_tval(ctx, -1)));
-
- /* [ (builtin objects) name func ] */
-
- /*
- * The default property attributes are correct for all
- * function valued properties of built-in objects now.
- */
-
-#if defined(DUK_USE_LIGHTFUNC_BUILTINS)
- lightfunc_skip:
-#endif
-
- duk_xdef_prop(ctx, i, DUK_PROPDESC_FLAGS_WC);
-
- /* [ (builtin objects) ] */
- }
- }
-
- /*
- * Special post-tweaks, for cases not covered by the init data format.
- *
- * - Set Date.prototype.toGMTString to Date.prototype.toUTCString.
- * toGMTString is required to have the same Function object as
- * toUTCString in E5 Section B.2.6. Note that while Smjs respects
- * this, V8 does not (the Function objects are distinct).
- *
- * - Make DoubleError non-extensible.
- *
- * - Add info about most important effective compile options to Duktape.
- *
- * - Possibly remove some properties (values or methods) which are not
- * desirable with current feature options but are not currently
- * conditional in init data.
- */
-
- duk_get_prop_stridx(ctx, DUK_BIDX_DATE_PROTOTYPE, DUK_STRIDX_TO_UTC_STRING);
- duk_xdef_prop_stridx(ctx, DUK_BIDX_DATE_PROTOTYPE, DUK_STRIDX_TO_GMT_STRING, DUK_PROPDESC_FLAGS_WC);
-
- h = duk_require_hobject(ctx, DUK_BIDX_DOUBLE_ERROR);
- DUK_ASSERT(h != NULL);
- DUK_HOBJECT_CLEAR_EXTENSIBLE(h);
-
-#if !defined(DUK_USE_ES6_OBJECT_PROTO_PROPERTY)
- DUK_DD(DUK_DDPRINT("delete Object.prototype.__proto__ built-in which is not enabled in features"));
- (void) duk_hobject_delprop_raw(thr, thr->builtins[DUK_BIDX_OBJECT_PROTOTYPE], DUK_HTHREAD_STRING___PROTO__(thr), DUK_DELPROP_FLAG_THROW);
-#endif
-
-#if !defined(DUK_USE_ES6_OBJECT_SETPROTOTYPEOF)
- DUK_DD(DUK_DDPRINT("delete Object.setPrototypeOf built-in which is not enabled in features"));
- (void) duk_hobject_delprop_raw(thr, thr->builtins[DUK_BIDX_OBJECT_CONSTRUCTOR], DUK_HTHREAD_STRING_SET_PROTOTYPE_OF(thr), DUK_DELPROP_FLAG_THROW);
-#endif
-
- /* XXX: relocate */
- duk_push_string(ctx,
- /* Endianness indicator */
-#if defined(DUK_USE_INTEGER_LE)
- "l"
-#elif defined(DUK_USE_INTEGER_BE)
- "b"
-#elif defined(DUK_USE_INTEGER_ME) /* integer mixed endian not really used now */
- "m"
-#else
- "?"
-#endif
-#if defined(DUK_USE_DOUBLE_LE)
- "l"
-#elif defined(DUK_USE_DOUBLE_BE)
- "b"
-#elif defined(DUK_USE_DOUBLE_ME)
- "m"
-#else
- "?"
-#endif
- " "
- /* Packed or unpacked tval */
-#if defined(DUK_USE_PACKED_TVAL)
- "p"
-#else
- "u"
-#endif
-#if defined(DUK_USE_FASTINT)
- "f"
-#endif
- " "
- /* Low memory options */
-#if defined(DUK_USE_STRTAB_CHAIN)
- "c" /* chain */
-#elif defined(DUK_USE_STRTAB_PROBE)
- "p" /* probe */
-#else
- "?"
-#endif
-#if !defined(DUK_USE_HEAPPTR16) && !defined(DUK_DATAPTR16) && !defined(DUK_FUNCPTR16)
- "n"
-#endif
-#if defined(DUK_USE_HEAPPTR16)
- "h"
-#endif
-#if defined(DUK_USE_DATAPTR16)
- "d"
-#endif
-#if defined(DUK_USE_FUNCPTR16)
- "f"
-#endif
-#if defined(DUK_USE_REFCOUNT16)
- "R"
-#endif
-#if defined(DUK_USE_STRHASH16)
- "H"
-#endif
-#if defined(DUK_USE_STRLEN16)
- "S"
-#endif
-#if defined(DUK_USE_BUFLEN16)
- "B"
-#endif
-#if defined(DUK_USE_OBJSIZES16)
- "O"
-#endif
-#if defined(DUK_USE_LIGHTFUNC_BUILTINS)
- "L"
-#endif
-#if defined(DUK_USE_ROM_STRINGS) || defined(DUK_USE_ROM_OBJECTS)
- /* XXX: This won't be shown in practice now
- * because this code is not run when builtins
- * are in ROM.
- */
- "Z"
-#endif
- " "
- /* Object property allocation layout */
-#if defined(DUK_USE_HOBJECT_LAYOUT_1)
- "p1"
-#elif defined(DUK_USE_HOBJECT_LAYOUT_2)
- "p2"
-#elif defined(DUK_USE_HOBJECT_LAYOUT_3)
- "p3"
-#else
- "p?"
-#endif
- " "
- /* Alignment guarantee */
-#if (DUK_USE_ALIGN_BY == 4)
- "a4"
-#elif (DUK_USE_ALIGN_BY == 8)
- "a8"
-#elif (DUK_USE_ALIGN_BY == 1)
- "a1"
-#else
-#error invalid DUK_USE_ALIGN_BY
-#endif
- " "
- /* Architecture, OS, and compiler strings */
- DUK_USE_ARCH_STRING
- " "
- DUK_USE_OS_STRING
- " "
- DUK_USE_COMPILER_STRING);
- duk_xdef_prop_stridx(ctx, DUK_BIDX_DUKTAPE, DUK_STRIDX_ENV, DUK_PROPDESC_FLAGS_WC);
-
- /*
- * InitJS code - Ecmascript code evaluated from a built-in source
- * which provides e.g. backward compatibility. User can also provide
- * JS code to be evaluated at startup.
- */
-
-#ifdef DUK_USE_BUILTIN_INITJS
- /* XXX: compression */
- DUK_DD(DUK_DDPRINT("running built-in initjs"));
- duk_eval_string(ctx, (const char *) duk_initjs_data); /* initjs data is NUL terminated */
- duk_pop(ctx);
-#endif /* DUK_USE_BUILTIN_INITJS */
-
-#ifdef DUK_USE_USER_INITJS
- /* XXX: compression (as an option) */
- DUK_DD(DUK_DDPRINT("running user initjs"));
- duk_eval_string_noresult(ctx, (const char *) DUK_USE_USER_INITJS);
-#endif /* DUK_USE_USER_INITJS */
-
- /*
- * Since built-ins are not often extended, compact them.
- */
-
- DUK_DD(DUK_DDPRINT("compact built-ins"));
- for (i = 0; i < DUK_NUM_ALL_BUILTINS; i++) {
- duk_hobject_compact_props(thr, duk_require_hobject(ctx, i));
- }
-
- DUK_D(DUK_DPRINT("INITBUILTINS END"));
-
-#ifdef DUK_USE_DDPRINT
- for (i = 0; i < DUK_NUM_ALL_BUILTINS; i++) {
- DUK_DD(DUK_DDPRINT("built-in object %ld after initialization and compacting: %!@iO",
- (long) i, (duk_heaphdr *) duk_require_hobject(ctx, i)));
- }
-#endif
-
- /*
- * Pop built-ins from stack: they are now INCREF'd and
- * reachable from the builtins[] array or indirectly
- * through builtins[].
- */
-
- duk_set_top(ctx, 0);
- DUK_ASSERT_TOP(ctx, 0);
-}
-#endif /* DUK_USE_ROM_OBJECTS */
-
-DUK_INTERNAL void duk_hthread_copy_builtin_objects(duk_hthread *thr_from, duk_hthread *thr_to) {
- duk_small_uint_t i;
-
- for (i = 0; i < DUK_NUM_BUILTINS; i++) {
- thr_to->builtins[i] = thr_from->builtins[i];
- DUK_HOBJECT_INCREF_ALLOWNULL(thr_to, thr_to->builtins[i]); /* side effect free */
- }
-}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/ede68a10/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hthread_misc.c
----------------------------------------------------------------------
diff --git a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hthread_misc.c b/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hthread_misc.c
deleted file mode 100644
index 7536689..0000000
--- a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hthread_misc.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Thread support.
- */
-
-#include "duk_internal.h"
-
-DUK_INTERNAL void duk_hthread_terminate(duk_hthread *thr) {
- DUK_ASSERT(thr != NULL);
-
- /* Order of unwinding is important */
-
- duk_hthread_catchstack_unwind(thr, 0);
-
- duk_hthread_callstack_unwind(thr, 0); /* side effects, possibly errors */
-
- thr->valstack_bottom = thr->valstack;
- duk_set_top((duk_context *) thr, 0); /* unwinds valstack, updating refcounts */
-
- thr->state = DUK_HTHREAD_STATE_TERMINATED;
-
- /* Here we could remove references to built-ins, but it may not be
- * worth the effort because built-ins are quite likely to be shared
- * with another (unterminated) thread, and terminated threads are also
- * usually garbage collected quite quickly. Also, doing DECREFs
- * could trigger finalization, which would run on the current thread
- * and have access to only some of the built-ins. Garbage collection
- * deals with this correctly already.
- */
-
- /* XXX: Shrink the stacks to minimize memory usage? May not
- * be worth the effort because terminated threads are usually
- * garbage collected quite soon.
- */
-}
-
-DUK_INTERNAL duk_activation *duk_hthread_get_current_activation(duk_hthread *thr) {
- DUK_ASSERT(thr != NULL);
-
- if (thr->callstack_top > 0) {
- return thr->callstack + thr->callstack_top - 1;
- } else {
- return NULL;
- }
-}
-
-#if defined(DUK_USE_DEBUGGER_SUPPORT)
-DUK_INTERNAL duk_uint_fast32_t duk_hthread_get_act_curr_pc(duk_hthread *thr, duk_activation *act) {
- duk_instr_t *bcode;
-
- DUK_ASSERT(thr != NULL);
- DUK_ASSERT(act != NULL);
- DUK_UNREF(thr);
-
- /* XXX: store 'bcode' pointer to activation for faster lookup? */
- if (act->func && DUK_HOBJECT_IS_COMPILEDFUNCTION(act->func)) {
- bcode = DUK_HCOMPILEDFUNCTION_GET_CODE_BASE(thr->heap, (duk_hcompiledfunction *) (act->func));
- return (duk_uint_fast32_t) (act->curr_pc - bcode);
- }
- return 0;
-}
-#endif /* DUK_USE_DEBUGGER_SUPPORT */
-
-DUK_INTERNAL duk_uint_fast32_t duk_hthread_get_act_prev_pc(duk_hthread *thr, duk_activation *act) {
- duk_instr_t *bcode;
- duk_uint_fast32_t ret;
-
- DUK_ASSERT(thr != NULL);
- DUK_ASSERT(act != NULL);
- DUK_UNREF(thr);
-
- if (act->func && DUK_HOBJECT_IS_COMPILEDFUNCTION(act->func)) {
- bcode = DUK_HCOMPILEDFUNCTION_GET_CODE_BASE(thr->heap, (duk_hcompiledfunction *) (act->func));
- ret = (duk_uint_fast32_t) (act->curr_pc - bcode);
- if (ret > 0) {
- ret--;
- }
- return ret;
- }
- return 0;
-}
-
-/* Write bytecode executor's curr_pc back to topmost activation (if any). */
-DUK_INTERNAL void duk_hthread_sync_currpc(duk_hthread *thr) {
- duk_activation *act;
-
- DUK_ASSERT(thr != NULL);
-
- if (thr->ptr_curr_pc != NULL) {
- /* ptr_curr_pc != NULL only when bytecode executor is active. */
- DUK_ASSERT(thr->callstack_top > 0);
- act = thr->callstack + thr->callstack_top - 1;
- act->curr_pc = *thr->ptr_curr_pc;
- }
-}
-
-DUK_INTERNAL void duk_hthread_sync_and_null_currpc(duk_hthread *thr) {
- duk_activation *act;
-
- DUK_ASSERT(thr != NULL);
-
- if (thr->ptr_curr_pc != NULL) {
- /* ptr_curr_pc != NULL only when bytecode executor is active. */
- DUK_ASSERT(thr->callstack_top > 0);
- act = thr->callstack + thr->callstack_top - 1;
- act->curr_pc = *thr->ptr_curr_pc;
- thr->ptr_curr_pc = NULL;
- }
-}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/ede68a10/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hthread_stacks.c
----------------------------------------------------------------------
diff --git a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hthread_stacks.c b/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hthread_stacks.c
deleted file mode 100644
index 59b072d..0000000
--- a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hthread_stacks.c
+++ /dev/null
@@ -1,476 +0,0 @@
-/*
- * Manipulation of thread stacks (valstack, callstack, catchstack).
- *
- * Ideally unwinding of stacks should have no side effects, which would
- * then favor separate unwinding and shrink check primitives for each
- * stack type. A shrink check may realloc and thus have side effects.
- *
- * However, currently callstack unwinding itself has side effects, as it
- * needs to DECREF multiple objects, close environment records, etc.
- * Stacks must thus be unwound in the correct order by the caller.
- *
- * (XXX: This should be probably reworked so that there is a shared
- * unwind primitive which handles all stacks as requested, and knows
- * the proper order for unwinding.)
- *
- * Valstack entries above 'top' are always kept initialized to
- * "undefined unused". Callstack and catchstack entries above 'top'
- * are not zeroed and are left as garbage.
- *
- * Value stack handling is mostly a part of the API implementation.
- */
-
-#include "duk_internal.h"
-
-/* check that there is space for at least one new entry */
-DUK_INTERNAL void duk_hthread_callstack_grow(duk_hthread *thr) {
- duk_activation *new_ptr;
- duk_size_t old_size;
- duk_size_t new_size;
-
- DUK_ASSERT(thr != NULL);
- DUK_ASSERT_DISABLE(thr->callstack_top >= 0); /* avoid warning (unsigned) */
- DUK_ASSERT(thr->callstack_size >= thr->callstack_top);
-
- if (thr->callstack_top < thr->callstack_size) {
- return;
- }
-
- old_size = thr->callstack_size;
- new_size = old_size + DUK_CALLSTACK_GROW_STEP;
-
- /* this is a bit approximate (errors out before max is reached); this is OK */
- if (new_size >= thr->callstack_max) {
- DUK_ERROR_RANGE(thr, DUK_STR_CALLSTACK_LIMIT);
- }
-
- DUK_DD(DUK_DDPRINT("growing callstack %ld -> %ld", (long) old_size, (long) new_size));
-
- /*
- * Note: must use indirect variant of DUK_REALLOC() because underlying
- * pointer may be changed by mark-and-sweep.
- */
-
- DUK_ASSERT(new_size > 0);
- new_ptr = (duk_activation *) DUK_REALLOC_INDIRECT(thr->heap, duk_hthread_get_callstack_ptr, (void *) thr, sizeof(duk_activation) * new_size);
- if (!new_ptr) {
- /* No need for a NULL/zero-size check because new_size > 0) */
- DUK_ERROR_ALLOC_DEFMSG(thr);
- }
- thr->callstack = new_ptr;
- thr->callstack_size = new_size;
-
- /* note: any entries above the callstack top are garbage and not zeroed */
-}
-
-DUK_INTERNAL void duk_hthread_callstack_shrink_check(duk_hthread *thr) {
- duk_size_t new_size;
- duk_activation *p;
-
- DUK_ASSERT(thr != NULL);
- DUK_ASSERT_DISABLE(thr->callstack_top >= 0); /* avoid warning (unsigned) */
- DUK_ASSERT(thr->callstack_size >= thr->callstack_top);
-
- if (thr->callstack_size - thr->callstack_top < DUK_CALLSTACK_SHRINK_THRESHOLD) {
- return;
- }
-
- new_size = thr->callstack_top + DUK_CALLSTACK_SHRINK_SPARE;
- DUK_ASSERT(new_size >= thr->callstack_top);
-
- DUK_DD(DUK_DDPRINT("shrinking callstack %ld -> %ld", (long) thr->callstack_size, (long) new_size));
-
- /*
- * Note: must use indirect variant of DUK_REALLOC() because underlying
- * pointer may be changed by mark-and-sweep.
- */
-
- /* shrink failure is not fatal */
- p = (duk_activation *) DUK_REALLOC_INDIRECT(thr->heap, duk_hthread_get_callstack_ptr, (void *) thr, sizeof(duk_activation) * new_size);
- if (p) {
- thr->callstack = p;
- thr->callstack_size = new_size;
- } else {
- /* Because new_size != 0, if condition doesn't need to be
- * (p != NULL || new_size == 0).
- */
- DUK_ASSERT(new_size != 0);
- DUK_D(DUK_DPRINT("callstack shrink failed, ignoring"));
- }
-
- /* note: any entries above the callstack top are garbage and not zeroed */
-}
-
-DUK_INTERNAL void duk_hthread_callstack_unwind(duk_hthread *thr, duk_size_t new_top) {
- duk_size_t idx;
-
- DUK_DDD(DUK_DDDPRINT("unwind callstack top of thread %p from %ld to %ld",
- (void *) thr,
- (thr != NULL ? (long) thr->callstack_top : (long) -1),
- (long) new_top));
-
- DUK_ASSERT(thr);
- DUK_ASSERT(thr->heap);
- DUK_ASSERT_DISABLE(new_top >= 0); /* unsigned */
- DUK_ASSERT((duk_size_t) new_top <= thr->callstack_top); /* cannot grow */
-
- /*
- * The loop below must avoid issues with potential callstack
- * reallocations. A resize (and other side effects) may happen
- * e.g. due to finalizer/errhandler calls caused by a refzero or
- * mark-and-sweep. Arbitrary finalizers may run, because when
- * an environment record is refzero'd, it may refer to arbitrary
- * values which also become refzero'd.
- *
- * So, the pointer 'p' is re-looked-up below whenever a side effect
- * might have changed it.
- */
-
- idx = thr->callstack_top;
- while (idx > new_top) {
- duk_activation *act;
- duk_hobject *func;
-#ifdef DUK_USE_REFERENCE_COUNTING
- duk_hobject *tmp;
-#endif
-#ifdef DUK_USE_DEBUGGER_SUPPORT
- duk_heap *heap;
-#endif
-
- idx--;
- DUK_ASSERT_DISABLE(idx >= 0); /* unsigned */
- DUK_ASSERT((duk_size_t) idx < thr->callstack_size); /* true, despite side effect resizes */
-
- act = thr->callstack + idx;
- /* With lightfuncs, act 'func' may be NULL */
-
-#ifdef DUK_USE_NONSTD_FUNC_CALLER_PROPERTY
- /*
- * Restore 'caller' property for non-strict callee functions.
- */
-
- func = DUK_ACT_GET_FUNC(act);
- if (func != NULL && !DUK_HOBJECT_HAS_STRICT(func)) {
- duk_tval *tv_caller;
- duk_tval tv_tmp;
- duk_hobject *h_tmp;
-
- tv_caller = duk_hobject_find_existing_entry_tval_ptr(thr->heap, func, DUK_HTHREAD_STRING_CALLER(thr));
-
- /* The act->prev_caller should only be set if the entry for 'caller'
- * exists (as it is only set in that case, and the property is not
- * configurable), but handle all the cases anyway.
- */
-
- if (tv_caller) {
- DUK_TVAL_SET_TVAL(&tv_tmp, tv_caller);
- if (act->prev_caller) {
- /* Just transfer the refcount from act->prev_caller to tv_caller,
- * so no need for a refcount update. This is the expected case.
- */
- DUK_TVAL_SET_OBJECT(tv_caller, act->prev_caller);
- act->prev_caller = NULL;
- } else {
- DUK_TVAL_SET_NULL(tv_caller); /* no incref needed */
- DUK_ASSERT(act->prev_caller == NULL);
- }
- DUK_TVAL_DECREF(thr, &tv_tmp); /* side effects */
- } else {
- h_tmp = act->prev_caller;
- if (h_tmp) {
- act->prev_caller = NULL;
- DUK_HOBJECT_DECREF(thr, h_tmp); /* side effects */
- }
- }
- act = thr->callstack + idx; /* avoid side effects */
- DUK_ASSERT(act->prev_caller == NULL);
- }
-#endif
-
- /*
- * Unwind debugger state. If we unwind while stepping
- * (either step over or step into), pause execution.
- */
-
-#if defined(DUK_USE_DEBUGGER_SUPPORT)
- heap = thr->heap;
- if (heap->dbg_step_thread == thr &&
- heap->dbg_step_csindex == idx) {
- /* Pause for all step types: step into, step over, step out.
- * This is the only place explicitly handling a step out.
- */
- DUK_HEAP_SET_PAUSED(heap);
- DUK_ASSERT(heap->dbg_step_thread == NULL);
- }
-#endif
-
- /*
- * Close environment record(s) if they exist.
- *
- * Only variable environments are closed. If lex_env != var_env, it
- * cannot currently contain any register bound declarations.
- *
- * Only environments created for a NEWENV function are closed. If an
- * environment is created for e.g. an eval call, it must not be closed.
- */
-
- func = DUK_ACT_GET_FUNC(act);
- if (func != NULL && !DUK_HOBJECT_HAS_NEWENV(func)) {
- DUK_DDD(DUK_DDDPRINT("skip closing environments, envs not owned by this activation"));
- goto skip_env_close;
- }
- /* func is NULL for lightfunc */
-
- DUK_ASSERT(act->lex_env == act->var_env);
- if (act->var_env != NULL) {
- DUK_DDD(DUK_DDDPRINT("closing var_env record %p -> %!O",
- (void *) act->var_env, (duk_heaphdr *) act->var_env));
- duk_js_close_environment_record(thr, act->var_env, func, act->idx_bottom);
- act = thr->callstack + idx; /* avoid side effect issues */
- }
-
-#if 0
- if (act->lex_env != NULL) {
- if (act->lex_env == act->var_env) {
- /* common case, already closed, so skip */
- DUK_DD(DUK_DDPRINT("lex_env and var_env are the same and lex_env "
- "already closed -> skip closing lex_env"));
- ;
- } else {
- DUK_DD(DUK_DDPRINT("closing lex_env record %p -> %!O",
- (void *) act->lex_env, (duk_heaphdr *) act->lex_env));
- duk_js_close_environment_record(thr, act->lex_env, DUK_ACT_GET_FUNC(act), act->idx_bottom);
- act = thr->callstack + idx; /* avoid side effect issues */
- }
- }
-#endif
-
- DUK_ASSERT((act->lex_env == NULL) ||
- ((duk_hobject_find_existing_entry_tval_ptr(thr->heap, act->lex_env, DUK_HTHREAD_STRING_INT_CALLEE(thr)) == NULL) &&
- (duk_hobject_find_existing_entry_tval_ptr(thr->heap, act->lex_env, DUK_HTHREAD_STRING_INT_VARMAP(thr)) == NULL) &&
- (duk_hobject_find_existing_entry_tval_ptr(thr->heap, act->lex_env, DUK_HTHREAD_STRING_INT_THREAD(thr)) == NULL) &&
- (duk_hobject_find_existing_entry_tval_ptr(thr->heap, act->lex_env, DUK_HTHREAD_STRING_INT_REGBASE(thr)) == NULL)));
-
- DUK_ASSERT((act->var_env == NULL) ||
- ((duk_hobject_find_existing_entry_tval_ptr(thr->heap, act->var_env, DUK_HTHREAD_STRING_INT_CALLEE(thr)) == NULL) &&
- (duk_hobject_find_existing_entry_tval_ptr(thr->heap, act->var_env, DUK_HTHREAD_STRING_INT_VARMAP(thr)) == NULL) &&
- (duk_hobject_find_existing_entry_tval_ptr(thr->heap, act->var_env, DUK_HTHREAD_STRING_INT_THREAD(thr)) == NULL) &&
- (duk_hobject_find_existing_entry_tval_ptr(thr->heap, act->var_env, DUK_HTHREAD_STRING_INT_REGBASE(thr)) == NULL)));
-
- skip_env_close:
-
- /*
- * Update preventcount
- */
-
- if (act->flags & DUK_ACT_FLAG_PREVENT_YIELD) {
- DUK_ASSERT(thr->callstack_preventcount >= 1);
- thr->callstack_preventcount--;
- }
-
- /*
- * Reference count updates
- *
- * Note: careful manipulation of refcounts. The top is
- * not updated yet, so all the activations are reachable
- * for mark-and-sweep (which may be triggered by decref).
- * However, the pointers are NULL so this is not an issue.
- */
-
-#ifdef DUK_USE_REFERENCE_COUNTING
- tmp = act->var_env;
-#endif
- act->var_env = NULL;
-#ifdef DUK_USE_REFERENCE_COUNTING
- DUK_HOBJECT_DECREF_ALLOWNULL(thr, tmp);
- act = thr->callstack + idx; /* avoid side effect issues */
-#endif
-
-#ifdef DUK_USE_REFERENCE_COUNTING
- tmp = act->lex_env;
-#endif
- act->lex_env = NULL;
-#ifdef DUK_USE_REFERENCE_COUNTING
- DUK_HOBJECT_DECREF_ALLOWNULL(thr, tmp);
- act = thr->callstack + idx; /* avoid side effect issues */
-#endif
-
- /* Note: this may cause a corner case situation where a finalizer
- * may see a currently reachable activation whose 'func' is NULL.
- */
-#ifdef DUK_USE_REFERENCE_COUNTING
- tmp = DUK_ACT_GET_FUNC(act);
-#endif
- act->func = NULL;
-#ifdef DUK_USE_REFERENCE_COUNTING
- DUK_HOBJECT_DECREF_ALLOWNULL(thr, tmp);
- act = thr->callstack + idx; /* avoid side effect issues */
- DUK_UNREF(act);
-#endif
- }
-
- thr->callstack_top = new_top;
-
- /*
- * We could clear the book-keeping variables for the topmost activation,
- * but don't do so now.
- */
-#if 0
- if (thr->callstack_top > 0) {
- duk_activation *act = thr->callstack + thr->callstack_top - 1;
- act->idx_retval = 0;
- }
-#endif
-
- /* Note: any entries above the callstack top are garbage and not zeroed.
- * Also topmost activation idx_retval is garbage (not zeroed), and must
- * be ignored.
- */
-}
-
-DUK_INTERNAL void duk_hthread_catchstack_grow(duk_hthread *thr) {
- duk_catcher *new_ptr;
- duk_size_t old_size;
- duk_size_t new_size;
-
- DUK_ASSERT(thr != NULL);
- DUK_ASSERT_DISABLE(thr->catchstack_top); /* avoid warning (unsigned) */
- DUK_ASSERT(thr->catchstack_size >= thr->catchstack_top);
-
- if (thr->catchstack_top < thr->catchstack_size) {
- return;
- }
-
- old_size = thr->catchstack_size;
- new_size = old_size + DUK_CATCHSTACK_GROW_STEP;
-
- /* this is a bit approximate (errors out before max is reached); this is OK */
- if (new_size >= thr->catchstack_max) {
- DUK_ERROR_RANGE(thr, DUK_STR_CATCHSTACK_LIMIT);
- }
-
- DUK_DD(DUK_DDPRINT("growing catchstack %ld -> %ld", (long) old_size, (long) new_size));
-
- /*
- * Note: must use indirect variant of DUK_REALLOC() because underlying
- * pointer may be changed by mark-and-sweep.
- */
-
- DUK_ASSERT(new_size > 0);
- new_ptr = (duk_catcher *) DUK_REALLOC_INDIRECT(thr->heap, duk_hthread_get_catchstack_ptr, (void *) thr, sizeof(duk_catcher) * new_size);
- if (!new_ptr) {
- /* No need for a NULL/zero-size check because new_size > 0) */
- DUK_ERROR_ALLOC_DEFMSG(thr);
- }
- thr->catchstack = new_ptr;
- thr->catchstack_size = new_size;
-
- /* note: any entries above the catchstack top are garbage and not zeroed */
-}
-
-DUK_INTERNAL void duk_hthread_catchstack_shrink_check(duk_hthread *thr) {
- duk_size_t new_size;
- duk_catcher *p;
-
- DUK_ASSERT(thr != NULL);
- DUK_ASSERT_DISABLE(thr->catchstack_top >= 0); /* avoid warning (unsigned) */
- DUK_ASSERT(thr->catchstack_size >= thr->catchstack_top);
-
- if (thr->catchstack_size - thr->catchstack_top < DUK_CATCHSTACK_SHRINK_THRESHOLD) {
- return;
- }
-
- new_size = thr->catchstack_top + DUK_CATCHSTACK_SHRINK_SPARE;
- DUK_ASSERT(new_size >= thr->catchstack_top);
-
- DUK_DD(DUK_DDPRINT("shrinking catchstack %ld -> %ld", (long) thr->catchstack_size, (long) new_size));
-
- /*
- * Note: must use indirect variant of DUK_REALLOC() because underlying
- * pointer may be changed by mark-and-sweep.
- */
-
- /* shrink failure is not fatal */
- p = (duk_catcher *) DUK_REALLOC_INDIRECT(thr->heap, duk_hthread_get_catchstack_ptr, (void *) thr, sizeof(duk_catcher) * new_size);
- if (p) {
- thr->catchstack = p;
- thr->catchstack_size = new_size;
- } else {
- /* Because new_size != 0, if condition doesn't need to be
- * (p != NULL || new_size == 0).
- */
- DUK_ASSERT(new_size != 0);
- DUK_D(DUK_DPRINT("catchstack shrink failed, ignoring"));
- }
-
- /* note: any entries above the catchstack top are garbage and not zeroed */
-}
-
-DUK_INTERNAL void duk_hthread_catchstack_unwind(duk_hthread *thr, duk_size_t new_top) {
- duk_size_t idx;
-
- DUK_DDD(DUK_DDDPRINT("unwind catchstack top of thread %p from %ld to %ld",
- (void *) thr,
- (thr != NULL ? (long) thr->catchstack_top : (long) -1),
- (long) new_top));
-
- DUK_ASSERT(thr);
- DUK_ASSERT(thr->heap);
- DUK_ASSERT_DISABLE(new_top >= 0); /* unsigned */
- DUK_ASSERT((duk_size_t) new_top <= thr->catchstack_top); /* cannot grow */
-
- /*
- * Since there are no references in the catcher structure,
- * unwinding is quite simple. The only thing we need to
- * look out for is popping a possible lexical environment
- * established for an active catch clause.
- */
-
- idx = thr->catchstack_top;
- while (idx > new_top) {
- duk_catcher *p;
- duk_activation *act;
- duk_hobject *env;
-
- idx--;
- DUK_ASSERT_DISABLE(idx >= 0); /* unsigned */
- DUK_ASSERT((duk_size_t) idx < thr->catchstack_size);
-
- p = thr->catchstack + idx;
-
- if (DUK_CAT_HAS_LEXENV_ACTIVE(p)) {
- DUK_DDD(DUK_DDDPRINT("unwinding catchstack idx %ld, callstack idx %ld, callstack top %ld: lexical environment active",
- (long) idx, (long) p->callstack_index, (long) thr->callstack_top));
-
- /* XXX: Here we have a nasty dependency: the need to manipulate
- * the callstack means that catchstack must always be unwound by
- * the caller before unwinding the callstack. This should be fixed
- * later.
- */
-
- /* Note that multiple catchstack entries may refer to the same
- * callstack entry.
- */
- act = thr->callstack + p->callstack_index;
- DUK_ASSERT(act >= thr->callstack);
- DUK_ASSERT(act < thr->callstack + thr->callstack_top);
-
- DUK_DDD(DUK_DDDPRINT("catchstack_index=%ld, callstack_index=%ld, lex_env=%!iO",
- (long) idx, (long) p->callstack_index,
- (duk_heaphdr *) act->lex_env));
-
- env = act->lex_env; /* current lex_env of the activation (created for catcher) */
- DUK_ASSERT(env != NULL); /* must be, since env was created when catcher was created */
- act->lex_env = DUK_HOBJECT_GET_PROTOTYPE(thr->heap, env); /* prototype is lex_env before catcher created */
- DUK_HOBJECT_DECREF(thr, env);
-
- /* There is no need to decref anything else than 'env': if 'env'
- * becomes unreachable, refzero will handle decref'ing its prototype.
- */
- }
- }
-
- thr->catchstack_top = new_top;
-
- /* note: any entries above the catchstack top are garbage and not zeroed */
-}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/ede68a10/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_initjs_min.js
----------------------------------------------------------------------
diff --git a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_initjs_min.js b/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_initjs_min.js
deleted file mode 100644
index d3a9143..0000000
--- a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_initjs_min.js
+++ /dev/null
@@ -1 +0,0 @@
-(function(d,a){function b(a,b,c){Object.defineProperty(a,b,{value:c,writable:!0,enumerable:!1,configurable:!0})}b(a.Logger,"clog",new a.Logger("C"));b(a,"modLoaded",Object.create(null))})(this,Duktape);
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/ede68a10/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_internal.h
----------------------------------------------------------------------
diff --git a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_internal.h b/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_internal.h
deleted file mode 100644
index 7c8c7af..0000000
--- a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_internal.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Top-level include file to be used for all (internal) source files.
- *
- * Source files should not include individual header files, as they
- * have not been designed to be individually included.
- */
-
-#ifndef DUK_INTERNAL_H_INCLUDED
-#define DUK_INTERNAL_H_INCLUDED
-
-/*
- * The 'duktape.h' header provides the public API, but also handles all
- * compiler and platform specific feature detection, Duktape feature
- * resolution, inclusion of system headers, etc. These have been merged
- * because the public API is also dependent on e.g. detecting appropriate
- * C types which is quite platform/compiler specific especially for a non-C99
- * build. The public API is also dependent on the resolved feature set.
- *
- * Some actions taken by the merged header (such as including system headers)
- * are not appropriate for building a user application. The define
- * DUK_COMPILING_DUKTAPE allows the merged header to skip/include some
- * sections depending on what is being built.
- */
-
-#define DUK_COMPILING_DUKTAPE
-#include "duktape.h"
-
-/*
- * User declarations, e.g. prototypes for user functions used by Duktape
- * macros. Concretely, if DUK_USE_PANIC_HANDLER is used and the macro
- * value calls a user function, it needs to be declared for Duktape
- * compilation to avoid warnings.
- */
-
-DUK_USE_USER_DECLARE()
-
-/*
- * Duktape includes (other than duk_features.h)
- *
- * The header files expect to be included in an order which satisfies header
- * dependencies correctly (the headers themselves don't include any other
- * includes). Forward declarations are used to break circular struct/typedef
- * dependencies.
- */
-
-#include "duk_replacements.h"
-#include "duk_jmpbuf.h"
-#include "duk_exception.h"
-#include "duk_forwdecl.h"
-#include "duk_tval.h" /* builtins need e.g. duk_tval tag definitions */
-#include "duk_builtins.h" /* autogenerated: strings and built-in object init data */
-
-#include "duk_util.h"
-#include "duk_strings.h"
-#include "duk_js_bytecode.h"
-#include "duk_lexer.h"
-#include "duk_js_compiler.h"
-#include "duk_regexp.h"
-#include "duk_heaphdr.h"
-#include "duk_api_internal.h"
-#include "duk_hstring.h"
-#include "duk_hobject.h"
-#include "duk_hcompiledfunction.h"
-#include "duk_hnativefunction.h"
-#include "duk_hbufferobject.h"
-#include "duk_hthread.h"
-#include "duk_hbuffer.h"
-#include "duk_heap.h"
-#include "duk_debugger.h"
-#include "duk_debug.h"
-#include "duk_error.h"
-#include "duk_unicode.h"
-#include "duk_json.h"
-#include "duk_js.h"
-#include "duk_numconv.h"
-#include "duk_bi_protos.h"
-#include "duk_selftest.h"
-
-#endif /* DUK_INTERNAL_H_INCLUDED */
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/ede68a10/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_jmpbuf.h
----------------------------------------------------------------------
diff --git a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_jmpbuf.h b/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_jmpbuf.h
deleted file mode 100644
index c8774c5..0000000
--- a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_jmpbuf.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Wrapper for jmp_buf.
- *
- * This is used because jmp_buf is an array type for backward compatibility.
- * Wrapping jmp_buf in a struct makes pointer references, sizeof, etc,
- * behave more intuitively.
- *
- * http://en.wikipedia.org/wiki/Setjmp.h#Member_types
- */
-
-#ifndef DUK_JMPBUF_H_INCLUDED
-#define DUK_JMPBUF_H_INCLUDED
-
-#if defined(DUK_USE_CPP_EXCEPTIONS)
-struct duk_jmpbuf {
- duk_small_int_t dummy; /* unused */
-};
-#else
-struct duk_jmpbuf {
- DUK_JMPBUF_TYPE jb;
-};
-#endif
-
-#endif /* DUK_JMPBUF_H_INCLUDED */