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:14 UTC
[19/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_debugger.h
----------------------------------------------------------------------
diff --git a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_debugger.h b/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_debugger.h
deleted file mode 100644
index f79557b..0000000
--- a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_debugger.h
+++ /dev/null
@@ -1,144 +0,0 @@
-#ifndef DUK_DEBUGGER_H_INCLUDED
-#define DUK_DEBUGGER_H_INCLUDED
-
-/* Debugger protocol version is defined in the public API header. */
-
-/* Initial bytes for markers. */
-#define DUK_DBG_IB_EOM 0x00
-#define DUK_DBG_IB_REQUEST 0x01
-#define DUK_DBG_IB_REPLY 0x02
-#define DUK_DBG_IB_ERROR 0x03
-#define DUK_DBG_IB_NOTIFY 0x04
-
-/* Other initial bytes. */
-#define DUK_DBG_IB_INT4 0x10
-#define DUK_DBG_IB_STR4 0x11
-#define DUK_DBG_IB_STR2 0x12
-#define DUK_DBG_IB_BUF4 0x13
-#define DUK_DBG_IB_BUF2 0x14
-#define DUK_DBG_IB_UNUSED 0x15
-#define DUK_DBG_IB_UNDEFINED 0x16
-#define DUK_DBG_IB_NULL 0x17
-#define DUK_DBG_IB_TRUE 0x18
-#define DUK_DBG_IB_FALSE 0x19
-#define DUK_DBG_IB_NUMBER 0x1a
-#define DUK_DBG_IB_OBJECT 0x1b
-#define DUK_DBG_IB_POINTER 0x1c
-#define DUK_DBG_IB_LIGHTFUNC 0x1d
-#define DUK_DBG_IB_HEAPPTR 0x1e
-/* The short string/integer initial bytes starting from 0x60 don't have
- * defines now.
- */
-
-/* Error codes. */
-#define DUK_DBG_ERR_UNKNOWN 0x00
-#define DUK_DBG_ERR_UNSUPPORTED 0x01
-#define DUK_DBG_ERR_TOOMANY 0x02
-#define DUK_DBG_ERR_NOTFOUND 0x03
-#define DUK_DBG_ERR_APPLICATION 0x04
-
-/* Commands and notifys initiated by Duktape. */
-#define DUK_DBG_CMD_STATUS 0x01
-#define DUK_DBG_CMD_PRINT 0x02
-#define DUK_DBG_CMD_ALERT 0x03
-#define DUK_DBG_CMD_LOG 0x04
-#define DUK_DBG_CMD_THROW 0x05
-#define DUK_DBG_CMD_DETACHING 0x06
-#define DUK_DBG_CMD_APPNOTIFY 0x07
-
-/* Commands initiated by debug client. */
-#define DUK_DBG_CMD_BASICINFO 0x10
-#define DUK_DBG_CMD_TRIGGERSTATUS 0x11
-#define DUK_DBG_CMD_PAUSE 0x12
-#define DUK_DBG_CMD_RESUME 0x13
-#define DUK_DBG_CMD_STEPINTO 0x14
-#define DUK_DBG_CMD_STEPOVER 0x15
-#define DUK_DBG_CMD_STEPOUT 0x16
-#define DUK_DBG_CMD_LISTBREAK 0x17
-#define DUK_DBG_CMD_ADDBREAK 0x18
-#define DUK_DBG_CMD_DELBREAK 0x19
-#define DUK_DBG_CMD_GETVAR 0x1a
-#define DUK_DBG_CMD_PUTVAR 0x1b
-#define DUK_DBG_CMD_GETCALLSTACK 0x1c
-#define DUK_DBG_CMD_GETLOCALS 0x1d
-#define DUK_DBG_CMD_EVAL 0x1e
-#define DUK_DBG_CMD_DETACH 0x1f
-#define DUK_DBG_CMD_DUMPHEAP 0x20
-#define DUK_DBG_CMD_GETBYTECODE 0x21
-#define DUK_DBG_CMD_APPREQUEST 0x22
-#define DUK_DBG_CMD_GETHEAPOBJINFO 0x23
-#define DUK_DBG_CMD_GETOBJPROPDESC 0x24
-#define DUK_DBG_CMD_GETOBJPROPDESCRANGE 0x25
-
-/* The low 8 bits map directly to duk_hobject.h DUK_PROPDESC_FLAG_xxx.
- * The remaining flags are specific to the debugger.
- */
-#define DUK_DBG_PROPFLAG_INTERNAL (1 << 8)
-
-#if defined(DUK_USE_DEBUGGER_SUPPORT)
-DUK_INTERNAL_DECL void duk_debug_do_detach(duk_heap *heap);
-
-DUK_INTERNAL_DECL duk_bool_t duk_debug_read_peek(duk_hthread *thr);
-DUK_INTERNAL_DECL void duk_debug_write_flush(duk_hthread *thr);
-
-DUK_INTERNAL_DECL void duk_debug_skip_bytes(duk_hthread *thr, duk_size_t length);
-DUK_INTERNAL_DECL void duk_debug_skip_byte(duk_hthread *thr);
-
-DUK_INTERNAL_DECL void duk_debug_read_bytes(duk_hthread *thr, duk_uint8_t *data, duk_size_t length);
-DUK_INTERNAL_DECL duk_uint8_t duk_debug_read_byte(duk_hthread *thr);
-DUK_INTERNAL_DECL duk_int32_t duk_debug_read_int(duk_hthread *thr);
-DUK_INTERNAL_DECL duk_hstring *duk_debug_read_hstring(duk_hthread *thr);
-/* XXX: exposed duk_debug_read_pointer */
-/* XXX: exposed duk_debug_read_buffer */
-/* XXX: exposed duk_debug_read_hbuffer */
-#if 0
-DUK_INTERNAL_DECL duk_heaphdr *duk_debug_read_heapptr(duk_hthread *thr);
-#endif
-#if defined(DUK_USE_DEBUGGER_INSPECT)
-DUK_INTERNAL_DECL duk_heaphdr *duk_debug_read_any_ptr(duk_hthread *thr);
-#endif
-DUK_INTERNAL_DECL duk_tval *duk_debug_read_tval(duk_hthread *thr);
-
-DUK_INTERNAL_DECL void duk_debug_write_bytes(duk_hthread *thr, const duk_uint8_t *data, duk_size_t length);
-DUK_INTERNAL_DECL void duk_debug_write_byte(duk_hthread *thr, duk_uint8_t x);
-DUK_INTERNAL_DECL void duk_debug_write_unused(duk_hthread *thr);
-DUK_INTERNAL_DECL void duk_debug_write_undefined(duk_hthread *thr);
-#if defined(DUK_USE_DEBUGGER_INSPECT)
-DUK_INTERNAL_DECL void duk_debug_write_null(duk_hthread *thr);
-#endif
-DUK_INTERNAL_DECL void duk_debug_write_boolean(duk_hthread *thr, duk_uint_t val);
-DUK_INTERNAL_DECL void duk_debug_write_int(duk_hthread *thr, duk_int32_t x);
-DUK_INTERNAL_DECL void duk_debug_write_uint(duk_hthread *thr, duk_uint32_t x);
-DUK_INTERNAL_DECL void duk_debug_write_string(duk_hthread *thr, const char *data, duk_size_t length);
-DUK_INTERNAL_DECL void duk_debug_write_cstring(duk_hthread *thr, const char *data);
-DUK_INTERNAL_DECL void duk_debug_write_hstring(duk_hthread *thr, duk_hstring *h);
-DUK_INTERNAL_DECL void duk_debug_write_buffer(duk_hthread *thr, const char *data, duk_size_t length);
-DUK_INTERNAL_DECL void duk_debug_write_hbuffer(duk_hthread *thr, duk_hbuffer *h);
-DUK_INTERNAL_DECL void duk_debug_write_pointer(duk_hthread *thr, void *ptr);
-#if defined(DUK_USE_DEBUGGER_DUMPHEAP) || defined(DUK_USE_DEBUGGER_INSPECT)
-DUK_INTERNAL_DECL void duk_debug_write_heapptr(duk_hthread *thr, duk_heaphdr *h);
-#endif
-DUK_INTERNAL_DECL void duk_debug_write_hobject(duk_hthread *thr, duk_hobject *obj);
-DUK_INTERNAL_DECL void duk_debug_write_tval(duk_hthread *thr, duk_tval *tv);
-#if 0 /* unused */
-DUK_INTERNAL_DECL void duk_debug_write_request(duk_hthread *thr, duk_small_uint_t command);
-#endif
-DUK_INTERNAL_DECL void duk_debug_write_reply(duk_hthread *thr);
-DUK_INTERNAL_DECL void duk_debug_write_error_eom(duk_hthread *thr, duk_small_uint_t err_code, const char *msg);
-DUK_INTERNAL_DECL void duk_debug_write_notify(duk_hthread *thr, duk_small_uint_t command);
-DUK_INTERNAL_DECL void duk_debug_write_eom(duk_hthread *thr);
-
-DUK_INTERNAL_DECL duk_uint_fast32_t duk_debug_curr_line(duk_hthread *thr);
-DUK_INTERNAL_DECL void duk_debug_send_status(duk_hthread *thr);
-#if defined(DUK_USE_DEBUGGER_THROW_NOTIFY)
-DUK_INTERNAL_DECL void duk_debug_send_throw(duk_hthread *thr, duk_bool_t fatal);
-#endif
-
-DUK_INTERNAL_DECL void duk_debug_halt_execution(duk_hthread *thr, duk_bool_t use_prev_pc);
-DUK_INTERNAL_DECL duk_bool_t duk_debug_process_messages(duk_hthread *thr, duk_bool_t no_block);
-
-DUK_INTERNAL_DECL duk_small_int_t duk_debug_add_breakpoint(duk_hthread *thr, duk_hstring *filename, duk_uint32_t line);
-DUK_INTERNAL_DECL duk_bool_t duk_debug_remove_breakpoint(duk_hthread *thr, duk_small_uint_t breakpoint_index);
-#endif
-
-#endif /* DUK_DEBUGGER_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_error.h
----------------------------------------------------------------------
diff --git a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_error.h b/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_error.h
deleted file mode 100644
index 2b00a78..0000000
--- a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_error.h
+++ /dev/null
@@ -1,439 +0,0 @@
-/*
- * Error handling macros, assertion macro, error codes.
- *
- * There are three level of 'errors':
- *
- * 1. Ordinary errors, relative to a thread, cause a longjmp, catchable.
- * 2. Fatal errors, relative to a heap, cause fatal handler to be called.
- * 3. Panic errors, unrelated to a heap and cause a process exit.
- *
- * Panics are used by the default fatal error handler and by debug code
- * such as assertions. By providing a proper fatal error handler, user
- * code can avoid panics in non-debug builds.
- */
-
-#ifndef DUK_ERROR_H_INCLUDED
-#define DUK_ERROR_H_INCLUDED
-
-/*
- * Error codes: defined in duktape.h
- *
- * Error codes are used as a shorthand to throw exceptions from inside
- * the implementation. The appropriate Ecmascript object is constructed
- * based on the code. Ecmascript code throws objects directly. The error
- * codes are defined in the public API header because they are also used
- * by calling code.
- */
-
-/*
- * Normal error
- *
- * Normal error is thrown with a longjmp() through the current setjmp()
- * catchpoint record in the duk_heap. The 'curr_thread' of the duk_heap
- * identifies the throwing thread.
- *
- * Error formatting is usually unnecessary. The error macros provide a
- * zero argument version (no formatting) and separate macros for small
- * argument counts. Variadic macros are not used to avoid portability
- * issues and avoid the need for stash-based workarounds when they're not
- * available. Vararg calls are avoided for non-formatted error calls
- * because vararg call sites are larger than normal, and there are a lot
- * of call sites with no formatting.
- *
- * Note that special formatting provided by debug macros is NOT available.
- *
- * The _RAW variants allow the caller to specify file and line. This makes
- * it easier to write checked calls which want to use the call site of the
- * checked function, not the error macro call inside the checked function.
- */
-
-#if defined(DUK_USE_VERBOSE_ERRORS)
-
-/* Because there are quite many call sites, pack error code (require at most
- * 8-bit) into a single argument.
- */
-#define DUK_ERROR(thr,err,msg) do { \
- duk_errcode_t duk__err = (err); duk_int_t duk__line = (duk_int_t) DUK_LINE_MACRO; \
- DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
- duk_err_handle_error((thr), DUK_FILE_MACRO, (((duk_uint_t) duk__err) << 24) | ((duk_uint_t) duk__line), (msg)); \
- } while (0)
-#define DUK_ERROR_RAW(thr,file,line,err,msg) do { \
- duk_errcode_t duk__err = (err); duk_int_t duk__line = (duk_int_t) (line); \
- DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
- duk_err_handle_error((thr), (file), (((duk_uint_t) duk__err) << 24) | ((duk_uint_t) duk__line), (msg)); \
- } while (0)
-
-#define DUK_ERROR_FMT1(thr,err,fmt,arg1) do { \
- duk_errcode_t duk__err = (err); duk_int_t duk__line = (duk_int_t) DUK_LINE_MACRO; \
- DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
- duk_err_handle_error_fmt((thr), DUK_FILE_MACRO, (((duk_uint_t) duk__err) << 24) | ((duk_uint_t) duk__line), (fmt), (arg1)); \
- } while (0)
-#define DUK_ERROR_RAW_FMT1(thr,file,line,err,fmt,arg1) do { \
- duk_errcode_t duk__err = (err); duk_int_t duk__line = (duk_int_t) (line); \
- DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
- duk_err_handle_error_fmt((thr), (file), (((duk_uint_t) duk__err) << 24) | ((duk_uint_t) duk__line), (fmt), (arg1)); \
- } while (0)
-
-#define DUK_ERROR_FMT2(thr,err,fmt,arg1,arg2) do { \
- duk_errcode_t duk__err = (err); duk_int_t duk__line = (duk_int_t) DUK_LINE_MACRO; \
- DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
- duk_err_handle_error_fmt((thr), DUK_FILE_MACRO, (((duk_uint_t) duk__err) << 24) | ((duk_uint_t) duk__line), (fmt), (arg1), (arg2)); \
- } while (0)
-#define DUK_ERROR_RAW_FMT2(thr,file,line,err,fmt,arg1,arg2) do { \
- duk_errcode_t duk__err = (err); duk_int_t duk__line = (duk_int_t) (line); \
- DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
- duk_err_handle_error_fmt((thr), (file), (((duk_uint_t) duk__err) << 24) | ((duk_uint_t) duk__line), (fmt), (arg1), (arg2)); \
- } while (0)
-
-#define DUK_ERROR_FMT3(thr,err,fmt,arg1,arg2,arg3) do { \
- duk_errcode_t duk__err = (err); duk_int_t duk__line = (duk_int_t) DUK_LINE_MACRO; \
- DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
- duk_err_handle_error_fmt((thr), DUK_FILE_MACRO, (((duk_uint_t) duk__err) << 24) | ((duk_uint_t) duk__line), (fmt), (arg1), (arg2), (arg3)); \
- } while (0)
-#define DUK_ERROR_RAW_FMT3(thr,file,line,err,fmt,arg1,arg2,arg3) do { \
- duk_errcode_t duk__err = (err); duk_int_t duk__line = (duk_int_t) (line); \
- DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
- duk_err_handle_error_fmt((thr), (file), (((duk_uint_t) duk__err) << 24) | ((duk_uint_t) duk__line), (fmt), (arg1), (arg2), (arg3)); \
- } while (0)
-
-#define DUK_ERROR_FMT4(thr,err,fmt,arg1,arg2,arg3,arg4) do { \
- duk_errcode_t duk__err = (err); duk_int_t duk__line = (duk_int_t) DUK_LINE_MACRO; \
- DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
- duk_err_handle_error_fmt((thr), DUK_FILE_MACRO, (((duk_uint_t) duk__err) << 24) | ((duk_uint_t) duk__line), (fmt), (arg1), (arg2), (arg3), (arg4)); \
- } while (0)
-#define DUK_ERROR_RAW_FMT4(thr,file,line,err,fmt,arg1,arg2,arg3,arg4) do { \
- duk_errcode_t duk__err = (err); duk_int_t duk__line = (duk_int_t) (line); \
- DUK_ASSERT(duk__err >= 0 && duk__err <= 0xff); DUK_ASSERT(duk__line >= 0 && duk__line <= 0x00ffffffL); \
- duk_err_handle_error_fmt((thr), (file), (((duk_uint_t) duk__err) << 24) | ((duk_uint_t) duk__line), (fmt), (arg1), (arg2), (arg3), (arg4)); \
- } while (0)
-
-#else /* DUK_USE_VERBOSE_ERRORS */
-
-#define DUK_ERROR(thr,err,msg) duk_err_handle_error((thr), (err))
-#define DUK_ERROR_RAW(thr,file,line,err,msg) duk_err_handle_error((thr), (err))
-
-#define DUK_ERROR_FMT1(thr,err,fmt,arg1) DUK_ERROR((thr),(err),(fmt))
-#define DUK_ERROR_RAW_FMT1(thr,file,line,err,fmt,arg1) DUK_ERROR_RAW((thr),(file),(line),(err),(fmt))
-
-#define DUK_ERROR_FMT2(thr,err,fmt,arg1,arg2) DUK_ERROR((thr),(err),(fmt))
-#define DUK_ERROR_RAW_FMT2(thr,file,line,err,fmt,arg1,arg2) DUK_ERROR_RAW((thr),(file),(line),(err),(fmt))
-
-#define DUK_ERROR_FMT3(thr,err,fmt,arg1,arg2,arg3) DUK_ERROR((thr),(err),(fmt))
-#define DUK_ERROR_RAW_FMT3(thr,file,line,err,fmt,arg1,arg2,arg3) DUK_ERROR_RAW((thr),(file),(line),(err),(fmt))
-
-#define DUK_ERROR_FMT4(thr,err,fmt,arg1,arg2,arg3,arg4) DUK_ERROR((thr),(err),(fmt))
-#define DUK_ERROR_RAW_FMT4(thr,file,line,err,fmt,arg1,arg2,arg3,arg4) DUK_ERROR_RAW((thr),(file),(line),(err),(fmt))
-
-#endif /* DUK_USE_VERBOSE_ERRORS */
-
-/*
- * Fatal error
- *
- * There are no fatal error macros at the moment. There are so few call
- * sites that the fatal error handler is called directly.
- */
-
-/*
- * Panic error
- *
- * Panic errors are not relative to either a heap or a thread, and cause
- * DUK_PANIC() macro to be invoked. Unless a user provides DUK_USE_PANIC_HANDLER,
- * DUK_PANIC() calls a helper which prints out the error and causes a process
- * exit.
- *
- * The user can override the macro to provide custom handling. A macro is
- * used to allow the user to have inline panic handling if desired (without
- * causing a potentially risky function call).
- *
- * Panics are only used in debug code such as assertions, and by the default
- * fatal error handler.
- */
-
-#if defined(DUK_USE_PANIC_HANDLER)
-/* already defined, good */
-#define DUK_PANIC(code,msg) DUK_USE_PANIC_HANDLER((code),(msg))
-#else
-#define DUK_PANIC(code,msg) duk_default_panic_handler((code),(msg))
-#endif /* DUK_USE_PANIC_HANDLER */
-
-/*
- * Assert macro: failure causes panic.
- */
-
-#if defined(DUK_USE_ASSERTIONS)
-
-/* the message should be a compile time constant without formatting (less risk);
- * we don't care about assertion text size because they're not used in production
- * builds.
- */
-#define DUK_ASSERT(x) do { \
- if (!(x)) { \
- DUK_PANIC(DUK_ERR_ASSERTION_ERROR, \
- "assertion failed: " #x \
- " (" DUK_FILE_MACRO ":" DUK_MACRO_STRINGIFY(DUK_LINE_MACRO) ")"); \
- } \
- } while (0)
-
-/* Assertion compatible inside a comma expression, evaluates to void.
- * Currently not compatible with DUK_USE_PANIC_HANDLER() which may have
- * a statement block.
- */
-#if defined(DUK_USE_PANIC_HANDLER)
-/* XXX: resolve macro definition issue or call through a helper function? */
-#define DUK_ASSERT_EXPR(x) ((void) 0)
-#else
-#define DUK_ASSERT_EXPR(x) \
- ((void) ((x) ? 0 : (DUK_PANIC(DUK_ERR_ASSERTION_ERROR, \
- "assertion failed: " #x \
- " (" DUK_FILE_MACRO ":" DUK_MACRO_STRINGIFY(DUK_LINE_MACRO) ")"), 0)))
-#endif
-
-#else /* DUK_USE_ASSERTIONS */
-
-#define DUK_ASSERT(x) do { /* assertion omitted */ } while (0)
-
-#define DUK_ASSERT_EXPR(x) ((void) 0)
-
-#endif /* DUK_USE_ASSERTIONS */
-
-/* this variant is used when an assert would generate a compile warning by
- * being always true (e.g. >= 0 comparison for an unsigned value
- */
-#define DUK_ASSERT_DISABLE(x) do { /* assertion disabled */ } while (0)
-
-/*
- * Assertion helpers
- */
-
-#if defined(DUK_USE_ASSERTIONS) && defined(DUK_USE_REFERENCE_COUNTING)
-#define DUK_ASSERT_REFCOUNT_NONZERO_HEAPHDR(h) do { \
- DUK_ASSERT((h) == NULL || DUK_HEAPHDR_GET_REFCOUNT((duk_heaphdr *) (h)) > 0); \
- } while (0)
-#define DUK_ASSERT_REFCOUNT_NONZERO_TVAL(tv) do { \
- if ((tv) != NULL && DUK_TVAL_IS_HEAP_ALLOCATED((tv))) { \
- DUK_ASSERT(DUK_HEAPHDR_GET_REFCOUNT(DUK_TVAL_GET_HEAPHDR((tv))) > 0); \
- } \
- } while (0)
-#else
-#define DUK_ASSERT_REFCOUNT_NONZERO_HEAPHDR(h) /* no refcount check */
-#define DUK_ASSERT_REFCOUNT_NONZERO_TVAL(tv) /* no refcount check */
-#endif
-
-#define DUK_ASSERT_TOP(ctx,n) DUK_ASSERT((duk_idx_t) duk_get_top((ctx)) == (duk_idx_t) (n))
-
-#if defined(DUK_USE_ASSERTIONS) && defined(DUK_USE_PACKED_TVAL)
-#define DUK_ASSERT_DOUBLE_IS_NORMALIZED(dval) do { \
- duk_double_union duk__assert_tmp_du; \
- duk__assert_tmp_du.d = (dval); \
- DUK_ASSERT(DUK_DBLUNION_IS_NORMALIZED(&duk__assert_tmp_du)); \
- } while (0)
-#else
-#define DUK_ASSERT_DOUBLE_IS_NORMALIZED(dval) /* nop */
-#endif
-
-/*
- * Helper for valstack space
- *
- * Caller of DUK_ASSERT_VALSTACK_SPACE() estimates the number of free stack entries
- * required for its own use, and any child calls which are not (a) Duktape API calls
- * or (b) Duktape calls which involve extending the valstack (e.g. getter call).
- */
-
-#define DUK_VALSTACK_ASSERT_EXTRA 5 /* this is added to checks to allow for Duktape
- * API calls in addition to function's own use
- */
-#if defined(DUK_USE_ASSERTIONS)
-#define DUK_ASSERT_VALSTACK_SPACE(thr,n) do { \
- DUK_ASSERT((thr) != NULL); \
- DUK_ASSERT((thr)->valstack_end - (thr)->valstack_top >= (n) + DUK_VALSTACK_ASSERT_EXTRA); \
- } while (0)
-#else
-#define DUK_ASSERT_VALSTACK_SPACE(thr,n) /* no valstack space check */
-#endif
-
-/*
- * Error throwing helpers
- *
- * The goal is to provide verbose and configurable error messages. Call
- * sites should be clean in source code and compile to a small footprint.
- * Small footprint is also useful for performance because small cold paths
- * reduce code cache pressure. Adding macros here only makes sense if there
- * are enough call sites to get concrete benefits.
- */
-
-#if defined(DUK_USE_VERBOSE_ERRORS)
-/* Verbose errors with key/value summaries (non-paranoid) or without key/value
- * summaries (paranoid, for some security sensitive environments), the paranoid
- * vs. non-paranoid distinction affects only a few specific errors.
- */
-#if defined(DUK_USE_PARANOID_ERRORS)
-#define DUK_ERROR_REQUIRE_TYPE_INDEX(thr,index,expectname,lowmemstr) do { \
- duk_err_require_type_index((thr), DUK_FILE_MACRO, (duk_int_t) DUK_LINE_MACRO, (index), (expectname)); \
- } while (0)
-#else /* DUK_USE_PARANOID_ERRORS */
-#define DUK_ERROR_REQUIRE_TYPE_INDEX(thr,index,expectname,lowmemstr) do { \
- duk_err_require_type_index((thr), DUK_FILE_MACRO, (duk_int_t) DUK_LINE_MACRO, (index), (expectname)); \
- } while (0)
-#endif /* DUK_USE_PARANOID_ERRORS */
-
-#define DUK_ERROR_UNIMPLEMENTED(thr,msg) do { \
- DUK_ERROR((thr), DUK_ERR_UNIMPLEMENTED_ERROR, (msg)); \
- } while (0)
-#define DUK_ERROR_UNIMPLEMENTED_DEFMSG(thr) do { \
- duk_err_unimplemented_defmsg((thr), DUK_FILE_MACRO, (duk_int_t) DUK_LINE_MACRO); \
- } while (0)
-#define DUK_ERROR_UNSUPPORTED(thr,msg) do { \
- DUK_ERROR((thr), DUK_ERR_UNSUPPORTED_ERROR, (msg)); \
- } while (0)
-#if !defined(DUK_USE_BYTECODE_DUMP_SUPPORT)
-#define DUK_ERROR_UNSUPPORTED_DEFMSG(thr) do { \
- duk_err_unsupported_defmsg((thr), DUK_FILE_MACRO, (duk_int_t) DUK_LINE_MACRO); \
- } while (0)
-#endif
-#define DUK_ERROR_INTERNAL(thr,msg) do { \
- duk_err_internal((thr), DUK_FILE_MACRO, (duk_int_t) DUK_LINE_MACRO, (msg)); \
- } while (0)
-#define DUK_ERROR_INTERNAL_DEFMSG(thr) do { \
- duk_err_internal_defmsg((thr), DUK_FILE_MACRO, (duk_int_t) DUK_LINE_MACRO); \
- } while (0)
-#define DUK_ERROR_ALLOC(thr,msg) do { \
- duk_err_alloc((thr), DUK_FILE_MACRO, (duk_int_t) DUK_LINE_MACRO, (msg)); \
- } while (0)
-#define DUK_ERROR_ALLOC_DEFMSG(thr) do { \
- DUK_ERROR_ALLOC((thr), DUK_STR_ALLOC_FAILED); \
- } while (0)
-/* DUK_ERR_ASSERTION_ERROR: no macros needed */
-#define DUK_ERROR_API_INDEX(thr,index) do { \
- duk_err_api_index((thr), DUK_FILE_MACRO, (duk_int_t) DUK_LINE_MACRO, (index)); \
- } while (0)
-#define DUK_ERROR_API(thr,msg) do { \
- duk_err_api((thr), DUK_FILE_MACRO, (duk_int_t) DUK_LINE_MACRO, (msg)); \
- } while (0)
-/* DUK_ERR_UNCAUGHT_ERROR: no macros needed */
-/* DUK_ERR_ERROR: no macros needed */
-/* DUK_ERR_EVAL: no macros needed */
-#define DUK_ERROR_RANGE(thr,msg) do { \
- duk_err_range((thr), DUK_FILE_MACRO, (duk_int_t) DUK_LINE_MACRO, (msg)); \
- } while (0)
-/* DUK_ERR_REFERENCE_ERROR: no macros needed */
-#define DUK_ERROR_SYNTAX(thr,msg) do { \
- DUK_ERROR((thr), DUK_ERR_SYNTAX_ERROR, (msg)); \
- } while (0)
-#define DUK_ERROR_TYPE(thr,msg) do { \
- DUK_ERROR((thr), DUK_ERR_TYPE_ERROR, (msg)); \
- } while (0)
-/* DUK_ERR_URI_ERROR: no macros needed */
-#else /* DUK_USE_VERBOSE_ERRORS */
-/* Non-verbose errors for low memory targets: no file, line, or message. */
-
-#define DUK_ERROR_REQUIRE_TYPE_INDEX(thr,index,expectname,lowmemstr) do { \
- duk_err_type((thr)); \
- } while (0)
-
-#define DUK_ERROR_UNIMPLEMENTED(thr,msg) do { \
- duk_err_unimplemented((thr)); \
- } while (0)
-#define DUK_ERROR_UNIMPLEMENTED_DEFMSG(thr) do { \
- duk_err_unimplemented((thr)); \
- } while (0)
-#define DUK_ERROR_UNSUPPORTED(thr,msg) do { \
- duk_err_unsupported((thr)); \
- } while (0)
-#define DUK_ERROR_UNSUPPORTED_DEFMSG(thr) do { \
- duk_err_unsupported((thr)); \
- } while (0)
-#define DUK_ERROR_INTERNAL(thr,msg) do { \
- duk_err_internal((thr)); \
- } while (0)
-#define DUK_ERROR_INTERNAL_DEFMSG(thr) do { \
- duk_err_internal((thr)); \
- } while (0)
-#define DUK_ERROR_ALLOC(thr,msg) do { \
- duk_err_alloc((thr)); \
- } while (0)
-#define DUK_ERROR_ALLOC_DEFMSG(thr) do { \
- duk_err_alloc((thr)); \
- } while (0)
-#define DUK_ERROR_API_INDEX(thr,index) do { \
- duk_err_api((thr)); \
- } while (0)
-#define DUK_ERROR_API(thr,msg) do { \
- duk_err_api((thr)); \
- } while (0)
-#define DUK_ERROR_RANGE(thr,msg) do { \
- duk_err_range((thr)); \
- } while (0)
-#define DUK_ERROR_SYNTAX(thr,msg) do { \
- duk_err_syntax((thr)); \
- } while (0)
-#define DUK_ERROR_TYPE(thr,msg) do { \
- duk_err_type((thr)); \
- } while (0)
-#endif /* DUK_USE_VERBOSE_ERRORS */
-
-/*
- * Prototypes
- */
-
-#if defined(DUK_USE_VERBOSE_ERRORS)
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_handle_error(duk_hthread *thr, const char *filename, duk_uint_t line_and_code, const char *msg));
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_handle_error_fmt(duk_hthread *thr, const char *filename, duk_uint_t line_and_code, const char *fmt, ...));
-#else /* DUK_USE_VERBOSE_ERRORS */
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_handle_error(duk_hthread *thr, duk_errcode_t code));
-#endif /* DUK_USE_VERBOSE_ERRORS */
-
-#if defined(DUK_USE_VERBOSE_ERRORS)
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_create_and_throw(duk_hthread *thr, duk_errcode_t code, const char *msg, const char *filename, duk_int_t line));
-#else
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_create_and_throw(duk_hthread *thr, duk_errcode_t code));
-#endif
-
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_error_throw_from_negative_rc(duk_hthread *thr, duk_ret_t rc));
-
-#if defined(DUK_USE_AUGMENT_ERROR_CREATE)
-DUK_INTERNAL_DECL void duk_err_augment_error_create(duk_hthread *thr, duk_hthread *thr_callstack, const char *filename, duk_int_t line, duk_bool_t noblame_fileline);
-#endif
-#if defined(DUK_USE_AUGMENT_ERROR_THROW)
-DUK_INTERNAL_DECL void duk_err_augment_error_throw(duk_hthread *thr);
-#endif
-
-#if defined(DUK_USE_VERBOSE_ERRORS)
-#if defined(DUK_USE_PARANOID_ERRORS)
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_require_type_index(duk_hthread *thr, const char *filename, duk_int_t linenumber, duk_idx_t index, const char *expect_name));
-#else
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_require_type_index(duk_hthread *thr, const char *filename, duk_int_t linenumber, duk_idx_t index, const char *expect_name));
-#endif
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_api_index(duk_hthread *thr, const char *filename, duk_int_t linenumber, duk_idx_t index));
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_api(duk_hthread *thr, const char *filename, duk_int_t linenumber, const char *message));
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_range(duk_hthread *thr, const char *filename, duk_int_t linenumber, const char *message));
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_unimplemented_defmsg(duk_hthread *thr, const char *filename, duk_int_t linenumber));
-#if !defined(DUK_USE_BYTECODE_DUMP_SUPPORT)
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_unsupported_defmsg(duk_hthread *thr, const char *filename, duk_int_t linenumber));
-#endif
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_internal_defmsg(duk_hthread *thr, const char *filename, duk_int_t linenumber));
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_internal(duk_hthread *thr, const char *filename, duk_int_t linenumber, const char *message));
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_alloc(duk_hthread *thr, const char *filename, duk_int_t linenumber, const char *message));
-#else /* DUK_VERBOSE_ERRORS */
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_range(duk_hthread *thr));
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_syntax(duk_hthread *thr));
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_type(duk_hthread *thr));
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_api(duk_hthread *thr));
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_unimplemented(duk_hthread *thr));
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_unsupported(duk_hthread *thr));
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_internal(duk_hthread *thr));
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_alloc(duk_hthread *thr));
-#endif /* DUK_VERBOSE_ERRORS */
-
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_err_longjmp(duk_hthread *thr));
-
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_default_fatal_handler(duk_context *ctx, duk_errcode_t code, const char *msg));
-
-#if !defined(DUK_USE_PANIC_HANDLER)
-DUK_NORETURN(DUK_INTERNAL_DECL void duk_default_panic_handler(duk_errcode_t code, const char *msg));
-#endif
-
-DUK_INTERNAL_DECL void duk_err_setup_heap_ljstate(duk_hthread *thr, duk_small_int_t lj_type);
-
-DUK_INTERNAL_DECL duk_hobject *duk_error_prototype_from_code(duk_hthread *thr, duk_errcode_t err_code);
-
-#endif /* DUK_ERROR_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_error_augment.c
----------------------------------------------------------------------
diff --git a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_error_augment.c b/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_error_augment.c
deleted file mode 100644
index ea15690..0000000
--- a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_error_augment.c
+++ /dev/null
@@ -1,567 +0,0 @@
-/*
- * Augmenting errors at their creation site and their throw site.
- *
- * When errors are created, traceback data is added by built-in code
- * and a user error handler (if defined) can process or replace the
- * error. Similarly, when errors are thrown, a user error handler
- * (if defined) can process or replace the error.
- *
- * Augmentation and other processing at error creation time is nice
- * because an error is only created once, but it may be thrown and
- * rethrown multiple times. User error handler registered for processing
- * an error at its throw site must be careful to handle rethrowing in
- * a useful manner.
- *
- * Error augmentation may throw an internal error (e.g. alloc error).
- *
- * Ecmascript allows throwing any values, so all values cannot be
- * augmented. Currently, the built-in augmentation at error creation
- * only augments error values which are Error instances (= have the
- * built-in Error.prototype in their prototype chain) and are also
- * extensible. User error handlers have no limitations in this respect.
- */
-
-#include "duk_internal.h"
-
-/*
- * Helper for calling a user error handler.
- *
- * 'thr' must be the currently active thread; the error handler is called
- * in its context. The valstack of 'thr' must have the error value on
- * top, and will be replaced by another error value based on the return
- * value of the error handler.
- *
- * The helper calls duk_handle_call() recursively in protected mode.
- * Before that call happens, no longjmps should happen; as a consequence,
- * we must assume that the valstack contains enough temporary space for
- * arguments and such.
- *
- * While the error handler runs, any errors thrown will not trigger a
- * recursive error handler call (this is implemented using a heap level
- * flag which will "follow" through any coroutines resumed inside the
- * error handler). If the error handler is not callable or throws an
- * error, the resulting error replaces the original error (for Duktape
- * internal errors, duk_error_throw.c further substitutes this error with
- * a DoubleError which is not ideal). This would be easy to change and
- * even signal to the caller.
- *
- * The user error handler is stored in 'Duktape.errCreate' or
- * 'Duktape.errThrow' depending on whether we're augmenting the error at
- * creation or throw time. There are several alternatives to this approach,
- * see doc/error-objects.rst for discussion.
- *
- * Note: since further longjmp()s may occur while calling the error handler
- * (for many reasons, e.g. a labeled 'break' inside the handler), the
- * caller can make no assumptions on the thr->heap->lj state after the
- * call (this affects especially duk_error_throw.c). This is not an issue
- * as long as the caller writes to the lj state only after the error handler
- * finishes.
- */
-
-#if defined(DUK_USE_ERRTHROW) || defined(DUK_USE_ERRCREATE)
-DUK_LOCAL void duk__err_augment_user(duk_hthread *thr, duk_small_uint_t stridx_cb) {
- duk_context *ctx = (duk_context *) thr;
- duk_tval *tv_hnd;
- duk_small_uint_t call_flags;
- duk_int_t rc;
-
- DUK_ASSERT(thr != NULL);
- DUK_ASSERT(thr->heap != NULL);
- DUK_ASSERT_DISABLE(stridx_cb >= 0); /* unsigned */
- DUK_ASSERT(stridx_cb < DUK_HEAP_NUM_STRINGS);
-
- if (DUK_HEAP_HAS_ERRHANDLER_RUNNING(thr->heap)) {
- DUK_DD(DUK_DDPRINT("recursive call to error handler, ignore"));
- return;
- }
-
- /*
- * Check whether or not we have an error handler.
- *
- * We must be careful of not triggering an error when looking up the
- * property. For instance, if the property is a getter, we don't want
- * to call it, only plain values are allowed. The value, if it exists,
- * is not checked. If the value is not a function, a TypeError happens
- * when it is called and that error replaces the original one.
- */
-
- DUK_ASSERT_VALSTACK_SPACE(thr, 4); /* 3 entries actually needed below */
-
- /* [ ... errval ] */
-
- if (thr->builtins[DUK_BIDX_DUKTAPE] == NULL) {
- /* When creating built-ins, some of the built-ins may not be set
- * and we want to tolerate that when throwing errors.
- */
- DUK_DD(DUK_DDPRINT("error occurred when DUK_BIDX_DUKTAPE is NULL, ignoring"));
- return;
- }
- tv_hnd = duk_hobject_find_existing_entry_tval_ptr(thr->heap,
- thr->builtins[DUK_BIDX_DUKTAPE],
- DUK_HTHREAD_GET_STRING(thr, stridx_cb));
- if (tv_hnd == NULL) {
- DUK_DD(DUK_DDPRINT("error handler does not exist or is not a plain value: %!T",
- (duk_tval *) tv_hnd));
- return;
- }
- DUK_DDD(DUK_DDDPRINT("error handler dump (callability not checked): %!T",
- (duk_tval *) tv_hnd));
- duk_push_tval(ctx, tv_hnd);
-
- /* [ ... errval errhandler ] */
-
- duk_insert(ctx, -2); /* -> [ ... errhandler errval ] */
- duk_push_undefined(ctx);
- duk_insert(ctx, -2); /* -> [ ... errhandler undefined(= this) errval ] */
-
- /* [ ... errhandler undefined errval ] */
-
- /*
- * DUK_CALL_FLAG_IGNORE_RECLIMIT causes duk_handle_call() to ignore C
- * recursion depth limit (and won't increase it either). This is
- * dangerous, but useful because it allows the error handler to run
- * even if the original error is caused by C recursion depth limit.
- *
- * The heap level DUK_HEAP_FLAG_ERRHANDLER_RUNNING is set for the
- * duration of the error handler and cleared afterwards. This flag
- * prevents the error handler from running recursively. The flag is
- * heap level so that the flag properly controls even coroutines
- * launched by an error handler. Since the flag is heap level, it is
- * critical to restore it correctly.
- *
- * We ignore errors now: a success return and an error value both
- * replace the original error value. (This would be easy to change.)
- */
-
- DUK_ASSERT(!DUK_HEAP_HAS_ERRHANDLER_RUNNING(thr->heap)); /* since no recursive error handler calls */
- DUK_HEAP_SET_ERRHANDLER_RUNNING(thr->heap);
-
- call_flags = DUK_CALL_FLAG_IGNORE_RECLIMIT; /* ignore reclimit, not constructor */
-
- rc = duk_handle_call_protected(thr,
- 1, /* num args */
- call_flags); /* call_flags */
- DUK_UNREF(rc); /* no need to check now: both success and error are OK */
-
- DUK_ASSERT(DUK_HEAP_HAS_ERRHANDLER_RUNNING(thr->heap));
- DUK_HEAP_CLEAR_ERRHANDLER_RUNNING(thr->heap);
-
- /* [ ... errval ] */
-}
-#endif /* DUK_USE_ERRTHROW || DUK_USE_ERRCREATE */
-
-/*
- * Add ._Tracedata to an error on the stack top.
- */
-
-#if defined(DUK_USE_TRACEBACKS)
-DUK_LOCAL void duk__add_traceback(duk_hthread *thr, duk_hthread *thr_callstack, const char *c_filename, duk_int_t c_line, duk_bool_t noblame_fileline) {
- duk_context *ctx = (duk_context *) thr;
- duk_small_uint_t depth;
- duk_int_t i, i_min;
- duk_uarridx_t arr_idx;
- duk_double_t d;
-
- DUK_ASSERT(thr != NULL);
- DUK_ASSERT(thr_callstack != NULL);
- DUK_ASSERT(ctx != NULL);
-
- /* [ ... error ] */
-
- /*
- * The traceback format is pretty arcane in an attempt to keep it compact
- * and cheap to create. It may change arbitrarily from version to version.
- * It should be decoded/accessed through version specific accessors only.
- *
- * See doc/error-objects.rst.
- */
-
- DUK_DDD(DUK_DDDPRINT("adding traceback to object: %!T",
- (duk_tval *) duk_get_tval(ctx, -1)));
-
- duk_push_array(ctx); /* XXX: specify array size, as we know it */
- arr_idx = 0;
-
- /* Compiler SyntaxErrors (and other errors) come first, and are
- * blamed by default (not flagged "noblame").
- */
- if (thr->compile_ctx != NULL && thr->compile_ctx->h_filename != NULL) {
- duk_push_hstring(ctx, thr->compile_ctx->h_filename);
- duk_xdef_prop_index_wec(ctx, -2, arr_idx);
- arr_idx++;
-
- duk_push_uint(ctx, (duk_uint_t) thr->compile_ctx->curr_token.start_line); /* (flags<<32) + (line), flags = 0 */
- duk_xdef_prop_index_wec(ctx, -2, arr_idx);
- arr_idx++;
- }
-
- /* Filename/line from C macros (__FILE__, __LINE__) are added as an
- * entry with a special format: (string, number). The number contains
- * the line and flags.
- */
-
- /* XXX: optimize: allocate an array part to the necessary size (upwards
- * estimate) and fill in the values directly into the array part; finally
- * update 'length'.
- */
-
- /* XXX: using duk_put_prop_index() would cause obscure error cases when Array.prototype
- * has write-protected array index named properties. This was seen as DoubleErrors
- * in e.g. some test262 test cases. Using duk_xdef_prop_index() is better but heavier.
- * The best fix is to fill in the tracedata directly into the array part. There are
- * no side effect concerns if the array part is allocated directly and only INCREFs
- * happen after that.
- */
-
- /* [ ... error arr ] */
-
- if (c_filename) {
- duk_push_string(ctx, c_filename);
- duk_xdef_prop_index_wec(ctx, -2, arr_idx);
- arr_idx++;
-
- d = (noblame_fileline ? ((duk_double_t) DUK_TB_FLAG_NOBLAME_FILELINE) * DUK_DOUBLE_2TO32 : 0.0) +
- (duk_double_t) c_line;
- duk_push_number(ctx, d);
- duk_xdef_prop_index_wec(ctx, -2, arr_idx);
- arr_idx++;
- }
-
- /* traceback depth doesn't take into account the filename/line
- * special handling above (intentional)
- */
- depth = DUK_USE_TRACEBACK_DEPTH;
- i_min = (thr_callstack->callstack_top > (duk_size_t) depth ? (duk_int_t) (thr_callstack->callstack_top - depth) : 0);
- DUK_ASSERT(i_min >= 0);
-
- /* [ ... error arr ] */
-
- DUK_ASSERT(thr_callstack->callstack_top <= DUK_INT_MAX); /* callstack limits */
- for (i = (duk_int_t) (thr_callstack->callstack_top - 1); i >= i_min; i--) {
- duk_uint32_t pc;
-
- /*
- * Note: each API operation potentially resizes the callstack,
- * so be careful to re-lookup after every operation. Currently
- * these is no issue because we don't store a temporary 'act'
- * pointer at all. (This would be a non-issue if we operated
- * directly on the array part.)
- */
-
- /* [... arr] */
-
- DUK_ASSERT_DISABLE(thr_callstack->callstack[i].pc >= 0); /* unsigned */
-
- /* Add function object. */
- duk_push_tval(ctx, &(thr_callstack->callstack + i)->tv_func);
- duk_xdef_prop_index_wec(ctx, -2, arr_idx);
- arr_idx++;
-
- /* Add a number containing: pc, activation flags.
- *
- * PC points to next instruction, find offending PC. Note that
- * PC == 0 for native code.
- */
- pc = duk_hthread_get_act_prev_pc(thr_callstack, thr_callstack->callstack + i);
- DUK_ASSERT_DISABLE(pc >= 0); /* unsigned */
- DUK_ASSERT((duk_double_t) pc < DUK_DOUBLE_2TO32); /* assume PC is at most 32 bits and non-negative */
- d = ((duk_double_t) thr_callstack->callstack[i].flags) * DUK_DOUBLE_2TO32 + (duk_double_t) pc;
- duk_push_number(ctx, d); /* -> [... arr num] */
- duk_xdef_prop_index_wec(ctx, -2, arr_idx);
- arr_idx++;
- }
-
- /* XXX: set with duk_hobject_set_length() when tracedata is filled directly */
- duk_push_uint(ctx, (duk_uint_t) arr_idx);
- duk_xdef_prop_stridx(ctx, -2, DUK_STRIDX_LENGTH, DUK_PROPDESC_FLAGS_WC);
-
- /* [ ... error arr ] */
-
- duk_xdef_prop_stridx_wec(ctx, -2, DUK_STRIDX_INT_TRACEDATA); /* -> [ ... error ] */
-}
-#endif /* DUK_USE_TRACEBACKS */
-
-/*
- * Add .fileName and .lineNumber to an error on the stack top.
- */
-
-#if !defined(DUK_USE_TRACEBACKS)
-DUK_LOCAL void duk__add_fileline(duk_hthread *thr, duk_hthread *thr_callstack, const char *c_filename, duk_int_t c_line, duk_bool_t noblame_fileline) {
- duk_context *ctx;
-#if defined(DUK_USE_ASSERTIONS)
- duk_int_t entry_top;
-#endif
-
- ctx = (duk_context *) thr;
-#if defined(DUK_USE_ASSERTIONS)
- entry_top = duk_get_top(ctx);
-#endif
-
- /*
- * If tracebacks are disabled, 'fileName' and 'lineNumber' are added
- * as plain own properties. Since Error.prototype has accessors of
- * the same name, we need to define own properties directly (cannot
- * just use e.g. duk_put_prop_stridx). Existing properties are not
- * overwritten in case they already exist.
- */
-
- if (thr->compile_ctx != NULL && thr->compile_ctx->h_filename != NULL) {
- /* Compiler SyntaxError (or other error) gets the primary blame.
- * Currently no flag to prevent blaming.
- */
- duk_push_uint(ctx, (duk_uint_t) thr->compile_ctx->curr_token.start_line);
- duk_push_hstring(ctx, thr->compile_ctx->h_filename);
- } else if (c_filename && !noblame_fileline) {
- /* C call site gets blamed next, unless flagged not to do so.
- * XXX: file/line is disabled in minimal builds, so disable this
- * too when appropriate.
- */
- duk_push_int(ctx, c_line);
- duk_push_string(ctx, c_filename);
- } else {
- /* Finally, blame the innermost callstack entry which has a
- * .fileName property.
- */
- duk_small_uint_t depth;
- duk_int_t i, i_min;
- duk_uint32_t ecma_line;
-
- depth = DUK_USE_TRACEBACK_DEPTH;
- i_min = (thr_callstack->callstack_top > (duk_size_t) depth ? (duk_int_t) (thr_callstack->callstack_top - depth) : 0);
- DUK_ASSERT(i_min >= 0);
-
- DUK_ASSERT(thr_callstack->callstack_top <= DUK_INT_MAX); /* callstack limits */
- for (i = (duk_int_t) (thr_callstack->callstack_top - 1); i >= i_min; i--) {
- duk_activation *act;
- duk_hobject *func;
- duk_uint32_t pc;
-
- DUK_UNREF(pc);
- act = thr_callstack->callstack + i;
- DUK_ASSERT(act >= thr_callstack->callstack && act < thr_callstack->callstack + thr_callstack->callstack_size);
-
- func = DUK_ACT_GET_FUNC(act);
- if (func == NULL) {
- /* Lightfunc, not blamed now. */
- continue;
- }
-
- /* PC points to next instruction, find offending PC,
- * PC == 0 for native code.
- */
- pc = duk_hthread_get_act_prev_pc(thr, act); /* thr argument only used for thr->heap, so specific thread doesn't matter */
- DUK_ASSERT_DISABLE(pc >= 0); /* unsigned */
- DUK_ASSERT((duk_double_t) pc < DUK_DOUBLE_2TO32); /* assume PC is at most 32 bits and non-negative */
- act = NULL; /* invalidated by pushes, so get out of the way */
-
- duk_push_hobject(ctx, func);
-
- /* [ ... error func ] */
-
- duk_get_prop_stridx(ctx, -1, DUK_STRIDX_FILE_NAME);
- if (!duk_is_string(ctx, -1)) {
- duk_pop_2(ctx);
- continue;
- }
-
- /* [ ... error func fileName ] */
-
- ecma_line = 0;
-#if defined(DUK_USE_PC2LINE)
- if (DUK_HOBJECT_IS_COMPILEDFUNCTION(func)) {
- ecma_line = duk_hobject_pc2line_query(ctx, -2, (duk_uint_fast32_t) pc);
- } else {
- /* Native function, no relevant lineNumber. */
- }
-#endif /* DUK_USE_PC2LINE */
- duk_push_u32(ctx, ecma_line);
-
- /* [ ... error func fileName lineNumber ] */
-
- duk_replace(ctx, -3);
-
- /* [ ... error lineNumber fileName ] */
- goto define_props;
- }
-
- /* No activation matches, use undefined for both .fileName and
- * .lineNumber (matches what we do with a _Tracedata based
- * no-match lookup.
- */
- duk_push_undefined(ctx);
- duk_push_undefined(ctx);
- }
-
- define_props:
- /* [ ... error lineNumber fileName ] */
-#if defined(DUK_USE_ASSERTIONS)
- DUK_ASSERT(duk_get_top(ctx) == entry_top + 2);
-#endif
- duk_xdef_prop_stridx(ctx, -3, DUK_STRIDX_FILE_NAME, DUK_PROPDESC_FLAGS_WC | DUK_PROPDESC_FLAG_NO_OVERWRITE);
- duk_xdef_prop_stridx(ctx, -2, DUK_STRIDX_LINE_NUMBER, DUK_PROPDESC_FLAGS_WC | DUK_PROPDESC_FLAG_NO_OVERWRITE);
-}
-#endif /* !DUK_USE_TRACEBACKS */
-
-/*
- * Add line number to a compiler error.
- */
-
-DUK_LOCAL void duk__add_compiler_error_line(duk_hthread *thr) {
- duk_context *ctx;
-
- /* Append a "(line NNN)" to the "message" property of any error
- * thrown during compilation. Usually compilation errors are
- * SyntaxErrors but they can also be out-of-memory errors and
- * the like.
- */
-
- /* [ ... error ] */
-
- ctx = (duk_context *) thr;
- DUK_ASSERT(duk_is_object(ctx, -1));
-
- if (!(thr->compile_ctx != NULL && thr->compile_ctx->h_filename != NULL)) {
- return;
- }
-
- DUK_DDD(DUK_DDDPRINT("compile error, before adding line info: %!T",
- (duk_tval *) duk_get_tval(ctx, -1)));
-
- if (duk_get_prop_stridx(ctx, -1, DUK_STRIDX_MESSAGE)) {
- duk_push_sprintf(ctx, " (line %ld)", (long) thr->compile_ctx->curr_token.start_line);
- duk_concat(ctx, 2);
- duk_put_prop_stridx(ctx, -2, DUK_STRIDX_MESSAGE);
- } else {
- duk_pop(ctx);
- }
-
- DUK_DDD(DUK_DDDPRINT("compile error, after adding line info: %!T",
- (duk_tval *) duk_get_tval(ctx, -1)));
-}
-
-/*
- * Augment an error being created using Duktape specific properties
- * like _Tracedata or .fileName/.lineNumber.
- */
-
-#if defined(DUK_USE_AUGMENT_ERROR_CREATE)
-DUK_LOCAL void duk__err_augment_builtin_create(duk_hthread *thr, duk_hthread *thr_callstack, const char *c_filename, duk_int_t c_line, duk_small_int_t noblame_fileline, duk_hobject *obj) {
- duk_context *ctx = (duk_context *) thr;
-#if defined(DUK_USE_ASSERTIONS)
- duk_int_t entry_top;
-#endif
-
-#if defined(DUK_USE_ASSERTIONS)
- entry_top = duk_get_top(ctx);
-#endif
- DUK_ASSERT(obj != NULL);
-
- DUK_UNREF(obj); /* unreferenced w/o tracebacks */
- DUK_UNREF(ctx); /* unreferenced w/o asserts */
-
- duk__add_compiler_error_line(thr);
-
-#if defined(DUK_USE_TRACEBACKS)
- /* If tracebacks are enabled, the '_Tracedata' property is the only
- * thing we need: 'fileName' and 'lineNumber' are virtual properties
- * which use '_Tracedata'.
- */
- if (duk_hobject_hasprop_raw(thr, obj, DUK_HTHREAD_STRING_INT_TRACEDATA(thr))) {
- DUK_DDD(DUK_DDDPRINT("error value already has a '_Tracedata' property, not modifying it"));
- } else {
- duk__add_traceback(thr, thr_callstack, c_filename, c_line, noblame_fileline);
- }
-#else
- /* Without tracebacks the concrete .fileName and .lineNumber need
- * to be added directly.
- */
- duk__add_fileline(thr, thr_callstack, c_filename, c_line, noblame_fileline);
-#endif
-
-#if defined(DUK_USE_ASSERTIONS)
- DUK_ASSERT(duk_get_top(ctx) == entry_top);
-#endif
-}
-#endif /* DUK_USE_AUGMENT_ERROR_CREATE */
-
-/*
- * Augment an error at creation time with _Tracedata/fileName/lineNumber
- * and allow a user error handler (if defined) to process/replace the error.
- * The error to be augmented is at the stack top.
- *
- * thr: thread containing the error value
- * thr_callstack: thread which should be used for generating callstack etc.
- * c_filename: C __FILE__ related to the error
- * c_line: C __LINE__ related to the error
- * noblame_fileline: if true, don't fileName/line as error source, otherwise use traceback
- * (needed because user code filename/line are reported but internal ones
- * are not)
- *
- * XXX: rename noblame_fileline to flags field; combine it to some existing
- * field (there are only a few call sites so this may not be worth it).
- */
-
-#if defined(DUK_USE_AUGMENT_ERROR_CREATE)
-DUK_INTERNAL void duk_err_augment_error_create(duk_hthread *thr, duk_hthread *thr_callstack, const char *c_filename, duk_int_t c_line, duk_bool_t noblame_fileline) {
- duk_context *ctx = (duk_context *) thr;
- duk_hobject *obj;
-
- DUK_ASSERT(thr != NULL);
- DUK_ASSERT(thr_callstack != NULL);
- DUK_ASSERT(ctx != NULL);
-
- /* [ ... error ] */
-
- /*
- * Criteria for augmenting:
- *
- * - augmentation enabled in build (naturally)
- * - error value internal prototype chain contains the built-in
- * Error prototype object (i.e. 'val instanceof Error')
- *
- * Additional criteria for built-in augmenting:
- *
- * - error value is an extensible object
- */
-
- obj = duk_get_hobject(ctx, -1);
- if (!obj) {
- DUK_DDD(DUK_DDDPRINT("value is not an object, skip both built-in and user augment"));
- return;
- }
- if (!duk_hobject_prototype_chain_contains(thr, obj, thr->builtins[DUK_BIDX_ERROR_PROTOTYPE], 1 /*ignore_loop*/)) {
- /* If the value has a prototype loop, it's critical not to
- * throw here. Instead, assume the value is not to be
- * augmented.
- */
- DUK_DDD(DUK_DDDPRINT("value is not an error instance, skip both built-in and user augment"));
- return;
- }
- if (DUK_HOBJECT_HAS_EXTENSIBLE(obj)) {
- DUK_DDD(DUK_DDDPRINT("error meets criteria, built-in augment"));
- duk__err_augment_builtin_create(thr, thr_callstack, c_filename, c_line, noblame_fileline, obj);
- } else {
- DUK_DDD(DUK_DDDPRINT("error does not meet criteria, no built-in augment"));
- }
-
- /* [ ... error ] */
-
-#if defined(DUK_USE_ERRCREATE)
- duk__err_augment_user(thr, DUK_STRIDX_ERR_CREATE);
-#endif
-}
-#endif /* DUK_USE_AUGMENT_ERROR_CREATE */
-
-/*
- * Augment an error at throw time; allow a user error handler (if defined)
- * to process/replace the error. The error to be augmented is at the
- * stack top.
- */
-
-#if defined(DUK_USE_AUGMENT_ERROR_THROW)
-DUK_INTERNAL void duk_err_augment_error_throw(duk_hthread *thr) {
-#if defined(DUK_USE_ERRTHROW)
- duk__err_augment_user(thr, DUK_STRIDX_ERR_THROW);
-#endif /* DUK_USE_ERRTHROW */
-}
-#endif /* DUK_USE_AUGMENT_ERROR_THROW */
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_error_longjmp.c
----------------------------------------------------------------------
diff --git a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_error_longjmp.c b/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_error_longjmp.c
deleted file mode 100644
index bfb1b46..0000000
--- a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_error_longjmp.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Do a longjmp call, calling the fatal error handler if no
- * catchpoint exists.
- */
-
-#include "duk_internal.h"
-
-DUK_INTERNAL void duk_err_longjmp(duk_hthread *thr) {
- DUK_ASSERT(thr != NULL);
-
- DUK_DD(DUK_DDPRINT("longjmp error: type=%d iserror=%d value1=%!T value2=%!T",
- (int) thr->heap->lj.type, (int) thr->heap->lj.iserror,
- &thr->heap->lj.value1, &thr->heap->lj.value2));
-
-#if !defined(DUK_USE_CPP_EXCEPTIONS)
- /* If we don't have a jmpbuf_ptr, there is little we can do
- * except panic. The caller's expectation is that we never
- * return.
- *
- * With C++ exceptions we now just propagate an uncaught error
- * instead of invoking the fatal error handler. Because there's
- * a dummy jmpbuf for C++ exceptions now, this could be changed.
- */
- if (!thr->heap->lj.jmpbuf_ptr) {
-
- DUK_D(DUK_DPRINT("uncaught error: type=%d iserror=%d value1=%!T value2=%!T",
- (int) thr->heap->lj.type, (int) thr->heap->lj.iserror,
- &thr->heap->lj.value1, &thr->heap->lj.value2));
-
- duk_fatal((duk_context *) thr, DUK_ERR_UNCAUGHT_ERROR, "uncaught error");
- DUK_UNREACHABLE();
- }
-#endif /* DUK_USE_CPP_EXCEPTIONS */
-
-#if defined(DUK_USE_CPP_EXCEPTIONS)
- {
- duk_internal_exception exc; /* dummy */
- throw exc;
- }
-#else /* DUK_USE_CPP_EXCEPTIONS */
- DUK_LONGJMP(thr->heap->lj.jmpbuf_ptr->jb);
-#endif /* DUK_USE_CPP_EXCEPTIONS */
-
- DUK_UNREACHABLE();
-}
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_error_macros.c
----------------------------------------------------------------------
diff --git a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_error_macros.c b/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_error_macros.c
deleted file mode 100644
index 9334d1f..0000000
--- a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_error_macros.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Error, fatal, and panic handling.
- */
-
-#include "duk_internal.h"
-
-#define DUK__ERRFMT_BUFSIZE 256 /* size for formatting buffers */
-
-#if defined(DUK_USE_VERBOSE_ERRORS)
-
-DUK_INTERNAL void duk_err_handle_error_fmt(duk_hthread *thr, const char *filename, duk_uint_t line_and_code, const char *fmt, ...) {
- va_list ap;
- char msg[DUK__ERRFMT_BUFSIZE];
- va_start(ap, fmt);
- (void) DUK_VSNPRINTF(msg, sizeof(msg), fmt, ap);
- msg[sizeof(msg) - 1] = (char) 0;
- duk_err_create_and_throw(thr, (duk_errcode_t) (line_and_code >> 24), msg, filename, (duk_int_t) (line_and_code & 0x00ffffffL));
- va_end(ap); /* dead code, but ensures portability (see Linux man page notes) */
-}
-
-DUK_INTERNAL void duk_err_handle_error(duk_hthread *thr, const char *filename, duk_uint_t line_and_code, const char *msg) {
- duk_err_create_and_throw(thr, (duk_errcode_t) (line_and_code >> 24), msg, filename, (duk_int_t) (line_and_code & 0x00ffffffL));
-}
-
-#else /* DUK_USE_VERBOSE_ERRORS */
-
-DUK_INTERNAL void duk_err_handle_error(duk_hthread *thr, duk_errcode_t code) {
- duk_err_create_and_throw(thr, code);
-}
-
-#endif /* DUK_USE_VERBOSE_ERRORS */
-
-/*
- * Error throwing helpers
- */
-
-#if defined(DUK_USE_VERBOSE_ERRORS)
-#if defined(DUK_USE_PARANOID_ERRORS)
-DUK_INTERNAL void duk_err_require_type_index(duk_hthread *thr, const char *filename, duk_int_t linenumber, duk_idx_t index, const char *expect_name) {
- DUK_ERROR_RAW_FMT3(thr, filename, linenumber, DUK_ERR_TYPE_ERROR, "%s required, found %s (stack index %ld)",
- expect_name, duk_get_type_name((duk_context *) thr, index), (long) index);
-}
-#else
-DUK_INTERNAL void duk_err_require_type_index(duk_hthread *thr, const char *filename, duk_int_t linenumber, duk_idx_t index, const char *expect_name) {
- DUK_ERROR_RAW_FMT3(thr, filename, linenumber, DUK_ERR_TYPE_ERROR, "%s required, found %s (stack index %ld)",
- expect_name, duk_push_string_readable((duk_context *) thr, index), (long) index);
-}
-#endif
-DUK_INTERNAL void duk_err_range(duk_hthread *thr, const char *filename, duk_int_t linenumber, const char *message) {
- DUK_ERROR_RAW(thr, filename, linenumber, DUK_ERR_RANGE_ERROR, message);
-}
-DUK_INTERNAL void duk_err_api_index(duk_hthread *thr, const char *filename, duk_int_t linenumber, duk_idx_t index) {
- DUK_ERROR_RAW_FMT1(thr, filename, linenumber, DUK_ERR_API_ERROR, "invalid stack index %ld", (long) (index));
-}
-DUK_INTERNAL void duk_err_api(duk_hthread *thr, const char *filename, duk_int_t linenumber, const char *message) {
- DUK_ERROR_RAW(thr, filename, linenumber, DUK_ERR_API_ERROR, message);
-}
-DUK_INTERNAL void duk_err_unimplemented_defmsg(duk_hthread *thr, const char *filename, duk_int_t linenumber) {
- DUK_ERROR_RAW(thr, filename, linenumber, DUK_ERR_UNIMPLEMENTED_ERROR, DUK_STR_UNIMPLEMENTED);
-}
-#if !defined(DUK_USE_BYTECODE_DUMP_SUPPORT)
-DUK_INTERNAL void duk_err_unsupported_defmsg(duk_hthread *thr, const char *filename, duk_int_t linenumber) {
- DUK_ERROR_RAW(thr, filename, linenumber, DUK_ERR_UNSUPPORTED_ERROR, DUK_STR_UNSUPPORTED);
-}
-#endif
-DUK_INTERNAL void duk_err_internal_defmsg(duk_hthread *thr, const char *filename, duk_int_t linenumber) {
- DUK_ERROR_RAW(thr, filename, linenumber, DUK_ERR_INTERNAL_ERROR, DUK_STR_INTERNAL_ERROR);
-}
-DUK_INTERNAL void duk_err_internal(duk_hthread *thr, const char *filename, duk_int_t linenumber, const char *message) {
- DUK_ERROR_RAW(thr, filename, linenumber, DUK_ERR_INTERNAL_ERROR, message);
-}
-DUK_INTERNAL void duk_err_alloc(duk_hthread *thr, const char *filename, duk_int_t linenumber, const char *message) {
- DUK_ERROR_RAW(thr, filename, linenumber, DUK_ERR_ALLOC_ERROR, message);
-}
-#else
-/* The file/line arguments are NULL and 0, they're ignored by DUK_ERROR_RAW()
- * when non-verbose errors are used.
- */
-DUK_INTERNAL void duk_err_type(duk_hthread *thr) {
- DUK_ERROR_RAW(thr, NULL, 0, DUK_ERR_TYPE_ERROR, NULL);
-}
-DUK_INTERNAL void duk_err_api(duk_hthread *thr) {
- DUK_ERROR_RAW(thr, NULL, 0, DUK_ERR_API_ERROR, NULL);
-}
-DUK_INTERNAL void duk_err_range(duk_hthread *thr) {
- DUK_ERROR_RAW(thr, NULL, 0, DUK_ERR_RANGE_ERROR, NULL);
-}
-DUK_INTERNAL void duk_err_syntax(duk_hthread *thr) {
- DUK_ERROR_RAW(thr, NULL, 0, DUK_ERR_SYNTAX_ERROR, NULL);
-}
-DUK_INTERNAL void duk_err_unimplemented(duk_hthread *thr) {
- DUK_ERROR_RAW(thr, NULL, 0, DUK_ERR_UNIMPLEMENTED_ERROR, NULL);
-}
-DUK_INTERNAL void duk_err_unsupported(duk_hthread *thr) {
- DUK_ERROR_RAW(thr, NULL, 0, DUK_ERR_UNSUPPORTED_ERROR, NULL);
-}
-DUK_INTERNAL void duk_err_internal(duk_hthread *thr) {
- DUK_ERROR_RAW(thr, NULL, 0, DUK_ERR_INTERNAL_ERROR, NULL);
-}
-DUK_INTERNAL void duk_err_alloc(duk_hthread *thr) {
- DUK_ERROR_RAW(thr, NULL, thr, DUK_ERR_ALLOC_ERROR, NULL);
-}
-#endif
-
-/*
- * Default fatal error handler
- */
-
-DUK_INTERNAL void duk_default_fatal_handler(duk_context *ctx, duk_errcode_t code, const char *msg) {
- DUK_UNREF(ctx);
-#if defined(DUK_USE_FILE_IO)
- DUK_FPRINTF(DUK_STDERR, "FATAL %ld: %s\n", (long) code, (const char *) (msg ? msg : "null"));
- DUK_FFLUSH(DUK_STDERR);
-#else
- /* omit print */
-#endif
- DUK_D(DUK_DPRINT("default fatal handler called, code %ld -> calling DUK_PANIC()", (long) code));
- DUK_PANIC(code, msg);
- DUK_UNREACHABLE();
-}
-
-/*
- * Default panic handler
- */
-
-#if !defined(DUK_USE_PANIC_HANDLER)
-DUK_INTERNAL void duk_default_panic_handler(duk_errcode_t code, const char *msg) {
-#if defined(DUK_USE_FILE_IO)
- DUK_FPRINTF(DUK_STDERR, "PANIC %ld: %s ("
-#if defined(DUK_USE_PANIC_ABORT)
- "calling abort"
-#elif defined(DUK_USE_PANIC_EXIT)
- "calling exit"
-#elif defined(DUK_USE_PANIC_SEGFAULT)
- "segfaulting on purpose"
-#else
-#error no DUK_USE_PANIC_xxx macro defined
-#endif
- ")\n", (long) code, (const char *) (msg ? msg : "null"));
- DUK_FFLUSH(DUK_STDERR);
-#else
- /* omit print */
- DUK_UNREF(code);
- DUK_UNREF(msg);
-#endif
-
-#if defined(DUK_USE_PANIC_ABORT)
- DUK_ABORT();
-#elif defined(DUK_USE_PANIC_EXIT)
- DUK_EXIT(-1);
-#elif defined(DUK_USE_PANIC_SEGFAULT)
- /* exit() afterwards to satisfy "noreturn" */
- DUK_CAUSE_SEGFAULT(); /* SCANBUILD: "Dereference of null pointer", normal */
- DUK_EXIT(-1);
-#else
-#error no DUK_USE_PANIC_xxx macro defined
-#endif
-
- DUK_UNREACHABLE();
-}
-#endif /* !DUK_USE_PANIC_HANDLER */
-
-#undef DUK__ERRFMT_BUFSIZE
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_error_misc.c
----------------------------------------------------------------------
diff --git a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_error_misc.c b/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_error_misc.c
deleted file mode 100644
index 5b37855..0000000
--- a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_error_misc.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Error helpers
- */
-
-#include "duk_internal.h"
-
-/*
- * Helper to walk the thread chain and see if there is an active error
- * catcher. Protected calls or finally blocks aren't considered catching.
- */
-
-#if defined(DUK_USE_DEBUGGER_SUPPORT) && \
- (defined(DUK_USE_DEBUGGER_THROW_NOTIFY) || defined(DUK_USE_DEBUGGER_PAUSE_UNCAUGHT))
-DUK_LOCAL duk_bool_t duk__have_active_catcher(duk_hthread *thr) {
- /*
- * XXX: As noted above, a protected API call won't be counted as a
- * catcher. This is usually convenient, e.g. in the case of a top-
- * level duk_pcall(), but may not always be desirable. Perhaps add an
- * argument to treat them as catchers?
- */
-
- duk_size_t i;
-
- DUK_ASSERT(thr != NULL);
-
- while (thr != NULL) {
- for (i = 0; i < thr->catchstack_top; i++) {
- duk_catcher *cat = thr->catchstack + i;
- if (DUK_CAT_HAS_CATCH_ENABLED(cat)) {
- return 1; /* all we need to know */
- }
- }
- thr = thr->resumer;
- }
- return 0;
-}
-#endif /* DUK_USE_DEBUGGER_SUPPORT && (DUK_USE_DEBUGGER_THROW_NOTIFY || DUK_USE_DEBUGGER_PAUSE_UNCAUGHT) */
-
-/*
- * Get prototype object for an integer error code.
- */
-
-DUK_INTERNAL duk_hobject *duk_error_prototype_from_code(duk_hthread *thr, duk_errcode_t code) {
- switch (code) {
- case DUK_ERR_EVAL_ERROR:
- return thr->builtins[DUK_BIDX_EVAL_ERROR_PROTOTYPE];
- case DUK_ERR_RANGE_ERROR:
- return thr->builtins[DUK_BIDX_RANGE_ERROR_PROTOTYPE];
- case DUK_ERR_REFERENCE_ERROR:
- return thr->builtins[DUK_BIDX_REFERENCE_ERROR_PROTOTYPE];
- case DUK_ERR_SYNTAX_ERROR:
- return thr->builtins[DUK_BIDX_SYNTAX_ERROR_PROTOTYPE];
- case DUK_ERR_TYPE_ERROR:
- return thr->builtins[DUK_BIDX_TYPE_ERROR_PROTOTYPE];
- case DUK_ERR_URI_ERROR:
- return thr->builtins[DUK_BIDX_URI_ERROR_PROTOTYPE];
-
- /* XXX: more specific error classes? */
- case DUK_ERR_UNIMPLEMENTED_ERROR:
- case DUK_ERR_INTERNAL_ERROR:
- case DUK_ERR_ALLOC_ERROR:
- case DUK_ERR_ASSERTION_ERROR:
- case DUK_ERR_API_ERROR:
- case DUK_ERR_ERROR:
- default:
- return thr->builtins[DUK_BIDX_ERROR_PROTOTYPE];
- }
-}
-
-/*
- * Exposed helper for setting up heap longjmp state.
- */
-
-DUK_INTERNAL void duk_err_setup_heap_ljstate(duk_hthread *thr, duk_small_int_t lj_type) {
-#if defined(DUK_USE_DEBUGGER_SUPPORT)
- /* If something is thrown with the debugger attached and nobody will
- * catch it, execution is paused before the longjmp, turning over
- * control to the debug client. This allows local state to be examined
- * before the stack is unwound. Errors are not intercepted when debug
- * message loop is active (e.g. for Eval).
- */
-
- /* XXX: Allow customizing the pause and notify behavior at runtime
- * using debugger runtime flags. For now the behavior is fixed using
- * config options.
- */
-#if defined(DUK_USE_DEBUGGER_THROW_NOTIFY) || defined(DUK_USE_DEBUGGER_PAUSE_UNCAUGHT)
- if (DUK_HEAP_IS_DEBUGGER_ATTACHED(thr->heap) &&
- !thr->heap->dbg_processing &&
- lj_type == DUK_LJ_TYPE_THROW) {
- duk_context *ctx = (duk_context *) thr;
- duk_bool_t fatal;
- duk_hobject *h_obj;
-
- /* Don't intercept a DoubleError, we may have caused the initial double
- * fault and attempting to intercept it will cause us to be called
- * recursively and exhaust the C stack.
- */
- h_obj = duk_get_hobject(ctx, -1);
- if (h_obj == thr->builtins[DUK_BIDX_DOUBLE_ERROR]) {
- DUK_D(DUK_DPRINT("built-in DoubleError instance thrown, not intercepting"));
- goto skip_throw_intercept;
- }
-
- DUK_D(DUK_DPRINT("throw with debugger attached, report to client"));
-
- fatal = !duk__have_active_catcher(thr);
-
-#if defined(DUK_USE_DEBUGGER_THROW_NOTIFY)
- /* Report it to the debug client */
- duk_debug_send_throw(thr, fatal);
-#endif
-
-#if defined(DUK_USE_DEBUGGER_PAUSE_UNCAUGHT)
- if (fatal) {
- DUK_D(DUK_DPRINT("throw will be fatal, halt before longjmp"));
- duk_debug_halt_execution(thr, 1 /*use_prev_pc*/);
- }
-#endif
- }
-
- skip_throw_intercept:
-#endif /* DUK_USE_DEBUGGER_THROW_NOTIFY || DUK_USE_DEBUGGER_PAUSE_UNCAUGHT */
-#endif /* DUK_USE_DEBUGGER_SUPPORT */
-
- thr->heap->lj.type = lj_type;
-
- DUK_ASSERT(thr->valstack_top > thr->valstack);
- DUK_TVAL_SET_TVAL_UPDREF(thr, &thr->heap->lj.value1, thr->valstack_top - 1); /* side effects */
-
- duk_pop((duk_context *) thr);
-}
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_error_throw.c
----------------------------------------------------------------------
diff --git a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_error_throw.c b/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_error_throw.c
deleted file mode 100644
index 69b75f0..0000000
--- a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_error_throw.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Create and throw an Ecmascript error object based on a code and a message.
- *
- * Used when we throw errors internally. Ecmascript generated error objects
- * are created by Ecmascript code, and the throwing is handled by the bytecode
- * executor.
- */
-
-#include "duk_internal.h"
-
-/*
- * Create and throw an error (originating from Duktape internally)
- *
- * Push an error object on top of the stack, possibly throw augmenting
- * the error, and finally longjmp.
- *
- * If an error occurs while we're dealing with the current error, we might
- * enter an infinite recursion loop. This is prevented by detecting a
- * "double fault" through the heap->handling_error flag; the recursion
- * then stops at the second level.
- */
-
-#ifdef DUK_USE_VERBOSE_ERRORS
-DUK_INTERNAL void duk_err_create_and_throw(duk_hthread *thr, duk_errcode_t code, const char *msg, const char *filename, duk_int_t line) {
-#else
-DUK_INTERNAL void duk_err_create_and_throw(duk_hthread *thr, duk_errcode_t code) {
-#endif
- duk_context *ctx = (duk_context *) thr;
- duk_bool_t double_error = thr->heap->handling_error;
-
-#ifdef DUK_USE_VERBOSE_ERRORS
- DUK_DD(DUK_DDPRINT("duk_err_create_and_throw(): code=%ld, msg=%s, filename=%s, line=%ld",
- (long) code, (const char *) msg,
- (const char *) filename, (long) line));
-#else
- DUK_DD(DUK_DDPRINT("duk_err_create_and_throw(): code=%ld", (long) code));
-#endif
-
- DUK_ASSERT(thr != NULL);
- DUK_ASSERT(ctx != NULL);
-
- thr->heap->handling_error = 1;
-
- if (!double_error) {
- /* Allow headroom for calls during error handling (see GH-191).
- * We allow space for 10 additional recursions, with one extra
- * for, e.g. a print() call at the deepest level.
- */
- DUK_ASSERT(thr->callstack_max == DUK_CALLSTACK_DEFAULT_MAX);
- thr->callstack_max = DUK_CALLSTACK_DEFAULT_MAX + DUK_CALLSTACK_GROW_STEP + 11;
- }
-
- DUK_ASSERT(thr->callstack_max == DUK_CALLSTACK_DEFAULT_MAX + DUK_CALLSTACK_GROW_STEP + 11); /* just making sure */
-
- /* Sync so that augmentation sees up-to-date activations, NULL
- * thr->ptr_curr_pc so that it's not used if side effects occur
- * in augmentation or longjmp handling.
- */
- duk_hthread_sync_and_null_currpc(thr);
-
- /*
- * Create and push an error object onto the top of stack.
- * If a "double error" occurs, use a fixed error instance
- * to avoid further trouble.
- */
-
- /* XXX: if attempt to push beyond allocated valstack, this double fault
- * handling fails miserably. We should really write the double error
- * directly to thr->heap->lj.value1 and avoid valstack use entirely.
- */
-
- if (double_error) {
- if (thr->builtins[DUK_BIDX_DOUBLE_ERROR]) {
- DUK_D(DUK_DPRINT("double fault detected -> push built-in fixed 'double error' instance"));
- duk_push_hobject_bidx(ctx, DUK_BIDX_DOUBLE_ERROR);
- } else {
- DUK_D(DUK_DPRINT("double fault detected; there is no built-in fixed 'double error' instance "
- "-> push the error code as a number"));
- duk_push_int(ctx, (duk_int_t) code);
- }
- } else {
- /* Error object is augmented at its creation here. */
- duk_require_stack(ctx, 1);
- /* XXX: unnecessary '%s' formatting here, but cannot use
- * 'msg' as a format string directly.
- */
-#ifdef DUK_USE_VERBOSE_ERRORS
- duk_push_error_object_raw(ctx,
- code | DUK_ERRCODE_FLAG_NOBLAME_FILELINE,
- filename,
- line,
- "%s",
- (const char *) msg);
-#else
- duk_push_error_object_raw(ctx,
- code | DUK_ERRCODE_FLAG_NOBLAME_FILELINE,
- NULL,
- 0,
- NULL);
-#endif
- }
-
- /*
- * Augment error (throw time), unless alloc/double error
- */
-
- if (double_error || code == DUK_ERR_ALLOC_ERROR) {
- DUK_D(DUK_DPRINT("alloc or double error: skip throw augmenting to avoid further trouble"));
- } else {
-#if defined(DUK_USE_AUGMENT_ERROR_THROW)
- DUK_DDD(DUK_DDDPRINT("THROW ERROR (INTERNAL): %!iT (before throw augment)",
- (duk_tval *) duk_get_tval(ctx, -1)));
- duk_err_augment_error_throw(thr);
-#endif
- }
-
- /*
- * Finally, longjmp
- */
-
- duk_err_setup_heap_ljstate(thr, DUK_LJ_TYPE_THROW);
-
- thr->callstack_max = DUK_CALLSTACK_DEFAULT_MAX; /* reset callstack limit */
- thr->heap->handling_error = 0;
-
- DUK_DDD(DUK_DDDPRINT("THROW ERROR (INTERNAL): %!iT, %!iT (after throw augment)",
- (duk_tval *) &thr->heap->lj.value1, (duk_tval *) &thr->heap->lj.value2));
-
- duk_err_longjmp(thr);
- DUK_UNREACHABLE();
-}
-
-/*
- * Helper for C function call negative return values.
- */
-
-DUK_INTERNAL void duk_error_throw_from_negative_rc(duk_hthread *thr, duk_ret_t rc) {
- duk_context *ctx = (duk_context *) thr;
- const char *msg;
- duk_errcode_t code;
-
- DUK_ASSERT(thr != NULL);
- DUK_ASSERT(rc < 0);
-
- /* XXX: this generates quite large code - perhaps select the error
- * class based on the code and then just use the error 'name'?
- */
- /* XXX: shared strings */
-
- code = -rc;
-
- switch (rc) {
- case DUK_RET_UNIMPLEMENTED_ERROR: msg = "unimplemented"; break;
- case DUK_RET_UNSUPPORTED_ERROR: msg = "unsupported"; break;
- case DUK_RET_INTERNAL_ERROR: msg = "internal"; break;
- case DUK_RET_ALLOC_ERROR: msg = "alloc"; break;
- case DUK_RET_ASSERTION_ERROR: msg = "assertion"; break;
- case DUK_RET_API_ERROR: msg = "api"; break;
- case DUK_RET_UNCAUGHT_ERROR: msg = "uncaught"; break;
- case DUK_RET_ERROR: msg = "error"; break;
- case DUK_RET_EVAL_ERROR: msg = "eval"; break;
- case DUK_RET_RANGE_ERROR: msg = "range"; break;
- case DUK_RET_REFERENCE_ERROR: msg = "reference"; break;
- case DUK_RET_SYNTAX_ERROR: msg = "syntax"; break;
- case DUK_RET_TYPE_ERROR: msg = "type"; break;
- case DUK_RET_URI_ERROR: msg = "uri"; break;
- default: msg = "unknown"; break;
- }
-
- DUK_ASSERT(msg != NULL);
-
- /*
- * The __FILE__ and __LINE__ information is intentionally not used in the
- * creation of the error object, as it isn't useful in the tracedata. The
- * tracedata still contains the function which returned the negative return
- * code, and having the file/line of this function isn't very useful.
- */
-
- duk_error_raw(ctx, code, NULL, 0, "%s error (rc %ld)", (const char *) msg, (long) rc);
- DUK_UNREACHABLE();
-}
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_exception.h
----------------------------------------------------------------------
diff --git a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_exception.h b/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_exception.h
deleted file mode 100644
index 7df24de..0000000
--- a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_exception.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Exception for Duktape internal throws when C++ exceptions are used
- * for long control transfers.
- *
- * Doesn't inherit from any exception base class to minimize the chance
- * that user code would accidentally catch this exception.
- */
-
-#ifndef DUK_EXCEPTION_H_INCLUDED
-#define DUK_EXCEPTION_H_INCLUDED
-
-#if defined(DUK_USE_CPP_EXCEPTIONS)
-class duk_internal_exception {
- /* intentionally empty */
-};
-#endif
-
-#endif /* DUK_EXCEPTION_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_forwdecl.h
----------------------------------------------------------------------
diff --git a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_forwdecl.h b/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_forwdecl.h
deleted file mode 100644
index 865d307..0000000
--- a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_forwdecl.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Forward declarations for all Duktape structures.
- */
-
-#ifndef DUK_FORWDECL_H_INCLUDED
-#define DUK_FORWDECL_H_INCLUDED
-
-/*
- * Forward declarations
- */
-
-#if defined(DUK_USE_CPP_EXCEPTIONS)
-class duk_internal_exception;
-#else
-struct duk_jmpbuf;
-#endif
-
-/* duk_tval intentionally skipped */
-struct duk_heaphdr;
-struct duk_heaphdr_string;
-struct duk_hstring;
-struct duk_hstring_external;
-struct duk_hobject;
-struct duk_hcompiledfunction;
-struct duk_hnativefunction;
-struct duk_hthread;
-struct duk_hbufferobject;
-struct duk_hbuffer;
-struct duk_hbuffer_fixed;
-struct duk_hbuffer_dynamic;
-struct duk_hbuffer_external;
-
-struct duk_propaccessor;
-union duk_propvalue;
-struct duk_propdesc;
-
-struct duk_heap;
-struct duk_breakpoint;
-
-struct duk_activation;
-struct duk_catcher;
-struct duk_strcache;
-struct duk_ljstate;
-struct duk_strtab_entry;
-
-#ifdef DUK_USE_DEBUG
-struct duk_fixedbuffer;
-#endif
-
-struct duk_bitdecoder_ctx;
-struct duk_bitencoder_ctx;
-struct duk_bufwriter_ctx;
-
-struct duk_token;
-struct duk_re_token;
-struct duk_lexer_point;
-struct duk_lexer_ctx;
-struct duk_lexer_codepoint;
-
-struct duk_compiler_instr;
-struct duk_compiler_func;
-struct duk_compiler_ctx;
-
-struct duk_re_matcher_ctx;
-struct duk_re_compiler_ctx;
-
-#if defined(DUK_USE_CPP_EXCEPTIONS)
-/* no typedef */
-#else
-typedef struct duk_jmpbuf duk_jmpbuf;
-#endif
-
-/* duk_tval intentionally skipped */
-typedef struct duk_heaphdr duk_heaphdr;
-typedef struct duk_heaphdr_string duk_heaphdr_string;
-typedef struct duk_hstring duk_hstring;
-typedef struct duk_hstring_external duk_hstring_external;
-typedef struct duk_hobject duk_hobject;
-typedef struct duk_hcompiledfunction duk_hcompiledfunction;
-typedef struct duk_hnativefunction duk_hnativefunction;
-typedef struct duk_hbufferobject duk_hbufferobject;
-typedef struct duk_hthread duk_hthread;
-typedef struct duk_hbuffer duk_hbuffer;
-typedef struct duk_hbuffer_fixed duk_hbuffer_fixed;
-typedef struct duk_hbuffer_dynamic duk_hbuffer_dynamic;
-typedef struct duk_hbuffer_external duk_hbuffer_external;
-
-typedef struct duk_propaccessor duk_propaccessor;
-typedef union duk_propvalue duk_propvalue;
-typedef struct duk_propdesc duk_propdesc;
-
-typedef struct duk_heap duk_heap;
-typedef struct duk_breakpoint duk_breakpoint;
-
-typedef struct duk_activation duk_activation;
-typedef struct duk_catcher duk_catcher;
-typedef struct duk_strcache duk_strcache;
-typedef struct duk_ljstate duk_ljstate;
-typedef struct duk_strtab_entry duk_strtab_entry;
-
-#ifdef DUK_USE_DEBUG
-typedef struct duk_fixedbuffer duk_fixedbuffer;
-#endif
-
-typedef struct duk_bitdecoder_ctx duk_bitdecoder_ctx;
-typedef struct duk_bitencoder_ctx duk_bitencoder_ctx;
-typedef struct duk_bufwriter_ctx duk_bufwriter_ctx;
-
-typedef struct duk_token duk_token;
-typedef struct duk_re_token duk_re_token;
-typedef struct duk_lexer_point duk_lexer_point;
-typedef struct duk_lexer_ctx duk_lexer_ctx;
-typedef struct duk_lexer_codepoint duk_lexer_codepoint;
-
-typedef struct duk_compiler_instr duk_compiler_instr;
-typedef struct duk_compiler_func duk_compiler_func;
-typedef struct duk_compiler_ctx duk_compiler_ctx;
-
-typedef struct duk_re_matcher_ctx duk_re_matcher_ctx;
-typedef struct duk_re_compiler_ctx duk_re_compiler_ctx;
-
-#endif /* DUK_FORWDECL_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_hbuffer.h
----------------------------------------------------------------------
diff --git a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hbuffer.h b/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hbuffer.h
deleted file mode 100644
index e9417c0..0000000
--- a/thirdparty/civetweb-1.10/src/third_party/duktape-1.5.2/src-separate/duk_hbuffer.h
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * Heap buffer representation.
- *
- * Heap allocated user data buffer which is either:
- *
- * 1. A fixed size buffer (data follows header statically)
- * 2. A dynamic size buffer (data pointer follows header)
- *
- * The data pointer for a variable size buffer of zero size may be NULL.
- */
-
-#ifndef DUK_HBUFFER_H_INCLUDED
-#define DUK_HBUFFER_H_INCLUDED
-
-/*
- * Flags
- *
- * Fixed buffer: 0
- * Dynamic buffer: DUK_HBUFFER_FLAG_DYNAMIC
- * External buffer: DUK_HBUFFER_FLAG_DYNAMIC | DUK_HBUFFER_FLAG_EXTERNAL
- */
-
-#define DUK_HBUFFER_FLAG_DYNAMIC DUK_HEAPHDR_USER_FLAG(0) /* buffer is behind a pointer, dynamic or external */
-#define DUK_HBUFFER_FLAG_EXTERNAL DUK_HEAPHDR_USER_FLAG(1) /* buffer pointer is to an externally allocated buffer */
-
-#define DUK_HBUFFER_HAS_DYNAMIC(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HBUFFER_FLAG_DYNAMIC)
-#define DUK_HBUFFER_HAS_EXTERNAL(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HBUFFER_FLAG_EXTERNAL)
-
-#define DUK_HBUFFER_SET_DYNAMIC(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HBUFFER_FLAG_DYNAMIC)
-#define DUK_HBUFFER_SET_EXTERNAL(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HBUFFER_FLAG_EXTERNAL)
-
-#define DUK_HBUFFER_CLEAR_DYNAMIC(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HBUFFER_FLAG_DYNAMIC)
-#define DUK_HBUFFER_CLEAR_EXTERNAL(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HBUFFER_FLAG_EXTERNAL)
-
-/*
- * Misc defines
- */
-
-/* Impose a maximum buffer length for now. Restricted artificially to
- * ensure resize computations or adding a heap header length won't
- * overflow size_t and that a signed duk_int_t can hold a buffer
- * length. The limit should be synchronized with DUK_HSTRING_MAX_BYTELEN.
- */
-
-#if defined(DUK_USE_BUFLEN16)
-#define DUK_HBUFFER_MAX_BYTELEN (0x0000ffffUL)
-#else
-/* Intentionally not 0x7fffffffUL; at least JSON code expects that
- * 2*len + 2 fits in 32 bits.
- */
-#define DUK_HBUFFER_MAX_BYTELEN (0x7ffffffeUL)
-#endif
-
-/*
- * Field access
- */
-
-/* Get/set the current user visible size, without accounting for a dynamic
- * buffer's "spare" (= usable size).
- */
-#if defined(DUK_USE_BUFLEN16)
-/* size stored in duk_heaphdr unused flag bits */
-#define DUK_HBUFFER_GET_SIZE(x) ((x)->hdr.h_flags >> 16)
-#define DUK_HBUFFER_SET_SIZE(x,v) do { \
- duk_size_t duk__v; \
- duk__v = (v); \
- DUK_ASSERT(duk__v <= 0xffffUL); \
- (x)->hdr.h_flags = ((x)->hdr.h_flags & 0x0000ffffUL) | (((duk_uint32_t) duk__v) << 16); \
- } while (0)
-#define DUK_HBUFFER_ADD_SIZE(x,dv) do { \
- (x)->hdr.h_flags += ((dv) << 16); \
- } while (0)
-#define DUK_HBUFFER_SUB_SIZE(x,dv) do { \
- (x)->hdr.h_flags -= ((dv) << 16); \
- } while (0)
-#else
-#define DUK_HBUFFER_GET_SIZE(x) (((duk_hbuffer *) (x))->size)
-#define DUK_HBUFFER_SET_SIZE(x,v) do { \
- ((duk_hbuffer *) (x))->size = (v); \
- } while (0)
-#define DUK_HBUFFER_ADD_SIZE(x,dv) do { \
- (x)->size += (dv); \
- } while (0)
-#define DUK_HBUFFER_SUB_SIZE(x,dv) do { \
- (x)->size -= (dv); \
- } while (0)
-#endif
-
-#define DUK_HBUFFER_FIXED_GET_SIZE(x) DUK_HBUFFER_GET_SIZE((duk_hbuffer *) (x))
-#define DUK_HBUFFER_FIXED_SET_SIZE(x,v) DUK_HBUFFER_SET_SIZE((duk_hbuffer *) (x))
-
-#define DUK_HBUFFER_DYNAMIC_GET_SIZE(x) DUK_HBUFFER_GET_SIZE((duk_hbuffer *) (x))
-#define DUK_HBUFFER_DYNAMIC_SET_SIZE(x,v) DUK_HBUFFER_SET_SIZE((duk_hbuffer *) (x), (v))
-#define DUK_HBUFFER_DYNAMIC_ADD_SIZE(x,dv) DUK_HBUFFER_ADD_SIZE((duk_hbuffer *) (x), (dv))
-#define DUK_HBUFFER_DYNAMIC_SUB_SIZE(x,dv) DUK_HBUFFER_SUB_SIZE((duk_hbuffer *) (x), (dv))
-
-#define DUK_HBUFFER_EXTERNAL_GET_SIZE(x) DUK_HBUFFER_GET_SIZE((duk_hbuffer *) (x))
-#define DUK_HBUFFER_EXTERNAL_SET_SIZE(x,v) DUK_HBUFFER_SET_SIZE((duk_hbuffer *) (x), (v))
-
-#define DUK_HBUFFER_FIXED_GET_DATA_PTR(heap,x) ((duk_uint8_t *) (((duk_hbuffer_fixed *) (x)) + 1))
-
-#if defined(DUK_USE_HEAPPTR16)
-#define DUK_HBUFFER_DYNAMIC_GET_DATA_PTR(heap,x) \
- ((void *) DUK_USE_HEAPPTR_DEC16((heap)->heap_udata, ((duk_heaphdr *) (x))->h_extra16))
-#define DUK_HBUFFER_DYNAMIC_SET_DATA_PTR(heap,x,v) do { \
- ((duk_heaphdr *) (x))->h_extra16 = DUK_USE_HEAPPTR_ENC16((heap)->heap_udata, (void *) (v)); \
- } while (0)
-#define DUK_HBUFFER_DYNAMIC_SET_DATA_PTR_NULL(heap,x) do { \
- ((duk_heaphdr *) (x))->h_extra16 = 0; /* assume 0 <=> NULL */ \
- } while (0)
-#else
-#define DUK_HBUFFER_DYNAMIC_GET_DATA_PTR(heap,x) ((x)->curr_alloc)
-#define DUK_HBUFFER_DYNAMIC_SET_DATA_PTR(heap,x,v) do { \
- (x)->curr_alloc = (void *) (v); \
- } while (0)
-#define DUK_HBUFFER_DYNAMIC_SET_DATA_PTR_NULL(heap,x) do { \
- (x)->curr_alloc = (void *) NULL; \
- } while (0)
-#endif
-
-/* No pointer compression because pointer is potentially outside of
- * Duktape heap.
- */
-#if defined(DUK_USE_HEAPPTR16)
-#define DUK_HBUFFER_EXTERNAL_GET_DATA_PTR(heap,x) \
- ((void *) (x)->curr_alloc)
-#define DUK_HBUFFER_EXTERNAL_SET_DATA_PTR(heap,x,v) do { \
- (x)->curr_alloc = (void *) (v); \
- } while (0)
-#define DUK_HBUFFER_EXTERNAL_SET_DATA_PTR_NULL(heap,x) do { \
- (x)->curr_alloc = (void *) NULL; \
- } while (0)
-#else
-#define DUK_HBUFFER_EXTERNAL_GET_DATA_PTR(heap,x) \
- ((void *) (x)->curr_alloc)
-#define DUK_HBUFFER_EXTERNAL_SET_DATA_PTR(heap,x,v) do { \
- (x)->curr_alloc = (void *) (v); \
- } while (0)
-#define DUK_HBUFFER_EXTERNAL_SET_DATA_PTR_NULL(heap,x) do { \
- (x)->curr_alloc = (void *) NULL; \
- } while (0)
-#endif
-
-/* Get a pointer to the current buffer contents (matching current allocation
- * size). May be NULL for zero size dynamic/external buffer.
- */
-#if defined(DUK_USE_HEAPPTR16)
-#define DUK_HBUFFER_GET_DATA_PTR(heap,x) ( \
- DUK_HBUFFER_HAS_DYNAMIC((x)) ? \
- ( \
- DUK_HBUFFER_HAS_EXTERNAL((x)) ? \
- DUK_HBUFFER_EXTERNAL_GET_DATA_PTR((heap), (duk_hbuffer_external *) (x)) : \
- DUK_HBUFFER_DYNAMIC_GET_DATA_PTR((heap), (duk_hbuffer_dynamic *) (x)) \
- ) : \
- DUK_HBUFFER_FIXED_GET_DATA_PTR((heap), (duk_hbuffer_fixed *) (x)) \
- )
-#else
-/* Without heap pointer compression duk_hbuffer_dynamic and duk_hbuffer_external
- * have the same layout so checking for fixed vs. dynamic (or external) is enough.
- */
-#define DUK_HBUFFER_GET_DATA_PTR(heap,x) ( \
- DUK_HBUFFER_HAS_DYNAMIC((x)) ? \
- DUK_HBUFFER_DYNAMIC_GET_DATA_PTR((heap), (duk_hbuffer_dynamic *) (x)) : \
- DUK_HBUFFER_FIXED_GET_DATA_PTR((heap), (duk_hbuffer_fixed *) (x)) \
- )
-#endif
-
-/*
- * Structs
- */
-
-/* Shared prefix for all buffer types. */
-struct duk_hbuffer {
- duk_heaphdr hdr;
-
- /* It's not strictly necessary to track the current size, but
- * it is useful for writing robust native code.
- */
-
- /* Current size (not counting a dynamic buffer's "spare"). */
-#if defined(DUK_USE_BUFLEN16)
- /* Stored in duk_heaphdr unused flags. */
-#else
- duk_size_t size;
-#endif
-
- /*
- * Data following the header depends on the DUK_HBUFFER_FLAG_DYNAMIC
- * flag.
- *
- * If the flag is clear (the buffer is a fixed size one), the buffer
- * data follows the header directly, consisting of 'size' bytes.
- *
- * If the flag is set, the actual buffer is allocated separately, and
- * a few control fields follow the header. Specifically:
- *
- * - a "void *" pointing to the current allocation
- * - a duk_size_t indicating the full allocated size (always >= 'size')
- *
- * If DUK_HBUFFER_FLAG_EXTERNAL is set, the buffer has been allocated
- * by user code, so that Duktape won't be able to resize it and won't
- * free it. This allows buffers to point to e.g. an externally
- * allocated structure such as a frame buffer.
- *
- * Unlike strings, no terminator byte (NUL) is guaranteed after the
- * data. This would be convenient, but would pad aligned user buffers
- * unnecessarily upwards in size. For instance, if user code requested
- * a 64-byte dynamic buffer, 65 bytes would actually be allocated which
- * would then potentially round upwards to perhaps 68 or 72 bytes.
- */
-};
-
-/* Fixed buffer; data follows struct, with proper alignment guaranteed by
- * struct size.
- */
-#if (DUK_USE_ALIGN_BY == 8) && defined(DUK_USE_PACK_MSVC_PRAGMA)
-#pragma pack(push, 8)
-#endif
-struct duk_hbuffer_fixed {
- /* A union is used here as a portable struct size / alignment trick:
- * by adding a 32-bit or a 64-bit (unused) union member, the size of
- * the struct is effectively forced to be a multiple of 4 or 8 bytes
- * (respectively) without increasing the size of the struct unless
- * necessary.
- */
- union {
- struct {
- duk_heaphdr hdr;
-#if defined(DUK_USE_BUFLEN16)
- /* Stored in duk_heaphdr unused flags. */
-#else
- duk_size_t size;
-#endif
- } s;
-#if (DUK_USE_ALIGN_BY == 4)
- duk_uint32_t dummy_for_align4;
-#elif (DUK_USE_ALIGN_BY == 8)
- duk_double_t dummy_for_align8;
-#elif (DUK_USE_ALIGN_BY == 1)
- /* no extra padding */
-#else
-#error invalid DUK_USE_ALIGN_BY
-#endif
- } u;
-
- /*
- * Data follows the struct header. The struct size is padded by the
- * compiler based on the struct members. This guarantees that the
- * buffer data will be aligned-by-4 but not necessarily aligned-by-8.
- *
- * On platforms where alignment does not matter, the struct padding
- * could be removed (if there is any). On platforms where alignment
- * by 8 is required, the struct size must be forced to be a multiple
- * of 8 by some means. Without it, some user code may break, and also
- * Duktape itself breaks (e.g. the compiler stores duk_tvals in a
- * dynamic buffer).
- */
-}
-#if (DUK_USE_ALIGN_BY == 8) && defined(DUK_USE_PACK_GCC_ATTR)
-__attribute__ ((aligned (8)))
-#elif (DUK_USE_ALIGN_BY == 8) && defined(DUK_USE_PACK_CLANG_ATTR)
-__attribute__ ((aligned (8)))
-#endif
-;
-#if (DUK_USE_ALIGN_BY == 8) && defined(DUK_USE_PACK_MSVC_PRAGMA)
-#pragma pack(pop)
-#endif
-
-/* Dynamic buffer with 'curr_alloc' pointing to a dynamic area allocated using
- * heap allocation primitives. Also used for external buffers when low memory
- * options are not used.
- */
-struct duk_hbuffer_dynamic {
- duk_heaphdr hdr;
-
-#if defined(DUK_USE_BUFLEN16)
- /* Stored in duk_heaphdr unused flags. */
-#else
- duk_size_t size;
-#endif
-
-#if defined(DUK_USE_HEAPPTR16)
- /* Stored in duk_heaphdr h_extra16. */
-#else
- void *curr_alloc; /* may be NULL if alloc_size == 0 */
-#endif
-
- /*
- * Allocation size for 'curr_alloc' is alloc_size. There is no
- * automatic NUL terminator for buffers (see above for rationale).
- *
- * 'curr_alloc' is explicitly allocated with heap allocation
- * primitives and will thus always have alignment suitable for
- * e.g. duk_tval and an IEEE double.
- */
-};
-
-/* External buffer with 'curr_alloc' managed by user code and pointing to an
- * arbitrary address. When heap pointer compression is not used, this struct
- * has the same layout as duk_hbuffer_dynamic.
- */
-struct duk_hbuffer_external {
- duk_heaphdr hdr;
-
-#if defined(DUK_USE_BUFLEN16)
- /* Stored in duk_heaphdr unused flags. */
-#else
- duk_size_t size;
-#endif
-
- /* Cannot be compressed as a heap pointer because may point to
- * an arbitrary address.
- */
- void *curr_alloc; /* may be NULL if alloc_size == 0 */
-};
-
-/*
- * Prototypes
- */
-
-DUK_INTERNAL_DECL duk_hbuffer *duk_hbuffer_alloc(duk_heap *heap, duk_size_t size, duk_small_uint_t flags, void **out_bufdata);
-DUK_INTERNAL_DECL void *duk_hbuffer_get_dynalloc_ptr(duk_heap *heap, void *ud); /* indirect allocs */
-
-/* dynamic buffer ops */
-DUK_INTERNAL_DECL void duk_hbuffer_resize(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t new_size);
-DUK_INTERNAL_DECL void duk_hbuffer_reset(duk_hthread *thr, duk_hbuffer_dynamic *buf);
-
-#endif /* DUK_HBUFFER_H_INCLUDED */