Skip to content

Commit

Permalink
Merge pull request #51 from jessedoyle/duk-2.4.0
Browse files Browse the repository at this point in the history
Duktape 2.4.0
  • Loading branch information
jessedoyle committed Sep 7, 2019
2 parents 08e4047 + 2defa38 commit d4819c5
Show file tree
Hide file tree
Showing 16 changed files with 8,004 additions and 6,884 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
@@ -1,3 +1,11 @@
# v0.18.0 - Sept 6, 2019

- Update Duktape version to `2.4.0`.
- See the [release notes](https://github.com/svaarala/duktape/blob/bcb37439d6b0a589707f4d611962d7381868dce4/doc/release-notes-v2-4.rst) for more info.
- Add bindings for `to_stacktrace`, `safe_to_stacktrace`, `push_bare_array`, `require_constructable`, and `require_constructor_call`.
- Allow C compiler flag overrides when compiling Duktape. Define the `CFLAGS` variable during `shards install` (i.e. `CFLAGS=-O1 shards install`).
- No longer explicitly enable Duktape's Symbol builtin as it is now enabled by default.

# v0.17.0 - June 6, 2019

- Update `ameba` to the latest current version (`0.10.0`) as previous versions no longer compile in CI.
Expand Down Expand Up @@ -173,4 +181,4 @@ sbx = Duktape::Sandbox.new(500) # 500 millisecond execution limit

# v0.5.0 - September 8, 2015

- Intial public release.
- Initial public release.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -18,7 +18,7 @@ version: 1.0.0 # your project's version
dependencies:
duktape:
github: jessedoyle/duktape.cr
version: ~> 0.17.0
version: ~> 0.18.0
```

then execute:
Expand Down
2 changes: 1 addition & 1 deletion ext/Makefile
Expand Up @@ -7,7 +7,7 @@ OUTPUT := $(PREV)/src/.build
LIBDIR := $(OUTPUT)/lib
INCLUDEDIR := $(OUTPUT)/include

CFLAGS = \
CFLAGS ?= \
-pedantic \
-c \
-std=c99 \
Expand Down
168 changes: 122 additions & 46 deletions ext/duk_config.h
@@ -1,9 +1,9 @@
/*
* duk_config.h configuration header generated by genconfig.py.
*
* Git commit: 88a827f604ceb5d8b11ffe37e5d62419b4409bb2
* Git describe: 88a827f
* Git branch: duktape-2.3
* Git commit: d4f2cff1c592d70f58bab8e1bd85705174c02a58
* Git describe: v2.4.0
* Git branch: HEAD
*
* Supported platforms:
* - Mac OSX, iPhone, Darwin
Expand All @@ -18,6 +18,7 @@
* - QNX
* - TI-Nspire
* - Emscripten
* - Android
* - Linux
* - Solaris
* - AIX
Expand Down Expand Up @@ -170,6 +171,10 @@
#define DUK_F_BCC
#endif

#if defined(ANDROID) || defined(__ANDROID__)
#define DUK_F_ANDROID
#endif

/* Linux */
#if defined(__linux) || defined(__linux__) || defined(linux)
#define DUK_F_LINUX
Expand Down Expand Up @@ -246,9 +251,9 @@
#endif

/* ARM */
#if defined(__arm__) || defined(__thumb__) || defined(_ARM) || defined(_M_ARM) || defined(__aarch64__)
#if defined(__arm__) || defined(__thumb__) || defined(_ARM) || defined(_M_ARM) || defined(_M_ARM64) || defined(__aarch64__)
#define DUK_F_ARM
#if defined(__LP64__) || defined(_LP64) || defined(__arm64) || defined(__arm64__) || defined(__aarch64__)
#if defined(__LP64__) || defined(_LP64) || defined(__arm64) || defined(__arm64__) || defined(_M_ARM64) || defined(__aarch64__)
#define DUK_F_ARM64
#else
#define DUK_F_ARM32
Expand Down Expand Up @@ -356,10 +361,6 @@
#define DUK_F_VBCC
#endif

#if defined(ANDROID) || defined(__ANDROID__)
#define DUK_F_ANDROID
#endif

/* Atari Mint */
#if defined(__MINT__)
#define DUK_F_MINT
Expand Down Expand Up @@ -665,6 +666,41 @@
#define DUK_USE_DATE_FMT_STRFTIME

#define DUK_USE_OS_STRING "emscripten"
#elif defined(DUK_F_ANDROID)
/* --- Android --- */
#if defined(DUK_COMPILING_DUKTAPE)
#if !defined(_POSIX_C_SOURCE)
#define _POSIX_C_SOURCE 200809L
#endif
#if !defined(_GNU_SOURCE)
#define _GNU_SOURCE /* e.g. getdate_r */
#endif
#if !defined(_XOPEN_SOURCE)
#define _XOPEN_SOURCE /* e.g. strptime */
#endif
#endif /* DUK_COMPILING_DUKTAPE */

#include <sys/types.h>
#if defined(DUK_F_BCC)
/* no endian.h or stdint.h */
#else
#include <endian.h>
#include <stdint.h>
#endif /* DUK_F_BCC */
#include <sys/param.h>
#include <sys/time.h>
#include <time.h>

#define DUK_USE_DATE_NOW_GETTIMEOFDAY
#define DUK_USE_DATE_TZO_GMTIME_R
#define DUK_USE_DATE_PRS_STRPTIME
#define DUK_USE_DATE_FMT_STRFTIME

#if 0 /* XXX: safe condition? */
#define DUK_USE_GET_MONOTONIC_TIME_CLOCK_GETTIME
#endif

#define DUK_USE_OS_STRING "android"
#elif defined(DUK_F_LINUX)
/* --- Linux --- */
#if defined(DUK_COMPILING_DUKTAPE)
Expand Down Expand Up @@ -1069,6 +1105,18 @@

#undef DUK_USE_GCC_PRAGMAS
#define DUK_USE_PACK_CLANG_ATTR

#if defined(__clang__) && defined(__has_builtin)
#if __has_builtin(__builtin_bswap64)
#define DUK_BSWAP64(x) ((duk_uint64_t) __builtin_bswap64((duk_uint64_t) (x)))
#endif
#if __has_builtin(__builtin_bswap32)
#define DUK_BSWAP32(x) ((duk_uint32_t) __builtin_bswap32((duk_uint32_t) (x)))
#endif
#if __has_builtin(__builtin_bswap16)
#define DUK_BSWAP16(x) ((duk_uint16_t) __builtin_bswap16((duk_uint16_t) (x)))
#endif
#endif
#elif defined(DUK_F_GCC)
/* --- GCC --- */
#if defined(DUK_F_C99) || defined(DUK_F_CPP11)
Expand All @@ -1079,13 +1127,17 @@
#define DUK_VA_COPY(dest,src) __va_copy(dest,src)
#endif

#if defined(DUK_F_GCC_VERSION) && (DUK_F_GCC_VERSION >= 20500L)
/* since gcc-2.5 */
#if defined(DUK_F_GCC_VERSION) && (DUK_F_GCC_VERSION >= 20500L) && (DUK_F_GCC_VERSION < 50000L)
/* Since gcc-2.5.
*
* Disabled temporarily in GCC 5+ because of an unresolved noreturn-related
* issue: https://github.com/svaarala/duktape/issues/2155.
*/
#define DUK_NORETURN(decl) decl __attribute__((noreturn))
#endif

#if defined(DUK_F_GCC_VERSION) && (DUK_F_GCC_VERSION >= 40500L)
/* since gcc-4.5 */
/* Since gcc-4.5. */
#define DUK_UNREACHABLE() do { __builtin_unreachable(); } while (0)
#endif

Expand Down Expand Up @@ -1198,6 +1250,16 @@
#endif

#define DUK_USE_PACK_GCC_ATTR

/* Availability varies based on platform (between GCC 4.4 and 4.8), and there
* are apparently some bugs in GCC 4.x. Check for GCC 5.0 before enabling
* these to be safe.
*/
#if defined(DUK_F_GCC_VERSION) && (DUK_F_GCC_VERSION >= 50000L)
#define DUK_BSWAP64(x) ((duk_uint64_t) __builtin_bswap64((duk_uint64_t) (x)))
#define DUK_BSWAP32(x) ((duk_uint32_t) __builtin_bswap32((duk_uint32_t) (x)))
#define DUK_BSWAP16(x) ((duk_uint16_t) __builtin_bswap16((duk_uint16_t) (x)))
#endif
#elif defined(DUK_F_MSVC)
/* --- MSVC --- */
/* http://msdn.microsoft.com/en-us/library/aa235362(VS.60).aspx */
Expand Down Expand Up @@ -2504,7 +2566,7 @@ typedef struct duk_hthread duk_context;
#define DUK_USE_ALIGN_BY 8
#endif

/* Compiler specific hackery needed to force struct size to match aligment,
/* Compiler specific hackery needed to force struct size to match alignment,
* see e.g. duk_hbuffer.h.
*
* http://stackoverflow.com/questions/11130109/c-struct-size-alignment
Expand All @@ -2515,6 +2577,13 @@ typedef struct duk_hthread duk_context;
#define DUK_USE_PACK_DUMMY_MEMBER
#endif

#if !defined(DUK_U64_CONSTANT)
#define DUK_U64_CONSTANT(x) x##ULL
#endif
#if !defined(DUK_I64_CONSTANT)
#define DUK_I64_CONSTANT(x) x##LL
#endif

#if !defined(DUK_VA_COPY)
/* We need va_copy() which is defined in C99 / C++11, so an awkward
* replacement is needed for pre-C99 / pre-C++11 environments. This
Expand Down Expand Up @@ -2665,17 +2734,30 @@ typedef struct duk_hthread duk_context;
#endif
#endif

#if defined(DUK_F_HAVE_64BIT)
#if !defined(DUK_BSWAP64)
#define DUK_BSWAP64(x) \
((((duk_uint64_t) (x)) >> 56U) | \
((((duk_uint64_t) (x)) >> 40U) & DUK_U64_CONSTANT(0xff00)) | \
((((duk_uint64_t) (x)) >> 24U) & DUK_U64_CONSTANT(0xff0000)) | \
((((duk_uint64_t) (x)) >> 8U) & DUK_U64_CONSTANT(0xff000000)) | \
((((duk_uint64_t) (x)) << 8U) & DUK_U64_CONSTANT(0xff00000000)) | \
((((duk_uint64_t) (x)) << 24U) & DUK_U64_CONSTANT(0xff0000000000)) | \
((((duk_uint64_t) (x)) << 40U) & DUK_U64_CONSTANT(0xff000000000000)) | \
(((duk_uint64_t) (x)) << 56U))
#endif
#endif
#if !defined(DUK_BSWAP32)
#define DUK_BSWAP32(x) \
((((duk_uint32_t) (x)) >> 24) | \
((((duk_uint32_t) (x)) >> 8) & 0xff00UL) | \
((((duk_uint32_t) (x)) << 8) & 0xff0000UL) | \
(((duk_uint32_t) (x)) << 24))
((((duk_uint32_t) (x)) >> 24U) | \
((((duk_uint32_t) (x)) >> 8U) & 0xff00UL) | \
((((duk_uint32_t) (x)) << 8U) & 0xff0000UL) | \
(((duk_uint32_t) (x)) << 24U))
#endif
#if !defined(DUK_BSWAP16)
#define DUK_BSWAP16(x) \
((duk_uint16_t) (x) >> 8) | \
((duk_uint16_t) (x) << 8)
((duk_uint16_t) (x) >> 8U) | \
((duk_uint16_t) (x) << 8U)
#endif

/* DUK_USE_VARIADIC_MACROS: required from compilers, so no fill-in. */
Expand All @@ -2698,13 +2780,6 @@ typedef struct duk_hthread duk_context;
#undef DUK_USE_GCC_PRAGMAS
#endif

#if !defined(DUK_U64_CONSTANT)
#define DUK_U64_CONSTANT(x) x##ULL
#endif
#if !defined(DUK_I64_CONSTANT)
#define DUK_I64_CONSTANT(x) x##LL
#endif

/* Workaround for GH-323: avoid inlining control when compiling from
* multiple sources, as it causes compiler portability trouble.
*/
Expand Down Expand Up @@ -2798,7 +2873,6 @@ typedef struct duk_hthread duk_context;
#define DUK_USE_FASTINT
#define DUK_USE_INTERRUPT_COUNTER
#define DUK_USE_JSON_STRINGIFY_FASTPATH
#define DUK_USE_SYMBOL_BUILTIN
#define DUK_USE_TARGET_INFO "duktape.cr"

#undef DUK_USE_UNION_INITIALIZERS
Expand All @@ -2825,7 +2899,6 @@ typedef struct duk_hthread duk_context;
#define DUK_USE_CACHE_ACTIVATION
#define DUK_USE_CACHE_CATCHER
#define DUK_USE_CALLSTACK_LIMIT 10000
#define DUK_USE_COMMONJS_MODULES
#define DUK_USE_COMPILER_RECLIMIT 2500
#define DUK_USE_COROUTINE_SUPPORT
#undef DUK_USE_CPP_EXCEPTIONS
Expand Down Expand Up @@ -2925,6 +2998,7 @@ typedef struct duk_hthread duk_context;
#define DUK_USE_MARK_AND_SWEEP_RECLIMIT 256
#define DUK_USE_MATH_BUILTIN
#define DUK_USE_NATIVE_CALL_RECLIMIT 1000
#undef DUK_USE_NATIVE_STACK_CHECK
#define DUK_USE_NONSTD_ARRAY_SPLICE_DELCOUNT
#undef DUK_USE_NONSTD_FUNC_CALLER_PROPERTY
#undef DUK_USE_NONSTD_FUNC_SOURCE_PROPERTY
Expand Down Expand Up @@ -2975,10 +3049,29 @@ typedef struct duk_hthread duk_context;
#define DUK_USE_STRTAB_RESIZE_CHECK_MASK 255
#define DUK_USE_STRTAB_SHRINK_LIMIT 6
#undef DUK_USE_STRTAB_TORTURE
#define DUK_USE_SYMBOL_BUILTIN
#define DUK_USE_TAILCALL
#define DUK_USE_TRACEBACKS
#define DUK_USE_TRACEBACK_DEPTH 10
#define DUK_USE_USER_DECLARE() \
#define DUK_USE_VALSTACK_GROW_SHIFT 2
#define DUK_USE_VALSTACK_LIMIT 1000000L
#define DUK_USE_VALSTACK_SHRINK_CHECK_SHIFT 2
#define DUK_USE_VALSTACK_SHRINK_SLACK_SHIFT 4
#undef DUK_USE_VALSTACK_UNSAFE
#define DUK_USE_VERBOSE_ERRORS
#define DUK_USE_VERBOSE_EXECUTOR_ERRORS
#define DUK_USE_VOLUNTARY_GC
#define DUK_USE_ZERO_BUFFER_DATA

/*
* You may add overriding #define/#undef directives below for
* customization. You of course cannot un-#include or un-typedef
* anything; these require direct changes above.
*/

/* __OVERRIDE_DEFINES__ */
/* CUSTOM: timeout function */
#define DUK_CR_USE_USER_DECLARE() \
struct timeout_data \
{ \
struct timeval start; \
Expand Down Expand Up @@ -3017,23 +3110,6 @@ DUK_INTERNAL_DECL duk_bool_t duk_cr_timeout(void *udata) \
return 0; \
} \
}
#define DUK_USE_VALSTACK_GROW_SHIFT 2
#define DUK_USE_VALSTACK_LIMIT 1000000L
#define DUK_USE_VALSTACK_SHRINK_CHECK_SHIFT 2
#define DUK_USE_VALSTACK_SHRINK_SLACK_SHIFT 4
#undef DUK_USE_VALSTACK_UNSAFE
#define DUK_USE_VERBOSE_ERRORS
#define DUK_USE_VERBOSE_EXECUTOR_ERRORS
#define DUK_USE_VOLUNTARY_GC
#define DUK_USE_ZERO_BUFFER_DATA

/*
* You may add overriding #define/#undef directives below for
* customization. You of course cannot un-#include or un-typedef
* anything; these require direct changes above.
*/

/* __OVERRIDE_DEFINES__ */

/*
* Conditional includes
Expand Down

0 comments on commit d4819c5

Please sign in to comment.