Browse Source

Merge branch 'fix-single-file-visibility'

Add DUK_SINGLE_FILE which was missing.  This fix caused a lot of warnings
about unused static functions, so this fallout is also fixed by this merge.

Cygwin compile warning is also fixed by not using strptime() on Cygwin.
v1.0-maintenance
Sami Vaarala 10 years ago
parent
commit
c0e9aa0484
  1. 39
      src/duk_alloc_torture.c
  2. 8
      src/duk_api_internal.h
  3. 9
      src/duk_api_stack.c
  4. 1
      src/duk_bi_date.c
  5. 2
      src/duk_bi_protos.h
  6. 11
      src/duk_debug.h
  7. 14
      src/duk_debug_heap.c
  8. 2
      src/duk_debug_vsnprintf.c
  9. 18
      src/duk_features.h.in
  10. 12
      src/duk_hbuffer.h
  11. 17
      src/duk_hbuffer_ops.c
  12. 16
      src/duk_heap.h
  13. 6
      src/duk_heap_memory.c
  14. 4
      src/duk_heap_stringtable.c
  15. 8
      src/duk_js.h
  16. 4
      src/duk_js_var.c
  17. 2
      src/duk_strings.c
  18. 4
      src/duk_strings.h
  19. 2
      src/duktape.h.in
  20. 6
      src/dukutil.py
  21. 4
      src/extract_caseconv.py
  22. 2
      src/extract_chars.py
  23. 12
      src/genbuiltins.py
  24. 4
      src/genstrings.py
  25. 1
      util/make_dist.sh

39
src/duk_alloc_torture.c

@ -1,39 +0,0 @@
/*
* Torture allocation functions.
*
* Provides various debugging features:
*
* - Wraps allocations with "buffer zones" which are checked on free
* - Overwrites freed memory with garbage (not zero)
* - Debug prints memory usage info after every alloc/realloc/free
*
* Can be left out of a standard compilation.
*/
#include "duk_internal.h"
/* XXX: unimplemented */
DUK_INTERNAL void *duk_torture_alloc_function(void *udata, duk_size_t size) {
void *res;
DUK_UNREF(udata);
res = DUK_ANSI_MALLOC(size);
DUK_DDD(DUK_DDDPRINT("torture alloc function: %lu -> %p",
(unsigned long) size, (void *) res));
return res;
}
DUK_INTERNAL void *duk_torture_realloc_function(void *udata, void *ptr, duk_size_t newsize) {
void *res;
DUK_UNREF(udata);
res = DUK_ANSI_REALLOC(ptr, newsize);
DUK_DDD(DUK_DDDPRINT("torture realloc function: %p %lu -> %p",
(void *) ptr, (unsigned long) newsize, (void *) res));
return res;
}
DUK_INTERNAL void duk_torture_free_function(void *udata, void *ptr) {
DUK_DDD(DUK_DDDPRINT("torture free function: %p", (void *) ptr));
DUK_UNREF(udata);
DUK_ANSI_FREE(ptr);
}

8
src/duk_api_internal.h

@ -67,14 +67,18 @@ DUK_INTERNAL_DECL duk_hobject *duk_get_hobject(duk_context *ctx, duk_idx_t index
DUK_INTERNAL_DECL duk_hbuffer *duk_get_hbuffer(duk_context *ctx, duk_idx_t index); DUK_INTERNAL_DECL duk_hbuffer *duk_get_hbuffer(duk_context *ctx, duk_idx_t index);
DUK_INTERNAL_DECL duk_hthread *duk_get_hthread(duk_context *ctx, duk_idx_t index); DUK_INTERNAL_DECL duk_hthread *duk_get_hthread(duk_context *ctx, duk_idx_t index);
DUK_INTERNAL_DECL duk_hcompiledfunction *duk_get_hcompiledfunction(duk_context *ctx, duk_idx_t index); DUK_INTERNAL_DECL duk_hcompiledfunction *duk_get_hcompiledfunction(duk_context *ctx, duk_idx_t index);
#if 0 /*unused */
DUK_INTERNAL_DECL duk_hnativefunction *duk_get_hnativefunction(duk_context *ctx, duk_idx_t index); DUK_INTERNAL_DECL duk_hnativefunction *duk_get_hnativefunction(duk_context *ctx, duk_idx_t index);
#endif
#define duk_get_hobject_with_class(ctx,index,classnum) \ #define duk_get_hobject_with_class(ctx,index,classnum) \
((duk_hobject *) duk_get_tagged_heaphdr_raw((ctx), (index), \ ((duk_hobject *) duk_get_tagged_heaphdr_raw((ctx), (index), \
DUK_TAG_OBJECT | DUK_GETTAGGED_FLAG_ALLOW_NULL | \ DUK_TAG_OBJECT | DUK_GETTAGGED_FLAG_ALLOW_NULL | \
DUK_GETTAGGED_FLAG_CHECK_CLASS | ((classnum) << DUK_GETTAGGED_CLASS_SHIFT))) DUK_GETTAGGED_FLAG_CHECK_CLASS | ((classnum) << DUK_GETTAGGED_CLASS_SHIFT)))
#if 0 /*unused*/
DUK_INTERNAL_DECL void *duk_get_voidptr(duk_context *ctx, duk_idx_t index); DUK_INTERNAL_DECL void *duk_get_voidptr(duk_context *ctx, duk_idx_t index);
#endif
DUK_INTERNAL_DECL duk_hstring *duk_to_hstring(duk_context *ctx, duk_idx_t index); DUK_INTERNAL_DECL duk_hstring *duk_to_hstring(duk_context *ctx, duk_idx_t index);
DUK_INTERNAL_DECL duk_int_t duk_to_int_clamped_raw(duk_context *ctx, duk_idx_t index, duk_int_t minval, duk_int_t maxval, duk_bool_t *out_clamped); /* out_clamped=NULL, RangeError if outside range */ DUK_INTERNAL_DECL duk_int_t duk_to_int_clamped_raw(duk_context *ctx, duk_idx_t index, duk_int_t minval, duk_int_t maxval, duk_bool_t *out_clamped); /* out_clamped=NULL, RangeError if outside range */
@ -85,7 +89,9 @@ DUK_INTERNAL_DECL duk_hstring *duk_require_hstring(duk_context *ctx, duk_idx_t i
DUK_INTERNAL_DECL duk_hobject *duk_require_hobject(duk_context *ctx, duk_idx_t index); DUK_INTERNAL_DECL duk_hobject *duk_require_hobject(duk_context *ctx, duk_idx_t index);
DUK_INTERNAL_DECL duk_hbuffer *duk_require_hbuffer(duk_context *ctx, duk_idx_t index); DUK_INTERNAL_DECL duk_hbuffer *duk_require_hbuffer(duk_context *ctx, duk_idx_t index);
DUK_INTERNAL_DECL duk_hthread *duk_require_hthread(duk_context *ctx, duk_idx_t index); DUK_INTERNAL_DECL duk_hthread *duk_require_hthread(duk_context *ctx, duk_idx_t index);
#if 0 /*unused */
DUK_INTERNAL_DECL duk_hcompiledfunction *duk_require_hcompiledfunction(duk_context *ctx, duk_idx_t index); DUK_INTERNAL_DECL duk_hcompiledfunction *duk_require_hcompiledfunction(duk_context *ctx, duk_idx_t index);
#endif
DUK_INTERNAL_DECL duk_hnativefunction *duk_require_hnativefunction(duk_context *ctx, duk_idx_t index); DUK_INTERNAL_DECL duk_hnativefunction *duk_require_hnativefunction(duk_context *ctx, duk_idx_t index);
#define duk_require_hobject_with_class(ctx,index,classnum) \ #define duk_require_hobject_with_class(ctx,index,classnum) \
@ -93,7 +99,9 @@ DUK_INTERNAL_DECL duk_hnativefunction *duk_require_hnativefunction(duk_context *
DUK_TAG_OBJECT | \ DUK_TAG_OBJECT | \
DUK_GETTAGGED_FLAG_CHECK_CLASS | ((classnum) << DUK_GETTAGGED_CLASS_SHIFT))) DUK_GETTAGGED_FLAG_CHECK_CLASS | ((classnum) << DUK_GETTAGGED_CLASS_SHIFT)))
#if 0 /*unused*/
DUK_INTERNAL_DECL void duk_push_unused(duk_context *ctx); DUK_INTERNAL_DECL void duk_push_unused(duk_context *ctx);
#endif
DUK_INTERNAL_DECL void duk_push_hstring(duk_context *ctx, duk_hstring *h); DUK_INTERNAL_DECL void duk_push_hstring(duk_context *ctx, duk_hstring *h);
DUK_INTERNAL_DECL void duk_push_hstring_stridx(duk_context *ctx, duk_small_int_t stridx); DUK_INTERNAL_DECL void duk_push_hstring_stridx(duk_context *ctx, duk_small_int_t stridx);
DUK_INTERNAL_DECL void duk_push_hobject(duk_context *ctx, duk_hobject *h); DUK_INTERNAL_DECL void duk_push_hobject(duk_context *ctx, duk_hobject *h);

9
src/duk_api_stack.c

@ -1154,7 +1154,7 @@ DUK_EXTERNAL void *duk_require_pointer(duk_context *ctx, duk_idx_t index) {
return NULL; /* not reachable */ return NULL; /* not reachable */
} }
/* XXX: unused */ #if 0 /*unused*/
DUK_INTERNAL void *duk_get_voidptr(duk_context *ctx, duk_idx_t index) { DUK_INTERNAL void *duk_get_voidptr(duk_context *ctx, duk_idx_t index) {
duk_tval *tv; duk_tval *tv;
@ -1169,6 +1169,7 @@ DUK_INTERNAL void *duk_get_voidptr(duk_context *ctx, duk_idx_t index) {
return NULL; return NULL;
} }
#endif
DUK_EXTERNAL void *duk_get_buffer(duk_context *ctx, duk_idx_t index, duk_size_t *out_size) { DUK_EXTERNAL void *duk_get_buffer(duk_context *ctx, duk_idx_t index, duk_size_t *out_size) {
duk_tval *tv; duk_tval *tv;
@ -1316,6 +1317,7 @@ DUK_INTERNAL duk_hcompiledfunction *duk_get_hcompiledfunction(duk_context *ctx,
return (duk_hcompiledfunction *) h; return (duk_hcompiledfunction *) h;
} }
#if 0 /*unused*/
DUK_INTERNAL duk_hcompiledfunction *duk_require_hcompiledfunction(duk_context *ctx, duk_idx_t index) { DUK_INTERNAL duk_hcompiledfunction *duk_require_hcompiledfunction(duk_context *ctx, duk_idx_t index) {
duk_hthread *thr = (duk_hthread *) ctx; duk_hthread *thr = (duk_hthread *) ctx;
duk_hobject *h = (duk_hobject *) duk_get_tagged_heaphdr_raw(ctx, index, DUK_TAG_OBJECT); duk_hobject *h = (duk_hobject *) duk_get_tagged_heaphdr_raw(ctx, index, DUK_TAG_OBJECT);
@ -1325,7 +1327,9 @@ DUK_INTERNAL duk_hcompiledfunction *duk_require_hcompiledfunction(duk_context *c
} }
return (duk_hcompiledfunction *) h; return (duk_hcompiledfunction *) h;
} }
#endif
#if 0 /*unused */
DUK_INTERNAL duk_hnativefunction *duk_get_hnativefunction(duk_context *ctx, duk_idx_t index) { DUK_INTERNAL duk_hnativefunction *duk_get_hnativefunction(duk_context *ctx, duk_idx_t index) {
duk_hobject *h = (duk_hobject *) duk_get_tagged_heaphdr_raw(ctx, index, DUK_TAG_OBJECT | DUK_GETTAGGED_FLAG_ALLOW_NULL); duk_hobject *h = (duk_hobject *) duk_get_tagged_heaphdr_raw(ctx, index, DUK_TAG_OBJECT | DUK_GETTAGGED_FLAG_ALLOW_NULL);
if (h != NULL && !DUK_HOBJECT_IS_NATIVEFUNCTION(h)) { if (h != NULL && !DUK_HOBJECT_IS_NATIVEFUNCTION(h)) {
@ -1333,6 +1337,7 @@ DUK_INTERNAL duk_hnativefunction *duk_get_hnativefunction(duk_context *ctx, duk_
} }
return (duk_hnativefunction *) h; return (duk_hnativefunction *) h;
} }
#endif
DUK_INTERNAL duk_hnativefunction *duk_require_hnativefunction(duk_context *ctx, duk_idx_t index) { DUK_INTERNAL duk_hnativefunction *duk_require_hnativefunction(duk_context *ctx, duk_idx_t index) {
duk_hthread *thr = (duk_hthread *) ctx; duk_hthread *thr = (duk_hthread *) ctx;
@ -2357,12 +2362,14 @@ DUK_INTERNAL void duk_push_tval(duk_context *ctx, duk_tval *tv) {
thr->valstack_top++; thr->valstack_top++;
} }
#if 0 /*unused*/
DUK_INTERNAL void duk_push_unused(duk_context *ctx) { DUK_INTERNAL void duk_push_unused(duk_context *ctx) {
duk_tval tv; duk_tval tv;
DUK_ASSERT(ctx != NULL); DUK_ASSERT(ctx != NULL);
DUK_TVAL_SET_UNDEFINED_ACTUAL(&tv); DUK_TVAL_SET_UNDEFINED_ACTUAL(&tv);
duk_push_tval(ctx, &tv); duk_push_tval(ctx, &tv);
} }
#endif
DUK_EXTERNAL void duk_push_undefined(duk_context *ctx) { DUK_EXTERNAL void duk_push_undefined(duk_context *ctx) {
duk_tval tv; duk_tval tv;

1
src/duk_bi_date.c

@ -1093,6 +1093,7 @@ DUK_LOCAL void duk__timeval_to_parts(duk_double_t d, duk_int_t *parts, duk_doubl
* the value. In other words, although the UTC time is within the * the value. In other words, although the UTC time is within the
* Ecmascript range, the local part values can be just outside of it. * Ecmascript range, the local part values can be just outside of it.
*/ */
DUK_UNREF(duk__timeval_in_leeway_range);
DUK_ASSERT(duk__timeval_in_leeway_range(d)); DUK_ASSERT(duk__timeval_in_leeway_range(d));
/* these computations are guaranteed to be exact for the valid /* these computations are guaranteed to be exact for the valid

2
src/duk_bi_protos.h

@ -55,7 +55,6 @@ DUK_INTERNAL_DECL duk_ret_t duk_bi_date_prototype_tostring_shared(duk_context *c
DUK_INTERNAL_DECL duk_ret_t duk_bi_date_prototype_value_of(duk_context *ctx); DUK_INTERNAL_DECL duk_ret_t duk_bi_date_prototype_value_of(duk_context *ctx);
DUK_INTERNAL_DECL duk_ret_t duk_bi_date_prototype_to_json(duk_context *ctx); DUK_INTERNAL_DECL duk_ret_t duk_bi_date_prototype_to_json(duk_context *ctx);
DUK_INTERNAL_DECL duk_ret_t duk_bi_date_prototype_get_shared(duk_context *ctx); DUK_INTERNAL_DECL duk_ret_t duk_bi_date_prototype_get_shared(duk_context *ctx);
DUK_INTERNAL_DECL duk_ret_t duk_bi_date_prototype_get_time(duk_context *ctx);
DUK_INTERNAL_DECL duk_ret_t duk_bi_date_prototype_get_timezone_offset(duk_context *ctx); DUK_INTERNAL_DECL duk_ret_t duk_bi_date_prototype_get_timezone_offset(duk_context *ctx);
DUK_INTERNAL_DECL duk_ret_t duk_bi_date_prototype_set_shared(duk_context *ctx); DUK_INTERNAL_DECL duk_ret_t duk_bi_date_prototype_set_shared(duk_context *ctx);
DUK_INTERNAL_DECL duk_ret_t duk_bi_date_prototype_set_time(duk_context *ctx); DUK_INTERNAL_DECL duk_ret_t duk_bi_date_prototype_set_time(duk_context *ctx);
@ -159,7 +158,6 @@ DUK_INTERNAL_DECL duk_ret_t duk_bi_regexp_prototype_to_string(duk_context *ctx);
DUK_INTERNAL_DECL duk_ret_t duk_bi_string_constructor(duk_context *ctx); DUK_INTERNAL_DECL duk_ret_t duk_bi_string_constructor(duk_context *ctx);
DUK_INTERNAL_DECL duk_ret_t duk_bi_string_constructor_from_char_code(duk_context *ctx); DUK_INTERNAL_DECL duk_ret_t duk_bi_string_constructor_from_char_code(duk_context *ctx);
DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_to_string(duk_context *ctx); DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_to_string(duk_context *ctx);
DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_value_of(duk_context *ctx);
DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_char_at(duk_context *ctx); DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_char_at(duk_context *ctx);
DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_char_code_at(duk_context *ctx); DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_char_code_at(duk_context *ctx);
DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_concat(duk_context *ctx); DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_concat(duk_context *ctx);

11
src/duk_debug.h

@ -111,7 +111,9 @@
/* object dumpers */ /* object dumpers */
#if 0 /*unused*/
#define DUK_DEBUG_DUMP_HEAP(x) duk_debug_dump_heap((x)) #define DUK_DEBUG_DUMP_HEAP(x) duk_debug_dump_heap((x))
#endif
#define DUK_DEBUG_DUMP_HSTRING(x) /* XXX: unimplemented */ #define DUK_DEBUG_DUMP_HSTRING(x) /* XXX: unimplemented */
#define DUK_DEBUG_DUMP_HOBJECT(x) duk_debug_dump_hobject((x)) #define DUK_DEBUG_DUMP_HOBJECT(x) duk_debug_dump_hobject((x))
#define DUK_DEBUG_DUMP_HCOMPILEDFUNCTION(x) /* XXX: unimplemented */ #define DUK_DEBUG_DUMP_HCOMPILEDFUNCTION(x) /* XXX: unimplemented */
@ -168,7 +170,9 @@
#endif /* DUK_USE_VARIADIC_MACROS */ #endif /* DUK_USE_VARIADIC_MACROS */
#if 0 /*unused*/
#define DUK_DEBUG_DUMP_HEAP(x) #define DUK_DEBUG_DUMP_HEAP(x)
#endif
#define DUK_DEBUG_DUMP_HSTRING(x) #define DUK_DEBUG_DUMP_HSTRING(x)
#define DUK_DEBUG_DUMP_HOBJECT(x) #define DUK_DEBUG_DUMP_HOBJECT(x)
#define DUK_DEBUG_DUMP_HCOMPILEDFUNCTION(x) #define DUK_DEBUG_DUMP_HCOMPILEDFUNCTION(x)
@ -200,7 +204,9 @@ struct duk_fixedbuffer {
#ifdef DUK_USE_DEBUG #ifdef DUK_USE_DEBUG
DUK_INTERNAL_DECL duk_int_t duk_debug_vsnprintf(char *str, duk_size_t size, const char *format, va_list ap); DUK_INTERNAL_DECL duk_int_t duk_debug_vsnprintf(char *str, duk_size_t size, const char *format, va_list ap);
#if 0 /*unused*/
DUK_INTERNAL_DECL duk_int_t duk_debug_snprintf(char *str, duk_size_t size, const char *format, ...); DUK_INTERNAL_DECL duk_int_t duk_debug_snprintf(char *str, duk_size_t size, const char *format, ...);
#endif
DUK_INTERNAL_DECL void duk_debug_format_funcptr(char *buf, duk_size_t buf_size, duk_uint8_t *fptr, duk_size_t fptr_size); DUK_INTERNAL_DECL void duk_debug_format_funcptr(char *buf, duk_size_t buf_size, duk_uint8_t *fptr, duk_size_t fptr_size);
#ifdef DUK_USE_VARIADIC_MACROS #ifdef DUK_USE_VARIADIC_MACROS
@ -222,10 +228,13 @@ DUK_INTERNAL_DECL void duk_fb_sprintf(duk_fixedbuffer *fb, const char *fmt, ...)
DUK_INTERNAL_DECL void duk_fb_put_funcptr(duk_fixedbuffer *fb, duk_uint8_t *fptr, duk_size_t fptr_size); DUK_INTERNAL_DECL void duk_fb_put_funcptr(duk_fixedbuffer *fb, duk_uint8_t *fptr, duk_size_t fptr_size);
DUK_INTERNAL_DECL duk_bool_t duk_fb_is_full(duk_fixedbuffer *fb); DUK_INTERNAL_DECL duk_bool_t duk_fb_is_full(duk_fixedbuffer *fb);
#if 0 /*unused*/
DUK_INTERNAL_DECL void duk_debug_dump_heap(duk_heap *heap); DUK_INTERNAL_DECL void duk_debug_dump_heap(duk_heap *heap);
DUK_INTERNAL_DECL void duk_debug_heap_graphviz(duk_heap *heap); #endif
DUK_INTERNAL_DECL void duk_debug_dump_hobject(duk_hobject *obj); DUK_INTERNAL_DECL void duk_debug_dump_hobject(duk_hobject *obj);
#if 0 /*unimplemented*/
DUK_INTERNAL_DECL void duk_debug_dump_hthread(duk_hthread *thr); DUK_INTERNAL_DECL void duk_debug_dump_hthread(duk_hthread *thr);
#endif
DUK_INTERNAL_DECL void duk_debug_dump_callstack(duk_hthread *thr); DUK_INTERNAL_DECL void duk_debug_dump_callstack(duk_hthread *thr);
DUK_INTERNAL_DECL void duk_debug_dump_activation(duk_hthread *thr, duk_activation *act); DUK_INTERNAL_DECL void duk_debug_dump_activation(duk_hthread *thr, duk_activation *act);

14
src/duk_debug_heap.c

@ -6,6 +6,7 @@
#ifdef DUK_USE_DEBUG #ifdef DUK_USE_DEBUG
#if 0 /*unused*/
DUK_LOCAL void duk__sanitize_snippet(char *buf, duk_size_t buf_size, duk_hstring *str) { DUK_LOCAL void duk__sanitize_snippet(char *buf, duk_size_t buf_size, duk_hstring *str) {
duk_size_t i; duk_size_t i;
duk_size_t nchars; duk_size_t nchars;
@ -25,7 +26,9 @@ DUK_LOCAL void duk__sanitize_snippet(char *buf, duk_size_t buf_size, duk_hstring
buf[i] = (char) c; buf[i] = (char) c;
} }
} }
#endif
#if 0
DUK_LOCAL const char *duk__get_heap_type_string(duk_heaphdr *hdr) { DUK_LOCAL const char *duk__get_heap_type_string(duk_heaphdr *hdr) {
switch (DUK_HEAPHDR_GET_TYPE(hdr)) { switch (DUK_HEAPHDR_GET_TYPE(hdr)) {
case DUK_HTYPE_STRING: case DUK_HTYPE_STRING:
@ -38,7 +41,9 @@ DUK_LOCAL const char *duk__get_heap_type_string(duk_heaphdr *hdr) {
return "???"; return "???";
} }
} }
#endif
#if 0
DUK_LOCAL void duk__dump_indented(duk_heaphdr *obj, int index) { DUK_LOCAL void duk__dump_indented(duk_heaphdr *obj, int index) {
DUK_UNREF(obj); DUK_UNREF(obj);
DUK_UNREF(index); DUK_UNREF(index);
@ -61,7 +66,9 @@ DUK_LOCAL void duk__dump_indented(duk_heaphdr *obj, int index) {
(duk_heaphdr *) obj)); (duk_heaphdr *) obj));
#endif #endif
} }
#endif
#if 0 /*unused*/
DUK_LOCAL void duk__dump_heaphdr_list(duk_heap *heap, duk_heaphdr *root, const char *name) { DUK_LOCAL void duk__dump_heaphdr_list(duk_heap *heap, duk_heaphdr *root, const char *name) {
duk_int_t count; duk_int_t count;
duk_heaphdr *curr; duk_heaphdr *curr;
@ -86,7 +93,9 @@ DUK_LOCAL void duk__dump_heaphdr_list(duk_heap *heap, duk_heaphdr *root, const c
curr = DUK_HEAPHDR_GET_NEXT(curr); curr = DUK_HEAPHDR_GET_NEXT(curr);
} }
} }
#endif
#if 0 /*unused*/
DUK_LOCAL void duk__dump_stringtable(duk_heap *heap) { DUK_LOCAL void duk__dump_stringtable(duk_heap *heap) {
duk_uint_fast32_t i; duk_uint_fast32_t i;
char buf[64+1]; char buf[64+1];
@ -142,7 +151,9 @@ DUK_LOCAL void duk__dump_stringtable(duk_heap *heap) {
} }
} }
} }
#endif
#if 0 /*unused*/
DUK_LOCAL void duk__dump_strcache(duk_heap *heap) { DUK_LOCAL void duk__dump_strcache(duk_heap *heap) {
duk_uint_fast32_t i; duk_uint_fast32_t i;
char buf[64+1]; char buf[64+1];
@ -161,7 +172,9 @@ DUK_LOCAL void duk__dump_strcache(duk_heap *heap) {
} }
} }
} }
#endif
#if 0 /*unused*/
DUK_INTERNAL void duk_debug_dump_heap(duk_heap *heap) { DUK_INTERNAL void duk_debug_dump_heap(duk_heap *heap) {
char buf[64+1]; char buf[64+1];
@ -229,5 +242,6 @@ DUK_INTERNAL void duk_debug_dump_heap(duk_heap *heap) {
/* heap->strs: not worth dumping */ /* heap->strs: not worth dumping */
} }
#endif
#endif /* DUK_USE_DEBUG */ #endif /* DUK_USE_DEBUG */

2
src/duk_debug_vsnprintf.c

@ -960,6 +960,7 @@ DUK_INTERNAL duk_int_t duk_debug_vsnprintf(char *str, duk_size_t size, const cha
return retval; return retval;
} }
#if 0 /*unused*/
DUK_INTERNAL duk_int_t duk_debug_snprintf(char *str, duk_size_t size, const char *format, ...) { DUK_INTERNAL duk_int_t duk_debug_snprintf(char *str, duk_size_t size, const char *format, ...) {
duk_int_t retval; duk_int_t retval;
va_list ap; va_list ap;
@ -968,6 +969,7 @@ DUK_INTERNAL duk_int_t duk_debug_snprintf(char *str, duk_size_t size, const char
va_end(ap); va_end(ap);
return retval; return retval;
} }
#endif
/* Formatting function pointers is tricky: there is no standard pointer for /* Formatting function pointers is tricky: there is no standard pointer for
* function pointers and the size of a function pointer may depend on the * function pointers and the size of a function pointer may depend on the

18
src/duk_features.h.in

@ -177,12 +177,17 @@ static __inline__ unsigned long long duk_rdtsc(void) {
#define DUK_F_BSD #define DUK_F_BSD
#endif #endif
/* Generic Unix */ /* Generic Unix (includes Cygwin) */
#if defined(__unix) || defined(__unix__) || defined(unix) || \ #if defined(__unix) || defined(__unix__) || defined(unix) || \
defined(DUK_F_LINUX) || defined(DUK_F_BSD) defined(DUK_F_LINUX) || defined(DUK_F_BSD)
#define DUK_F_UNIX #define DUK_F_UNIX
#endif #endif
/* Cygwin */
#if defined(__CYGWIN__)
#define DUK_F_CYGWIN
#endif
/* Windows (32-bit or above) */ /* Windows (32-bit or above) */
#if defined(_WIN32) || defined(WIN32) || defined(_WIN64) || defined(WIN64) || \ #if defined(_WIN32) || defined(WIN32) || defined(_WIN64) || defined(WIN64) || \
defined(__WIN32__) || defined(__TOS_WIN__) || defined(__WINDOWS__) defined(__WIN32__) || defined(__TOS_WIN__) || defined(__WINDOWS__)
@ -482,6 +487,17 @@ static __inline__ unsigned long long duk_rdtsc(void) {
#include <sys/param.h> #include <sys/param.h>
#include <sys/time.h> #include <sys/time.h>
#include <time.h> #include <time.h>
#elif defined(DUK_F_CYGWIN)
/* Cygwin -- don't use strptime() for now */
#define DUK_USE_DATE_NOW_GETTIMEOFDAY
#define DUK_USE_DATE_TZO_GMTIME_R
#define DUK_USE_DATE_FMT_STRFTIME
#include <sys/types.h>
#include <endian.h>
#include <limits.h>
#include <sys/param.h>
#include <sys/time.h>
#include <time.h>
#else #else
/* Other UNIX, hopefully others */ /* Other UNIX, hopefully others */
#define DUK_USE_DATE_NOW_GETTIMEOFDAY #define DUK_USE_DATE_NOW_GETTIMEOFDAY

12
src/duk_hbuffer.h

@ -162,20 +162,32 @@ DUK_INTERNAL_DECL void *duk_hbuffer_get_dynalloc_ptr(void *ud); /* indirect all
/* dynamic buffer ops */ /* dynamic buffer ops */
DUK_INTERNAL_DECL void duk_hbuffer_resize(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t new_size, duk_size_t new_usable_size); DUK_INTERNAL_DECL void duk_hbuffer_resize(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t new_size, duk_size_t new_usable_size);
DUK_INTERNAL_DECL void duk_hbuffer_reset(duk_hthread *thr, duk_hbuffer_dynamic *buf); DUK_INTERNAL_DECL void duk_hbuffer_reset(duk_hthread *thr, duk_hbuffer_dynamic *buf);
#if 0 /*unused*/
DUK_INTERNAL_DECL void duk_hbuffer_compact(duk_hthread *thr, duk_hbuffer_dynamic *buf); DUK_INTERNAL_DECL void duk_hbuffer_compact(duk_hthread *thr, duk_hbuffer_dynamic *buf);
#endif
DUK_INTERNAL_DECL void duk_hbuffer_append_bytes(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_uint8_t *data, duk_size_t length); DUK_INTERNAL_DECL void duk_hbuffer_append_bytes(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_uint8_t *data, duk_size_t length);
DUK_INTERNAL_DECL void duk_hbuffer_append_byte(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_uint8_t byte); DUK_INTERNAL_DECL void duk_hbuffer_append_byte(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_uint8_t byte);
DUK_INTERNAL_DECL duk_size_t duk_hbuffer_append_cstring(duk_hthread *thr, duk_hbuffer_dynamic *buf, const char *str); DUK_INTERNAL_DECL duk_size_t duk_hbuffer_append_cstring(duk_hthread *thr, duk_hbuffer_dynamic *buf, const char *str);
DUK_INTERNAL_DECL duk_size_t duk_hbuffer_append_hstring(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_hstring *str); DUK_INTERNAL_DECL duk_size_t duk_hbuffer_append_hstring(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_hstring *str);
DUK_INTERNAL_DECL duk_size_t duk_hbuffer_append_xutf8(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_ucodepoint_t codepoint); DUK_INTERNAL_DECL duk_size_t duk_hbuffer_append_xutf8(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_ucodepoint_t codepoint);
DUK_INTERNAL_DECL duk_size_t duk_hbuffer_append_cesu8(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_ucodepoint_t codepoint); DUK_INTERNAL_DECL duk_size_t duk_hbuffer_append_cesu8(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_ucodepoint_t codepoint);
#if 0
DUK_INTERNAL_DECL void duk_hbuffer_append_native_u32(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_uint32_t val); DUK_INTERNAL_DECL void duk_hbuffer_append_native_u32(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_uint32_t val);
#endif
DUK_INTERNAL_DECL void duk_hbuffer_insert_bytes(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, duk_uint8_t *data, duk_size_t length); DUK_INTERNAL_DECL void duk_hbuffer_insert_bytes(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, duk_uint8_t *data, duk_size_t length);
#if 0 /*unused*/
DUK_INTERNAL_DECL void duk_hbuffer_insert_byte(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, duk_uint8_t byte); DUK_INTERNAL_DECL void duk_hbuffer_insert_byte(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, duk_uint8_t byte);
#endif
#if 0 /*unused*/
DUK_INTERNAL_DECL duk_size_t duk_hbuffer_insert_cstring(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, const char *str); DUK_INTERNAL_DECL duk_size_t duk_hbuffer_insert_cstring(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, const char *str);
#endif
#if 0 /*unused*/
DUK_INTERNAL_DECL duk_size_t duk_hbuffer_insert_hstring(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, duk_hstring *str); DUK_INTERNAL_DECL duk_size_t duk_hbuffer_insert_hstring(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, duk_hstring *str);
#endif
DUK_INTERNAL_DECL duk_size_t duk_hbuffer_insert_xutf8(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, duk_ucodepoint_t codepoint); DUK_INTERNAL_DECL duk_size_t duk_hbuffer_insert_xutf8(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, duk_ucodepoint_t codepoint);
#if 0 /*unused*/
DUK_INTERNAL_DECL duk_size_t duk_hbuffer_insert_cesu8(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, duk_ucodepoint_t codepoint); DUK_INTERNAL_DECL duk_size_t duk_hbuffer_insert_cesu8(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, duk_ucodepoint_t codepoint);
#endif
DUK_INTERNAL_DECL void duk_hbuffer_remove_slice(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, duk_size_t length); DUK_INTERNAL_DECL void duk_hbuffer_remove_slice(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, duk_size_t length);
DUK_INTERNAL_DECL void duk_hbuffer_insert_slice(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t dst_offset, duk_size_t src_offset, duk_size_t length); DUK_INTERNAL_DECL void duk_hbuffer_insert_slice(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t dst_offset, duk_size_t src_offset, duk_size_t length);
DUK_INTERNAL_DECL void duk_hbuffer_append_slice(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t src_offset, duk_size_t length); DUK_INTERNAL_DECL void duk_hbuffer_append_slice(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t src_offset, duk_size_t length);

17
src/duk_hbuffer_ops.c

@ -100,6 +100,7 @@ DUK_INTERNAL void duk_hbuffer_reset(duk_hthread *thr, duk_hbuffer_dynamic *buf)
duk_hbuffer_resize(thr, buf, 0, 0); duk_hbuffer_resize(thr, buf, 0, 0);
} }
#if 0 /*unused*/
DUK_INTERNAL void duk_hbuffer_compact(duk_hthread *thr, duk_hbuffer_dynamic *buf) { DUK_INTERNAL void duk_hbuffer_compact(duk_hthread *thr, duk_hbuffer_dynamic *buf) {
duk_size_t curr_size; duk_size_t curr_size;
@ -110,6 +111,7 @@ DUK_INTERNAL void duk_hbuffer_compact(duk_hthread *thr, duk_hbuffer_dynamic *buf
curr_size = DUK_HBUFFER_GET_SIZE(buf); curr_size = DUK_HBUFFER_GET_SIZE(buf);
duk_hbuffer_resize(thr, buf, curr_size, curr_size); duk_hbuffer_resize(thr, buf, curr_size, curr_size);
} }
#endif
/* /*
* Inserts * Inserts
@ -158,6 +160,7 @@ DUK_INTERNAL void duk_hbuffer_insert_bytes(duk_hthread *thr, duk_hbuffer_dynamic
buf->size += length; buf->size += length;
} }
#if 0 /*unused*/
DUK_INTERNAL void duk_hbuffer_insert_byte(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, duk_uint8_t byte) { DUK_INTERNAL void duk_hbuffer_insert_byte(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, duk_uint8_t byte) {
DUK_ASSERT(thr != NULL); DUK_ASSERT(thr != NULL);
DUK_ASSERT(buf != NULL); DUK_ASSERT(buf != NULL);
@ -165,7 +168,9 @@ DUK_INTERNAL void duk_hbuffer_insert_byte(duk_hthread *thr, duk_hbuffer_dynamic
duk_hbuffer_insert_bytes(thr, buf, offset, &byte, 1); duk_hbuffer_insert_bytes(thr, buf, offset, &byte, 1);
} }
#endif
#if 0 /*unused*/
DUK_INTERNAL duk_size_t duk_hbuffer_insert_cstring(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, const char *str) { DUK_INTERNAL duk_size_t duk_hbuffer_insert_cstring(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, const char *str) {
duk_size_t len; duk_size_t len;
@ -178,7 +183,9 @@ DUK_INTERNAL duk_size_t duk_hbuffer_insert_cstring(duk_hthread *thr, duk_hbuffer
duk_hbuffer_insert_bytes(thr, buf, offset, (duk_uint8_t *) str, len); duk_hbuffer_insert_bytes(thr, buf, offset, (duk_uint8_t *) str, len);
return len; return len;
} }
#endif
#if 0 /*unused*/
DUK_INTERNAL duk_size_t duk_hbuffer_insert_hstring(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, duk_hstring *str) { DUK_INTERNAL duk_size_t duk_hbuffer_insert_hstring(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, duk_hstring *str) {
duk_size_t len; duk_size_t len;
@ -191,6 +198,7 @@ DUK_INTERNAL duk_size_t duk_hbuffer_insert_hstring(duk_hthread *thr, duk_hbuffer
duk_hbuffer_insert_bytes(thr, buf, offset, (duk_uint8_t *) DUK_HSTRING_GET_DATA(str), len); duk_hbuffer_insert_bytes(thr, buf, offset, (duk_uint8_t *) DUK_HSTRING_GET_DATA(str), len);
return len; return len;
} }
#endif
DUK_INTERNAL duk_size_t duk_hbuffer_insert_xutf8(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, duk_ucodepoint_t codepoint) { DUK_INTERNAL duk_size_t duk_hbuffer_insert_xutf8(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, duk_ucodepoint_t codepoint) {
duk_uint8_t tmp[DUK_UNICODE_MAX_XUTF8_LENGTH]; duk_uint8_t tmp[DUK_UNICODE_MAX_XUTF8_LENGTH];
@ -214,6 +222,7 @@ DUK_INTERNAL duk_size_t duk_hbuffer_insert_xutf8(duk_hthread *thr, duk_hbuffer_d
* Codepoints above valid Unicode range (> U+10FFFF) are mangled. * Codepoints above valid Unicode range (> U+10FFFF) are mangled.
*/ */
#if 0 /*unused*/
DUK_INTERNAL duk_size_t duk_hbuffer_insert_cesu8(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, duk_ucodepoint_t codepoint) { DUK_INTERNAL duk_size_t duk_hbuffer_insert_cesu8(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t offset, duk_ucodepoint_t codepoint) {
duk_uint8_t tmp[DUK_UNICODE_MAX_CESU8_LENGTH]; duk_uint8_t tmp[DUK_UNICODE_MAX_CESU8_LENGTH];
duk_size_t len; duk_size_t len;
@ -230,6 +239,7 @@ DUK_INTERNAL duk_size_t duk_hbuffer_insert_cesu8(duk_hthread *thr, duk_hbuffer_d
duk_hbuffer_insert_bytes(thr, buf, offset, tmp, len); duk_hbuffer_insert_bytes(thr, buf, offset, tmp, len);
return len; return len;
} }
#endif
/* /*
* Appends * Appends
@ -339,10 +349,8 @@ DUK_INTERNAL duk_size_t duk_hbuffer_append_cesu8(duk_hthread *thr, duk_hbuffer_d
return len; return len;
} }
/* Append an duk_uint32_t in native byte order. This is used to emit bytecode /* Append an duk_uint32_t in native byte order. */
* instructions. #if 0 /*unused*/
*/
DUK_INTERNAL void duk_hbuffer_append_native_u32(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_uint32_t val) { DUK_INTERNAL void duk_hbuffer_append_native_u32(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_uint32_t val) {
/* relies on duk_uint32_t being exactly right size */ /* relies on duk_uint32_t being exactly right size */
DUK_ASSERT(sizeof(val) == 4); DUK_ASSERT(sizeof(val) == 4);
@ -352,6 +360,7 @@ DUK_INTERNAL void duk_hbuffer_append_native_u32(duk_hthread *thr, duk_hbuffer_dy
(duk_uint8_t *) &val, (duk_uint8_t *) &val,
sizeof(duk_uint32_t)); sizeof(duk_uint32_t));
} }
#endif
/* /*
* In-buffer "slices" * In-buffer "slices"

16
src/duk_heap.h

@ -241,18 +241,26 @@ typedef void *(*duk_mem_getptr)(void *ud);
/* XXX: add __func__; use DUK_FUNC_MACRO because __func__ is not always available */ /* XXX: add __func__; use DUK_FUNC_MACRO because __func__ is not always available */
#ifdef DUK_USE_VERBOSE_ERRORS #ifdef DUK_USE_VERBOSE_ERRORS
#if 0 /*unused*/
#define DUK_ALLOC_CHECKED(thr,size) duk_heap_mem_alloc_checked((thr), (size), DUK_FILE_MACRO, DUK_LINE_MACRO) #define DUK_ALLOC_CHECKED(thr,size) duk_heap_mem_alloc_checked((thr), (size), DUK_FILE_MACRO, DUK_LINE_MACRO)
#define DUK_ALLOC_CHECKED_ZEROED(thr,size) duk_heap_mem_alloc_checked_zeroed((thr), (size), DUK_FILE_MACRO, DUK_LINE_MACRO) #define DUK_ALLOC_CHECKED_ZEROED(thr,size) duk_heap_mem_alloc_checked_zeroed((thr), (size), DUK_FILE_MACRO, DUK_LINE_MACRO)
#define DUK_REALLOC_CHECKED(thr,ptr,newsize) duk_heap_mem_realloc_checked((thr), (ptr), (newsize), DUK_FILE_MACRO, DUK_LINE_MACRO) #define DUK_REALLOC_CHECKED(thr,ptr,newsize) duk_heap_mem_realloc_checked((thr), (ptr), (newsize), DUK_FILE_MACRO, DUK_LINE_MACRO)
#endif
#define DUK_REALLOC_INDIRECT_CHECKED(thr,cb,ud,newsize) duk_heap_mem_realloc_indirect_checked((thr), (cb), (ud), (newsize), DUK_FILE_MACRO, DUK_LINE_MACRO) #define DUK_REALLOC_INDIRECT_CHECKED(thr,cb,ud,newsize) duk_heap_mem_realloc_indirect_checked((thr), (cb), (ud), (newsize), DUK_FILE_MACRO, DUK_LINE_MACRO)
#if 0 /*unused*/
#define DUK_FREE_CHECKED(thr,ptr) duk_heap_mem_free((thr)->heap, (ptr)) /* must not fail */ #define DUK_FREE_CHECKED(thr,ptr) duk_heap_mem_free((thr)->heap, (ptr)) /* must not fail */
#endif
#else #else
#if 0 /*unused*/
#define DUK_ALLOC_CHECKED(thr,size) duk_heap_mem_alloc_checked((thr), (size)) #define DUK_ALLOC_CHECKED(thr,size) duk_heap_mem_alloc_checked((thr), (size))
#define DUK_ALLOC_CHECKED_ZEROED(thr,size) duk_heap_mem_alloc_checked_zeroed((thr), (size)) #define DUK_ALLOC_CHECKED_ZEROED(thr,size) duk_heap_mem_alloc_checked_zeroed((thr), (size))
#define DUK_REALLOC_CHECKED(thr,ptr,newsize) duk_heap_mem_realloc_checked((thr), (ptr), (newsize)) #define DUK_REALLOC_CHECKED(thr,ptr,newsize) duk_heap_mem_realloc_checked((thr), (ptr), (newsize))
#endif
#define DUK_REALLOC_INDIRECT_CHECKED(thr,cb,ud,newsize) duk_heap_mem_realloc_indirect_checked((thr), (cb), (ud), (newsize)) #define DUK_REALLOC_INDIRECT_CHECKED(thr,cb,ud,newsize) duk_heap_mem_realloc_indirect_checked((thr), (cb), (ud), (newsize))
#if 0 /*unused*/
#define DUK_FREE_CHECKED(thr,ptr) duk_heap_mem_free((thr)->heap, (ptr)) /* must not fail */ #define DUK_FREE_CHECKED(thr,ptr) duk_heap_mem_free((thr)->heap, (ptr)) /* must not fail */
#endif #endif
#endif
/* /*
* Memory constants * Memory constants
@ -412,10 +420,14 @@ DUK_INTERNAL_DECL void duk_heap_remove_any_from_heap_allocated(duk_heap *heap, d
DUK_INTERNAL_DECL void duk_heap_switch_thread(duk_heap *heap, duk_hthread *new_thr); DUK_INTERNAL_DECL void duk_heap_switch_thread(duk_heap *heap, duk_hthread *new_thr);
#endif #endif
#if 0 /*unused*/
DUK_INTERNAL_DECL duk_hstring *duk_heap_string_lookup(duk_heap *heap, duk_uint8_t *str, duk_uint32_t blen); DUK_INTERNAL_DECL duk_hstring *duk_heap_string_lookup(duk_heap *heap, duk_uint8_t *str, duk_uint32_t blen);
#endif
DUK_INTERNAL_DECL duk_hstring *duk_heap_string_intern(duk_heap *heap, duk_uint8_t *str, duk_uint32_t blen); DUK_INTERNAL_DECL duk_hstring *duk_heap_string_intern(duk_heap *heap, duk_uint8_t *str, duk_uint32_t blen);
DUK_INTERNAL_DECL duk_hstring *duk_heap_string_intern_checked(duk_hthread *thr, duk_uint8_t *str, duk_uint32_t len); DUK_INTERNAL_DECL duk_hstring *duk_heap_string_intern_checked(duk_hthread *thr, duk_uint8_t *str, duk_uint32_t len);
#if 0 /*unused*/
DUK_INTERNAL_DECL duk_hstring *duk_heap_string_lookup_u32(duk_heap *heap, duk_uint32_t val); DUK_INTERNAL_DECL duk_hstring *duk_heap_string_lookup_u32(duk_heap *heap, duk_uint32_t val);
#endif
DUK_INTERNAL_DECL duk_hstring *duk_heap_string_intern_u32(duk_heap *heap, duk_uint32_t val); DUK_INTERNAL_DECL duk_hstring *duk_heap_string_intern_u32(duk_heap *heap, duk_uint32_t val);
DUK_INTERNAL_DECL duk_hstring *duk_heap_string_intern_u32_checked(duk_hthread *thr, duk_uint32_t val); DUK_INTERNAL_DECL duk_hstring *duk_heap_string_intern_u32_checked(duk_hthread *thr, duk_uint32_t val);
DUK_INTERNAL_DECL void duk_heap_string_remove(duk_heap *heap, duk_hstring *h); DUK_INTERNAL_DECL void duk_heap_string_remove(duk_heap *heap, duk_hstring *h);
@ -439,14 +451,18 @@ DUK_INTERNAL_DECL void *duk_heap_mem_realloc_indirect(duk_heap *heap, duk_mem_ge
DUK_INTERNAL_DECL void duk_heap_mem_free(duk_heap *heap, void *ptr); DUK_INTERNAL_DECL void duk_heap_mem_free(duk_heap *heap, void *ptr);
#ifdef DUK_USE_VERBOSE_ERRORS #ifdef DUK_USE_VERBOSE_ERRORS
#if 0 /*unused*/
DUK_INTERNAL_DECL void *duk_heap_mem_alloc_checked(duk_hthread *thr, duk_size_t size, const char *filename, duk_int_t line); DUK_INTERNAL_DECL void *duk_heap_mem_alloc_checked(duk_hthread *thr, duk_size_t size, const char *filename, duk_int_t line);
DUK_INTERNAL_DECL void *duk_heap_mem_alloc_checked_zeroed(duk_hthread *thr, duk_size_t size, const char *filename, duk_int_t line); DUK_INTERNAL_DECL void *duk_heap_mem_alloc_checked_zeroed(duk_hthread *thr, duk_size_t size, const char *filename, duk_int_t line);
DUK_INTERNAL_DECL void *duk_heap_mem_realloc_checked(duk_hthread *thr, void *ptr, duk_size_t newsize, const char *filename, duk_int_t line); DUK_INTERNAL_DECL void *duk_heap_mem_realloc_checked(duk_hthread *thr, void *ptr, duk_size_t newsize, const char *filename, duk_int_t line);
#endif
DUK_INTERNAL_DECL void *duk_heap_mem_realloc_indirect_checked(duk_hthread *thr, duk_mem_getptr cb, void *ud, duk_size_t newsize, const char *filename, duk_int_t line); DUK_INTERNAL_DECL void *duk_heap_mem_realloc_indirect_checked(duk_hthread *thr, duk_mem_getptr cb, void *ud, duk_size_t newsize, const char *filename, duk_int_t line);
#else #else
#if 0 /*unused*/
DUK_INTERNAL_DECL void *duk_heap_mem_alloc_checked(duk_hthread *thr, duk_size_t size); DUK_INTERNAL_DECL void *duk_heap_mem_alloc_checked(duk_hthread *thr, duk_size_t size);
DUK_INTERNAL_DECL void *duk_heap_mem_alloc_checked_zeroed(duk_hthread *thr, duk_size_t size); DUK_INTERNAL_DECL void *duk_heap_mem_alloc_checked_zeroed(duk_hthread *thr, duk_size_t size);
DUK_INTERNAL_DECL void *duk_heap_mem_realloc_checked(duk_hthread *thr, void *ptr, duk_size_t newsize); DUK_INTERNAL_DECL void *duk_heap_mem_realloc_checked(duk_hthread *thr, void *ptr, duk_size_t newsize);
#endif
DUK_INTERNAL_DECL void *duk_heap_mem_realloc_indirect_checked(duk_hthread *thr, duk_mem_getptr cb, void *ud, duk_size_t newsize); DUK_INTERNAL_DECL void *duk_heap_mem_realloc_indirect_checked(duk_hthread *thr, duk_mem_getptr cb, void *ud, duk_size_t newsize);
#endif #endif

6
src/duk_heap_memory.c

@ -387,6 +387,7 @@ DUK_INTERNAL void duk_heap_mem_free(duk_heap *heap, void *ptr) {
* Checked variants * Checked variants
*/ */
#if 0 /*unused*/
#ifdef DUK_USE_VERBOSE_ERRORS #ifdef DUK_USE_VERBOSE_ERRORS
DUK_INTERNAL void *duk_heap_mem_alloc_checked(duk_hthread *thr, duk_size_t size, const char *filename, duk_int_t line) { DUK_INTERNAL void *duk_heap_mem_alloc_checked(duk_hthread *thr, duk_size_t size, const char *filename, duk_int_t line) {
#else #else
@ -407,7 +408,9 @@ DUK_INTERNAL void *duk_heap_mem_alloc_checked(duk_hthread *thr, duk_size_t size)
} }
return res; return res;
} }
#endif
#if 0 /*unused*/
#ifdef DUK_USE_VERBOSE_ERRORS #ifdef DUK_USE_VERBOSE_ERRORS
DUK_INTERNAL void *duk_heap_mem_alloc_checked_zeroed(duk_hthread *thr, duk_size_t size, const char *filename, duk_int_t line) { DUK_INTERNAL void *duk_heap_mem_alloc_checked_zeroed(duk_hthread *thr, duk_size_t size, const char *filename, duk_int_t line) {
#else #else
@ -430,7 +433,9 @@ DUK_INTERNAL void *duk_heap_mem_alloc_checked_zeroed(duk_hthread *thr, duk_size_
DUK_MEMZERO(res, size); DUK_MEMZERO(res, size);
return res; return res;
} }
#endif
#if 0 /*unused*/
#ifdef DUK_USE_VERBOSE_ERRORS #ifdef DUK_USE_VERBOSE_ERRORS
DUK_INTERNAL void *duk_heap_mem_realloc_checked(duk_hthread *thr, void *ptr, duk_size_t newsize, const char *filename, duk_int_t line) { DUK_INTERNAL void *duk_heap_mem_realloc_checked(duk_hthread *thr, void *ptr, duk_size_t newsize, const char *filename, duk_int_t line) {
#else #else
@ -452,6 +457,7 @@ DUK_INTERNAL void *duk_heap_mem_realloc_checked(duk_hthread *thr, void *ptr, duk
} }
return res; return res;
} }
#endif
#ifdef DUK_USE_VERBOSE_ERRORS #ifdef DUK_USE_VERBOSE_ERRORS
DUK_INTERNAL void *duk_heap_mem_realloc_indirect_checked(duk_hthread *thr, duk_mem_getptr cb, void *ud, duk_size_t newsize, const char *filename, duk_int_t line) { DUK_INTERNAL void *duk_heap_mem_realloc_indirect_checked(duk_hthread *thr, duk_mem_getptr cb, void *ud, duk_size_t newsize, const char *filename, duk_int_t line) {

4
src/duk_heap_stringtable.c

@ -393,10 +393,12 @@ DUK_LOCAL duk_hstring *duk__do_lookup(duk_heap *heap, duk_uint8_t *str, duk_uint
* Exposed calls * Exposed calls
*/ */
#if 0 /*unused*/
DUK_INTERNAL duk_hstring *duk_heap_string_lookup(duk_heap *heap, duk_uint8_t *str, duk_uint32_t blen) { DUK_INTERNAL duk_hstring *duk_heap_string_lookup(duk_heap *heap, duk_uint8_t *str, duk_uint32_t blen) {
duk_uint32_t strhash; /* dummy */ duk_uint32_t strhash; /* dummy */
return duk__do_lookup(heap, str, blen, &strhash); return duk__do_lookup(heap, str, blen, &strhash);
} }
#endif
DUK_INTERNAL duk_hstring *duk_heap_string_intern(duk_heap *heap, duk_uint8_t *str, duk_uint32_t blen) { DUK_INTERNAL duk_hstring *duk_heap_string_intern(duk_heap *heap, duk_uint8_t *str, duk_uint32_t blen) {
duk_hstring *res; duk_hstring *res;
@ -422,6 +424,7 @@ DUK_INTERNAL duk_hstring *duk_heap_string_intern_checked(duk_hthread *thr, duk_u
return res; return res;
} }
#if 0 /*unused*/
DUK_INTERNAL duk_hstring *duk_heap_string_lookup_u32(duk_heap *heap, duk_uint32_t val) { DUK_INTERNAL duk_hstring *duk_heap_string_lookup_u32(duk_heap *heap, duk_uint32_t val) {
char buf[DUK_STRTAB_U32_MAX_STRLEN+1]; char buf[DUK_STRTAB_U32_MAX_STRLEN+1];
DUK_SNPRINTF(buf, sizeof(buf), "%lu", (unsigned long) val); DUK_SNPRINTF(buf, sizeof(buf), "%lu", (unsigned long) val);
@ -429,6 +432,7 @@ DUK_INTERNAL duk_hstring *duk_heap_string_lookup_u32(duk_heap *heap, duk_uint32_
DUK_ASSERT(DUK_STRLEN(buf) <= DUK_UINT32_MAX); /* formatted result limited */ DUK_ASSERT(DUK_STRLEN(buf) <= DUK_UINT32_MAX); /* formatted result limited */
return duk_heap_string_lookup(heap, (duk_uint8_t *) buf, (duk_uint32_t) DUK_STRLEN(buf)); return duk_heap_string_lookup(heap, (duk_uint8_t *) buf, (duk_uint32_t) DUK_STRLEN(buf));
} }
#endif
DUK_INTERNAL duk_hstring *duk_heap_string_intern_u32(duk_heap *heap, duk_uint32_t val) { DUK_INTERNAL duk_hstring *duk_heap_string_intern_u32(duk_heap *heap, duk_uint32_t val) {
char buf[DUK_STRTAB_U32_MAX_STRLEN+1]; char buf[DUK_STRTAB_U32_MAX_STRLEN+1];

8
src/duk_js.h

@ -26,11 +26,8 @@ DUK_INTERNAL_DECL duk_bool_t duk_js_toboolean(duk_tval *tv);
DUK_INTERNAL_DECL duk_double_t duk_js_tonumber(duk_hthread *thr, duk_tval *tv); DUK_INTERNAL_DECL duk_double_t duk_js_tonumber(duk_hthread *thr, duk_tval *tv);
DUK_INTERNAL_DECL duk_double_t duk_js_tointeger_number(duk_double_t x); DUK_INTERNAL_DECL duk_double_t duk_js_tointeger_number(duk_double_t x);
DUK_INTERNAL_DECL duk_double_t duk_js_tointeger(duk_hthread *thr, duk_tval *tv); DUK_INTERNAL_DECL duk_double_t duk_js_tointeger(duk_hthread *thr, duk_tval *tv);
DUK_INTERNAL_DECL duk_uint32_t duk_js_touint32_number(duk_double_t x);
DUK_INTERNAL_DECL duk_uint32_t duk_js_touint32(duk_hthread *thr, duk_tval *tv); DUK_INTERNAL_DECL duk_uint32_t duk_js_touint32(duk_hthread *thr, duk_tval *tv);
DUK_INTERNAL_DECL duk_int32_t duk_js_toint32_number(duk_double_t x);
DUK_INTERNAL_DECL duk_int32_t duk_js_toint32(duk_hthread *thr, duk_tval *tv); DUK_INTERNAL_DECL duk_int32_t duk_js_toint32(duk_hthread *thr, duk_tval *tv);
DUK_INTERNAL_DECL duk_uint16_t duk_js_touint16_number(duk_double_t x);
DUK_INTERNAL_DECL duk_uint16_t duk_js_touint16(duk_hthread *thr, duk_tval *tv); DUK_INTERNAL_DECL duk_uint16_t duk_js_touint16(duk_hthread *thr, duk_tval *tv);
DUK_INTERNAL_DECL duk_small_int_t duk_js_to_arrayindex_raw_string(duk_uint8_t *str, duk_uint32_t blen, duk_uarridx_t *out_idx); DUK_INTERNAL_DECL duk_small_int_t duk_js_to_arrayindex_raw_string(duk_uint8_t *str, duk_uint32_t blen, duk_uarridx_t *out_idx);
DUK_INTERNAL_DECL duk_uarridx_t duk_js_to_arrayindex_string_helper(duk_hstring *h); DUK_INTERNAL_DECL duk_uarridx_t duk_js_to_arrayindex_string_helper(duk_hstring *h);
@ -65,11 +62,16 @@ DUK_INTERNAL_DECL duk_hstring *duk_js_typeof(duk_hthread *thr, duk_tval *tv_x);
duk_js_compare_helper((thr), (tv_x), (tv_y), DUK_COMPARE_FLAG_EVAL_LEFT_FIRST | DUK_COMPARE_FLAG_NEGATE) duk_js_compare_helper((thr), (tv_x), (tv_y), DUK_COMPARE_FLAG_EVAL_LEFT_FIRST | DUK_COMPARE_FLAG_NEGATE)
/* identifiers and environment handling */ /* identifiers and environment handling */
#if 0 /*unused*/
DUK_INTERNAL duk_bool_t duk_js_hasvar_envrec(duk_hthread *thr, duk_hobject *env, duk_hstring *name);
#endif
DUK_INTERNAL_DECL duk_bool_t duk_js_getvar_envrec(duk_hthread *thr, duk_hobject *env, duk_hstring *name, duk_bool_t throw_flag); DUK_INTERNAL_DECL duk_bool_t duk_js_getvar_envrec(duk_hthread *thr, duk_hobject *env, duk_hstring *name, duk_bool_t throw_flag);
DUK_INTERNAL_DECL duk_bool_t duk_js_getvar_activation(duk_hthread *thr, duk_activation *act, duk_hstring *name, duk_bool_t throw_flag); DUK_INTERNAL_DECL duk_bool_t duk_js_getvar_activation(duk_hthread *thr, duk_activation *act, duk_hstring *name, duk_bool_t throw_flag);
DUK_INTERNAL_DECL void duk_js_putvar_envrec(duk_hthread *thr, duk_hobject *env, duk_hstring *name, duk_tval *val, duk_bool_t strict); DUK_INTERNAL_DECL void duk_js_putvar_envrec(duk_hthread *thr, duk_hobject *env, duk_hstring *name, duk_tval *val, duk_bool_t strict);
DUK_INTERNAL_DECL void duk_js_putvar_activation(duk_hthread *thr, duk_activation *act, duk_hstring *name, duk_tval *val, duk_bool_t strict); DUK_INTERNAL_DECL void duk_js_putvar_activation(duk_hthread *thr, duk_activation *act, duk_hstring *name, duk_tval *val, duk_bool_t strict);
#if 0 /*unused*/
DUK_INTERNAL_DECL duk_bool_t duk_js_delvar_envrec(duk_hthread *thr, duk_hobject *env, duk_hstring *name); DUK_INTERNAL_DECL duk_bool_t duk_js_delvar_envrec(duk_hthread *thr, duk_hobject *env, duk_hstring *name);
#endif
DUK_INTERNAL_DECL duk_bool_t duk_js_delvar_activation(duk_hthread *thr, duk_activation *act, duk_hstring *name); DUK_INTERNAL_DECL duk_bool_t duk_js_delvar_activation(duk_hthread *thr, duk_activation *act, duk_hstring *name);
DUK_INTERNAL_DECL duk_bool_t duk_js_declvar_activation(duk_hthread *thr, duk_activation *act, duk_hstring *name, duk_tval *val, duk_small_int_t prop_flags, duk_bool_t is_func_decl); DUK_INTERNAL_DECL duk_bool_t duk_js_declvar_activation(duk_hthread *thr, duk_activation *act, duk_hstring *name, duk_tval *val, duk_small_int_t prop_flags, duk_bool_t is_func_decl);
DUK_INTERNAL_DECL void duk_js_init_activation_environment_records_delayed(duk_hthread *thr, duk_activation *act); DUK_INTERNAL_DECL void duk_js_init_activation_environment_records_delayed(duk_hthread *thr, duk_activation *act);

4
src/duk_js_var.c

@ -1117,6 +1117,7 @@ duk_bool_t duk__get_identifier_reference(duk_hthread *thr,
* a 'strict' parameter. * a 'strict' parameter.
*/ */
#if 0 /*unused*/
DUK_INTERNAL DUK_INTERNAL
duk_bool_t duk_js_hasvar_envrec(duk_hthread *thr, duk_bool_t duk_js_hasvar_envrec(duk_hthread *thr,
duk_hobject *env, duk_hobject *env,
@ -1143,6 +1144,7 @@ duk_bool_t duk_js_hasvar_envrec(duk_hthread *thr,
parents = 0; parents = 0;
return duk__get_identifier_reference(thr, env, name, NULL, parents, &ref); return duk__get_identifier_reference(thr, env, name, NULL, parents, &ref);
} }
#endif
/* /*
* GETVAR * GETVAR
@ -1452,12 +1454,14 @@ duk_bool_t duk__delvar_helper(duk_hthread *thr,
return 1; return 1;
} }
#if 0 /*unused*/
DUK_INTERNAL DUK_INTERNAL
duk_bool_t duk_js_delvar_envrec(duk_hthread *thr, duk_bool_t duk_js_delvar_envrec(duk_hthread *thr,
duk_hobject *env, duk_hobject *env,
duk_hstring *name) { duk_hstring *name) {
return duk__delvar_helper(thr, env, NULL, name); return duk__delvar_helper(thr, env, NULL, name);
} }
#endif
DUK_INTERNAL DUK_INTERNAL
duk_bool_t duk_js_delvar_activation(duk_hthread *thr, duk_bool_t duk_js_delvar_activation(duk_hthread *thr,

2
src/duk_strings.c

@ -30,7 +30,9 @@ DUK_INTERNAL const char *duk_str_not_buffer = "not buffer";
DUK_INTERNAL const char *duk_str_not_object = "not object"; DUK_INTERNAL const char *duk_str_not_object = "not object";
DUK_INTERNAL const char *duk_str_unexpected_type = "unexpected type"; DUK_INTERNAL const char *duk_str_unexpected_type = "unexpected type";
DUK_INTERNAL const char *duk_str_not_thread = "not thread"; DUK_INTERNAL const char *duk_str_not_thread = "not thread";
#if 0 /*unused*/
DUK_INTERNAL const char *duk_str_not_compiledfunction = "not compiledfunction"; DUK_INTERNAL const char *duk_str_not_compiledfunction = "not compiledfunction";
#endif
DUK_INTERNAL const char *duk_str_not_nativefunction = "not nativefunction"; DUK_INTERNAL const char *duk_str_not_nativefunction = "not nativefunction";
DUK_INTERNAL const char *duk_str_not_c_function = "not c function"; DUK_INTERNAL const char *duk_str_not_c_function = "not c function";
DUK_INTERNAL const char *duk_str_defaultvalue_coerce_failed = "[[DefaultValue]] coerce failed"; DUK_INTERNAL const char *duk_str_defaultvalue_coerce_failed = "[[DefaultValue]] coerce failed";

4
src/duk_strings.h

@ -52,7 +52,9 @@ DUK_INTERNAL_DECL const char *duk_str_not_configurable;
#define DUK_STR_NOT_OBJECT duk_str_not_object #define DUK_STR_NOT_OBJECT duk_str_not_object
#define DUK_STR_UNEXPECTED_TYPE duk_str_unexpected_type #define DUK_STR_UNEXPECTED_TYPE duk_str_unexpected_type
#define DUK_STR_NOT_THREAD duk_str_not_thread #define DUK_STR_NOT_THREAD duk_str_not_thread
#if 0 /*unused*/
#define DUK_STR_NOT_COMPILEDFUNCTION duk_str_not_compiledfunction #define DUK_STR_NOT_COMPILEDFUNCTION duk_str_not_compiledfunction
#endif
#define DUK_STR_NOT_NATIVEFUNCTION duk_str_not_nativefunction #define DUK_STR_NOT_NATIVEFUNCTION duk_str_not_nativefunction
#define DUK_STR_NOT_C_FUNCTION duk_str_not_c_function #define DUK_STR_NOT_C_FUNCTION duk_str_not_c_function
#define DUK_STR_DEFAULTVALUE_COERCE_FAILED duk_str_defaultvalue_coerce_failed #define DUK_STR_DEFAULTVALUE_COERCE_FAILED duk_str_defaultvalue_coerce_failed
@ -89,7 +91,9 @@ DUK_INTERNAL_DECL const char *duk_str_not_buffer;
DUK_INTERNAL_DECL const char *duk_str_not_object; DUK_INTERNAL_DECL const char *duk_str_not_object;
DUK_INTERNAL_DECL const char *duk_str_unexpected_type; DUK_INTERNAL_DECL const char *duk_str_unexpected_type;
DUK_INTERNAL_DECL const char *duk_str_not_thread; DUK_INTERNAL_DECL const char *duk_str_not_thread;
#if 0 /*unused*/
DUK_INTERNAL_DECL const char *duk_str_not_compiledfunction; DUK_INTERNAL_DECL const char *duk_str_not_compiledfunction;
#endif
DUK_INTERNAL_DECL const char *duk_str_not_nativefunction; DUK_INTERNAL_DECL const char *duk_str_not_nativefunction;
DUK_INTERNAL_DECL const char *duk_str_not_c_function; DUK_INTERNAL_DECL const char *duk_str_not_c_function;
DUK_INTERNAL_DECL const char *duk_str_defaultvalue_coerce_failed; DUK_INTERNAL_DECL const char *duk_str_defaultvalue_coerce_failed;

2
src/duktape.h.in

@ -20,6 +20,8 @@
#ifndef DUKTAPE_H_INCLUDED #ifndef DUKTAPE_H_INCLUDED
#define DUKTAPE_H_INCLUDED #define DUKTAPE_H_INCLUDED
@DUK_SINGLE_FILE@
@DUK_FEATURES_H@ @DUK_FEATURES_H@
@DUK_API_PUBLIC_H@ @DUK_API_PUBLIC_H@

6
src/dukutil.py

@ -90,7 +90,7 @@ class GenerateC:
self.emitLine(' */') self.emitLine(' */')
self.emitLine('') self.emitLine('')
def emitArray(self, data, tablename, visibility=None, typename='char', bytesize=None, intvalues=False, const=True): def emitArray(self, data, tablename, visibility=None, typename='char', size=None, intvalues=False, const=True):
"Emit an array as a C array." "Emit an array as a C array."
# lenient input # lenient input
@ -103,8 +103,8 @@ class GenerateC:
data = tmp data = tmp
size_spec = '' size_spec = ''
if bytesize is not None: if size is not None:
size_spec = '%d' % bytesize size_spec = '%d' % size
visib_qual = '' visib_qual = ''
if visibility is not None: if visibility is not None:
visib_qual = visibility + ' ' visib_qual = visibility + ' '

4
src/extract_caseconv.py

@ -378,8 +378,8 @@ def main():
# Generate C source and header files # Generate C source and header files
genc = dukutil.GenerateC() genc = dukutil.GenerateC()
genc.emitHeader('extract_caseconv.py') genc.emitHeader('extract_caseconv.py')
genc.emitArray(uc_bytes, opts.table_name_uc, bytesize=len(uc_bytes), typename='duk_uint8_t', intvalues=True, const=True) genc.emitArray(uc_bytes, opts.table_name_uc, size=len(uc_bytes), typename='duk_uint8_t', intvalues=True, const=True)
genc.emitArray(lc_bytes, opts.table_name_lc, bytesize=len(lc_bytes), typename='duk_uint8_t', intvalues=True, const=True) genc.emitArray(lc_bytes, opts.table_name_lc, size=len(lc_bytes), typename='duk_uint8_t', intvalues=True, const=True)
f = open(opts.out_source, 'wb') f = open(opts.out_source, 'wb')
f.write(genc.getString()) f.write(genc.getString())
f.close() f.close()

2
src/extract_chars.py

@ -331,7 +331,7 @@ def main():
# Create C source and header files # Create C source and header files
genc = dukutil.GenerateC() genc = dukutil.GenerateC()
genc.emitHeader('extract_chars.py') genc.emitHeader('extract_chars.py')
genc.emitArray(matchtable3, opts.table_name, bytesize=len(matchtable3), typename='duk_uint8_t', intvalues=True, const=True) genc.emitArray(matchtable3, opts.table_name, size=len(matchtable3), typename='duk_uint8_t', intvalues=True, const=True)
if opts.out_source is not None: if opts.out_source is not None:
f = open(opts.out_source, 'wb') f = open(opts.out_source, 'wb')
f.write(genc.getString()) f.write(genc.getString())

12
src/genbuiltins.py

@ -1443,7 +1443,7 @@ class GenBuiltins:
def writeNativeFuncArray(self, genc): def writeNativeFuncArray(self, genc):
genc.emitLine('/* native functions: %d */' % len(self.native_func_list)) genc.emitLine('/* native functions: %d */' % len(self.native_func_list))
genc.emitLine('const duk_c_function duk_bi_native_functions[] = {') genc.emitLine('DUK_INTERNAL const duk_c_function duk_bi_native_functions[%d] = {' % len(self.native_func_list))
for i in self.native_func_list: for i in self.native_func_list:
# The function pointer cast here makes BCC complain about # The function pointer cast here makes BCC complain about
# "initializer too complicated", so omit the cast. # "initializer too complicated", so omit the cast.
@ -1771,19 +1771,19 @@ class GenBuiltins:
genc.emitLine('') genc.emitLine('')
self.writeNativeFuncArray(genc) self.writeNativeFuncArray(genc)
genc.emitLine('') genc.emitLine('')
genc.emitArray(self.init_data, 'duk_builtins_data', visibility='DUK_INTERNAL', typename='duk_uint8_t', intvalues=True, const=True) genc.emitArray(self.init_data, 'duk_builtins_data', visibility='DUK_INTERNAL', typename='duk_uint8_t', intvalues=True, const=True, size=len(self.init_data))
genc.emitLine('#ifdef DUK_USE_BUILTIN_INITJS') genc.emitLine('#ifdef DUK_USE_BUILTIN_INITJS')
genc.emitArray(self.initjs_data, 'duk_initjs_data', visibility='DUK_INTERNAL', typename='duk_uint8_t', intvalues=True, const=True) genc.emitArray(self.initjs_data, 'duk_initjs_data', visibility='DUK_INTERNAL', typename='duk_uint8_t', intvalues=True, const=True, size=len(self.initjs_data))
genc.emitLine('#endif /* DUK_USE_BUILTIN_INITJS */') genc.emitLine('#endif /* DUK_USE_BUILTIN_INITJS */')
def emitHeader(self, genc): def emitHeader(self, genc):
self.gs.emitStringsHeader(genc) self.gs.emitStringsHeader(genc)
genc.emitLine('') genc.emitLine('')
genc.emitLine('DUK_INTERNAL_DECL const duk_c_function duk_bi_native_functions[];') genc.emitLine('DUK_INTERNAL_DECL const duk_c_function duk_bi_native_functions[%s];' % len(self.native_func_list))
genc.emitLine('DUK_INTERNAL_DECL const duk_uint8_t duk_builtins_data[];') genc.emitLine('DUK_INTERNAL_DECL const duk_uint8_t duk_builtins_data[%d];' % len(self.init_data))
genc.emitLine('#ifdef DUK_USE_BUILTIN_INITJS') genc.emitLine('#ifdef DUK_USE_BUILTIN_INITJS')
genc.emitLine('DUK_INTERNAL_DECL const duk_uint8_t duk_initjs_data[];') genc.emitLine('DUK_INTERNAL_DECL const duk_uint8_t duk_initjs_data[%s];' % len(self.initjs_data))
genc.emitLine('#endif /* DUK_USE_BUILTIN_INITJS */') genc.emitLine('#endif /* DUK_USE_BUILTIN_INITJS */')
genc.emitLine('') genc.emitLine('')
genc.emitDefine('DUK_BUILTINS_DATA_LENGTH', len(self.init_data)) genc.emitDefine('DUK_BUILTINS_DATA_LENGTH', len(self.init_data))

4
src/genstrings.py

@ -1102,14 +1102,14 @@ class GenStrings:
return self.define_to_index.has_key(x) return self.define_to_index.has_key(x)
def emitStringsData(self, genc): def emitStringsData(self, genc):
genc.emitArray(self.strdata, 'duk_strings_data', visibility='DUK_INTERNAL', typename='duk_uint8_t', intvalues=True, const=True) genc.emitArray(self.strdata, 'duk_strings_data', visibility='DUK_INTERNAL', typename='duk_uint8_t', intvalues=True, const=True, size=len(self.strdata))
genc.emitLine('') genc.emitLine('')
genc.emitLine('/* to convert a heap stridx to a token number, subtract') genc.emitLine('/* to convert a heap stridx to a token number, subtract')
genc.emitLine(' * DUK_STRIDX_START_RESERVED and add DUK_TOK_START_RESERVED.') genc.emitLine(' * DUK_STRIDX_START_RESERVED and add DUK_TOK_START_RESERVED.')
genc.emitLine(' */') genc.emitLine(' */')
def emitStringsHeader(self, genc): def emitStringsHeader(self, genc):
genc.emitLine('DUK_INTERNAL_DECL const duk_uint8_t duk_strings_data[];') genc.emitLine('DUK_INTERNAL_DECL const duk_uint8_t duk_strings_data[%d];' % len(self.strdata))
genc.emitLine('') genc.emitLine('')
genc.emitDefine('DUK_STRDATA_DATA_LENGTH', len(self.strdata)) genc.emitDefine('DUK_STRDATA_DATA_LENGTH', len(self.strdata))
genc.emitDefine('DUK_STRDATA_MAX_STRLEN', self.maxlen) genc.emitDefine('DUK_STRDATA_MAX_STRLEN', self.maxlen)

1
util/make_dist.sh

@ -71,7 +71,6 @@ mkdir $DIST/examples/sandbox
for i in \ for i in \
duk_alloc_default.c \ duk_alloc_default.c \
duk_alloc_torture.c \
duk_api_internal.h \ duk_api_internal.h \
duk_api_stack.c \ duk_api_stack.c \
duk_api_heap.c \ duk_api_heap.c \

Loading…
Cancel
Save