/*----------------------------------------------------------------------------*/ static duk_ret_t kbjs_sleep(duk_context *context) { /* Check if first argument is a number */ /* STACK: [..., interval] */ if (duk_is_nan(context, (duk_idx_t)-1)) duk_error(context, (duk_errcode_t)kbjs_ArgumentTypeError, kbjs_Error_fmt(kbjs_ArgumentTypeError), SLEEP_FUNC_NAME, "Number", 0, duk_safe_to_string(context, (duk_idx_t)-1)); /* Get first argument as integer in miliseconds */ long ms = (long)floor(fabs(duk_get_number(context, (duk_idx_t)-1))); long s = ms / S_TO_MS; /* Sleep this thread */ struct timespec interval = { (time_t)s, (ms - s*S_TO_MS)*MS_TO_NS }; nanosleep(&interval, NULL); return (duk_ret_t)0; }
gboolean _gum_duk_parse_bytes (duk_context * ctx, duk_idx_t index, GBytes ** bytes) { gpointer data; duk_size_t size; data = duk_get_buffer_data (ctx, index, &size); if (data != NULL) { *bytes = g_bytes_new (data, size); return TRUE; } else if (duk_is_array (ctx, index)) { duk_size_t i; duk_get_prop_string (ctx, index, "length"); size = duk_get_uint (ctx, -1); duk_pop (ctx); if (size >= GUM_MAX_JS_BYTE_ARRAY_LENGTH) return FALSE; data = g_malloc (size); for (i = 0; i != size; i++) { duk_get_prop_index (ctx, index, (duk_uarridx_t) i); ((guint8 *) data)[i] = duk_get_uint (ctx, -1) & 0xff; duk_pop (ctx); } *bytes = g_bytes_new_take (data, size); return TRUE; } else if (duk_is_null_or_undefined (ctx, index) || duk_is_boolean (ctx, index) || duk_is_number (ctx, index) || duk_is_nan (ctx, index) || duk_is_string (ctx, index) || duk_is_function (ctx, index)) { return FALSE; } *bytes = g_bytes_new (NULL, 0); return TRUE; }
/* Apply ToNumber() to specified index; if ToInteger(val) in [0,99], add * 1900 and replace value at idx_val. */ static void twodigit_year_fixup(duk_context *ctx, int idx_val) { double d; /* E5 Sections 15.9.3.1, B.2.4, B.2.5 */ duk_to_number(ctx, idx_val); if (duk_is_nan(ctx, idx_val)) { return; } duk_dup(ctx, idx_val); duk_to_int(ctx, -1); d = duk_get_number(ctx, -1); /* get as double to handle huge numbers correctly */ if (d >= 0.0 && d <= 99.0) { d += 1900.0; duk_push_number(ctx, d); duk_replace(ctx, idx_val); } duk_pop(ctx); }
static duk_ret_t test_func(duk_context *ctx, void *udata) { (void) udata; if (ctx) { printf("dummy - return here\n"); fflush(stdout); return 0; } /* Up-to-date for Duktape 1.3.0, alphabetical order: * $ cd website/api; ls *.yaml */ (void) duk_alloc_raw(ctx, 0); (void) duk_alloc(ctx, 0); (void) duk_base64_decode(ctx, 0); (void) duk_base64_encode(ctx, 0); (void) duk_buffer_to_string(ctx, 0); (void) duk_call_method(ctx, 0); (void) duk_call_prop(ctx, 0, 0); (void) duk_call(ctx, 0); (void) duk_char_code_at(ctx, 0, 0); (void) duk_check_stack_top(ctx, 0); (void) duk_check_stack(ctx, 0); (void) duk_check_type_mask(ctx, 0, 0); (void) duk_check_type(ctx, 0, 0); (void) duk_compact(ctx, 0); (void) duk_compile_lstring_filename(ctx, 0, "dummy", 0); (void) duk_compile_lstring(ctx, 0, "dummy", 0); (void) duk_compile_string_filename(ctx, 0, "dummy"); (void) duk_compile_string(ctx, 0, "dummy"); (void) duk_compile(ctx, 0); (void) duk_concat(ctx, 0); (void) duk_config_buffer(ctx, 0, NULL, 0); (void) duk_copy(ctx, 0, 0); (void) duk_create_heap_default(); (void) duk_create_heap(NULL, NULL, NULL, NULL, NULL); (void) duk_debugger_attach(ctx, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); (void) duk_debugger_cooperate(ctx); (void) duk_debugger_detach(ctx); (void) duk_debugger_notify(ctx, 0); (void) duk_debugger_pause(ctx); (void) duk_decode_string(ctx, 0, NULL, NULL); (void) duk_def_prop(ctx, 0, 0); (void) duk_del_prop_index(ctx, 0, 0); (void) duk_del_prop_string(ctx, 0, "dummy"); (void) duk_del_prop(ctx, 0); (void) duk_destroy_heap(ctx); (void) duk_dump_function(ctx); (void) duk_dup_top(ctx); (void) duk_dup(ctx, 0); (void) duk_enum(ctx, 0, 0); (void) duk_equals(ctx, 0, 0); duk_error_va(ctx, 0, NULL, NULL); duk_error(ctx, 0, "dummy"); /* (void) cast won't work without variadic macros */ (void) duk_eval_lstring_noresult(ctx, "dummy", 0); (void) duk_eval_lstring(ctx, "dummy", 0); (void) duk_eval_noresult(ctx); (void) duk_eval_string_noresult(ctx, "dummy"); (void) duk_eval_string(ctx, "dummy"); (void) duk_eval(ctx); (void) duk_fatal(ctx, "dummy"); (void) duk_free_raw(ctx, NULL); (void) duk_free(ctx, NULL); (void) duk_gc(ctx, 0); (void) duk_get_boolean(ctx, 0); (void) duk_get_buffer_data(ctx, 0, NULL); (void) duk_get_buffer(ctx, 0, NULL); (void) duk_get_c_function(ctx, 0); (void) duk_get_context(ctx, 0); (void) duk_get_current_magic(ctx); (void) duk_get_error_code(ctx, 0); (void) duk_get_finalizer(ctx, 0); (void) duk_get_global_string(ctx, 0); (void) duk_get_heapptr(ctx, 0); (void) duk_get_int(ctx, 0); (void) duk_get_length(ctx, 0); (void) duk_get_lstring(ctx, 0, NULL); (void) duk_get_magic(ctx, 0); (void) duk_get_memory_functions(ctx, NULL); (void) duk_get_number(ctx, 0); (void) duk_get_pointer(ctx, 0); (void) duk_get_prop_index(ctx, 0, 0); (void) duk_get_prop_string(ctx, 0, "dummy"); (void) duk_get_prop(ctx, 0); (void) duk_get_prototype(ctx, 0); (void) duk_get_string(ctx, 0); (void) duk_get_top_index(ctx); (void) duk_get_top(ctx); (void) duk_get_type_mask(ctx, 0); (void) duk_get_type(ctx, 0); (void) duk_get_uint(ctx, 0); (void) duk_has_prop_index(ctx, 0, 0); (void) duk_has_prop_string(ctx, 0, "dummy"); (void) duk_has_prop(ctx, 0); (void) duk_hex_decode(ctx, 0); (void) duk_hex_encode(ctx, 0); (void) duk_insert(ctx, 0); (void) duk_instanceof(ctx, 0, 0); (void) duk_is_array(ctx, 0); (void) duk_is_boolean(ctx, 0); (void) duk_is_bound_function(ctx, 0); (void) duk_is_buffer(ctx, 0); (void) duk_is_callable(ctx, 0); (void) duk_is_c_function(ctx, 0); (void) duk_is_constructor_call(ctx); (void) duk_is_dynamic_buffer(ctx, 0); (void) duk_is_ecmascript_function(ctx, 0); (void) duk_is_error(ctx, 0); (void) duk_is_eval_error(ctx, 0); (void) duk_is_fixed_buffer(ctx, 0); (void) duk_is_function(ctx, 0); (void) duk_is_lightfunc(ctx, 0); (void) duk_is_nan(ctx, 0); (void) duk_is_null_or_undefined(ctx, 0); (void) duk_is_null(ctx, 0); (void) duk_is_number(ctx, 0); (void) duk_is_object_coercible(ctx, 0); (void) duk_is_object(ctx, 0); (void) duk_is_pointer(ctx, 0); (void) duk_is_primitive(ctx, 0); (void) duk_is_range_error(ctx, 0); (void) duk_is_reference_error(ctx, 0); (void) duk_is_strict_call(ctx); (void) duk_is_string(ctx, 0); (void) duk_is_syntax_error(ctx, 0); (void) duk_is_thread(ctx, 0); (void) duk_is_type_error(ctx, 0); (void) duk_is_undefined(ctx, 0); (void) duk_is_uri_error(ctx, 0); (void) duk_is_valid_index(ctx, 0); (void) duk_join(ctx, 0); (void) duk_json_decode(ctx, 0); (void) duk_json_encode(ctx, 0); (void) duk_load_function(ctx); (void) duk_map_string(ctx, 0, NULL, NULL); (void) duk_new(ctx, 0); (void) duk_next(ctx, 0, 0); (void) duk_normalize_index(ctx, 0); (void) duk_pcall_method(ctx, 0); (void) duk_pcall_prop(ctx, 0, 0); (void) duk_pcall(ctx, 0); (void) duk_pcompile_lstring_filename(ctx, 0, "dummy", 0); (void) duk_pcompile_lstring(ctx, 0, "dummy", 0); (void) duk_pcompile_string_filename(ctx, 0, "dummy"); (void) duk_pcompile_string(ctx, 0, "dummy"); (void) duk_pcompile(ctx, 0); (void) duk_peval_lstring_noresult(ctx, "dummy", 0); (void) duk_peval_lstring(ctx, "dummy", 0); (void) duk_peval_noresult(ctx); (void) duk_peval_string_noresult(ctx, "dummy"); (void) duk_peval_string(ctx, "dummy"); (void) duk_peval(ctx); (void) duk_pnew(ctx, 0); (void) duk_pop_2(ctx); (void) duk_pop_3(ctx); (void) duk_pop_n(ctx, 0); (void) duk_pop(ctx); (void) duk_push_array(ctx); (void) duk_push_boolean(ctx, 0); (void) duk_push_buffer_object(ctx, 0, 0, 0, 0); (void) duk_push_buffer(ctx, 0, 0); (void) duk_push_c_function(ctx, NULL, 0); (void) duk_push_c_lightfunc(ctx, NULL, 0, 0, 0); (void) duk_push_context_dump(ctx); (void) duk_push_current_function(ctx); (void) duk_push_current_thread(ctx); (void) duk_push_dynamic_buffer(ctx, 0); (void) duk_push_error_object_va(ctx, 0, NULL, NULL); (void) duk_push_error_object(ctx, 0, "dummy"); (void) duk_push_external_buffer(ctx); (void) duk_push_false(ctx); (void) duk_push_fixed_buffer(ctx, 0); (void) duk_push_global_object(ctx); (void) duk_push_global_stash(ctx); (void) duk_push_heap_stash(ctx); (void) duk_push_heapptr(ctx, NULL); (void) duk_push_int(ctx, 0); (void) duk_push_lstring(ctx, "dummy", 0); (void) duk_push_nan(ctx); (void) duk_push_null(ctx); (void) duk_push_number(ctx, 0.0); (void) duk_push_object(ctx); (void) duk_push_pointer(ctx, NULL); (void) duk_push_sprintf(ctx, "dummy"); (void) duk_push_string(ctx, "dummy"); (void) duk_push_this(ctx); (void) duk_push_thread_new_globalenv(ctx); (void) duk_push_thread_stash(ctx, NULL); (void) duk_push_thread(ctx); (void) duk_push_true(ctx); (void) duk_push_uint(ctx, 0); (void) duk_push_undefined(ctx); (void) duk_push_vsprintf(ctx, "dummy", NULL); (void) duk_put_function_list(ctx, 0, NULL); (void) duk_put_global_string(ctx, NULL); (void) duk_put_number_list(ctx, 0, NULL); (void) duk_put_prop_index(ctx, 0, 0); (void) duk_put_prop_string(ctx, 0, "dummy"); (void) duk_put_prop(ctx, 0); (void) duk_realloc_raw(ctx, NULL, 0); (void) duk_realloc(ctx, NULL, 0); (void) duk_remove(ctx, 0); (void) duk_replace(ctx, 0); (void) duk_require_boolean(ctx, 0); (void) duk_require_buffer_data(ctx, 0, NULL); (void) duk_require_buffer(ctx, 0, NULL); (void) duk_require_c_function(ctx, 0); (void) duk_require_callable(ctx, 0); (void) duk_require_context(ctx, 0); (void) duk_require_function(ctx, 0); (void) duk_require_heapptr(ctx, 0); (void) duk_require_int(ctx, 0); (void) duk_require_lstring(ctx, 0, NULL); (void) duk_require_normalize_index(ctx, 0); (void) duk_require_null(ctx, 0); (void) duk_require_number(ctx, 0); (void) duk_require_object_coercible(ctx, 0); (void) duk_require_pointer(ctx, 0); (void) duk_require_stack_top(ctx, 0); (void) duk_require_stack(ctx, 0); (void) duk_require_string(ctx, 0); (void) duk_require_top_index(ctx); (void) duk_require_type_mask(ctx, 0, 0); (void) duk_require_uint(ctx, 0); (void) duk_require_undefined(ctx, 0); (void) duk_require_valid_index(ctx, 0); (void) duk_resize_buffer(ctx, 0, 0); (void) duk_safe_call(ctx, NULL, NULL, 0, 0); (void) duk_safe_to_lstring(ctx, 0, NULL); (void) duk_safe_to_string(ctx, 0); (void) duk_set_finalizer(ctx, 0); (void) duk_set_global_object(ctx); (void) duk_set_magic(ctx, 0, 0); (void) duk_set_prototype(ctx, 0); (void) duk_set_top(ctx, 0); (void) duk_steal_buffer(ctx, 0, NULL); (void) duk_strict_equals(ctx, 0, 0); (void) duk_substring(ctx, 0, 0, 0); (void) duk_swap_top(ctx, 0); (void) duk_swap(ctx, 0, 0); (void) duk_throw(ctx); (void) duk_to_boolean(ctx, 0); (void) duk_to_buffer(ctx, 0, NULL); (void) duk_to_defaultvalue(ctx, 0, 0); (void) duk_to_dynamic_buffer(ctx, 0, NULL); (void) duk_to_fixed_buffer(ctx, 0, NULL); (void) duk_to_int32(ctx, 0); (void) duk_to_int(ctx, 0); (void) duk_to_lstring(ctx, 0, NULL); (void) duk_to_null(ctx, 0); (void) duk_to_number(ctx, 0); (void) duk_to_object(ctx, 0); (void) duk_to_pointer(ctx, 0); (void) duk_to_primitive(ctx, 0, 0); (void) duk_to_string(ctx, 0); (void) duk_to_uint16(ctx, 0); (void) duk_to_uint32(ctx, 0); (void) duk_to_uint(ctx, 0); (void) duk_to_undefined(ctx, 0); (void) duk_trim(ctx, 0); (void) duk_xcopy_top(ctx, NULL, 0); (void) duk_xmove_top(ctx, NULL, 0); printf("never here\n"); fflush(stdout); return 0; }
void test(duk_context *ctx) { duk_idx_t i, n; /* * push test values */ /* 0 */ duk_push_undefined(ctx); /* 1 */ duk_push_null(ctx); /* 2 */ duk_push_true(ctx); /* 3 */ duk_push_false(ctx); /* 4 */ duk_push_int(ctx, 123); /* 5 */ duk_push_number(ctx, 123.4); /* 6 */ duk_push_nan(ctx); /* 7 */ duk_push_number(ctx, INFINITY); /* 8 */ duk_push_number(ctx, -INFINITY); /* 9 */ duk_push_string(ctx, ""); /* 10 */ duk_push_string(ctx, "foo"); /* 11 */ duk_push_object(ctx); /* 12 */ duk_push_array(ctx); /* 13 */ duk_push_c_function(ctx, my_c_func, DUK_VARARGS); /* 14 */ duk_push_string(ctx, "(function() { print('hello'); })"); duk_eval(ctx); /* 15 */ duk_push_string(ctx, "escape.bind(null, 'foo')"); duk_eval(ctx); /* 16 */ duk_push_thread(ctx); /* 17 */ duk_push_buffer(ctx, 1024, 0 /*dynamic*/); /* 18 */ duk_push_buffer(ctx, 1024, 1 /*dynamic*/); /* 19 */ duk_push_pointer(ctx, (void *) 0xf00); /* * call checkers for each */ n = duk_get_top(ctx); for (i = 0; i < n; i++) { printf("%02ld: ", (long) i); printf(" und=%d", (int) duk_is_undefined(ctx, i)); printf(" null=%d", (int) duk_is_null(ctx, i)); printf(" noru=%d", (int) duk_is_null_or_undefined(ctx, i)); printf(" bool=%d", (int) duk_is_boolean(ctx, i)); printf(" num=%d", (int) duk_is_number(ctx, i)); printf(" nan=%d", (int) duk_is_nan(ctx, i)); printf(" str=%d", (int) duk_is_string(ctx, i)); printf(" obj=%d", (int) duk_is_object(ctx, i)); printf(" arr=%d", (int) duk_is_array(ctx, i)); printf(" fun=%d", (int) duk_is_function(ctx, i)); printf(" cfun=%d", (int) duk_is_c_function(ctx, i)); printf(" efun=%d", (int) duk_is_ecmascript_function(ctx, i)); printf(" bfun=%d", (int) duk_is_bound_function(ctx, i)); printf(" call=%d", (int) duk_is_callable(ctx, i)); printf(" thr=%d", (int) duk_is_thread(ctx, i)); printf(" buf=%d", (int) duk_is_buffer(ctx, i)); printf(" dyn=%d", (int) duk_is_dynamic_buffer(ctx, i)); printf(" fix=%d", (int) duk_is_fixed_buffer(ctx, i)); printf(" ptr=%d", (int) duk_is_pointer(ctx, i)); printf(" prim=%d", (int) duk_is_primitive(ctx, i)); printf(" objcoerc=%d", (int) duk_is_object_coercible(ctx, i)); printf("\n"); } }
DUK_INTERNAL duk_ret_t duk_bi_string_prototype_indexof_shared(duk_context *ctx) { duk_hthread *thr = (duk_hthread *) ctx; duk_hstring *h_this; duk_hstring *h_search; duk_int_t clen_this; duk_int_t cpos; duk_int_t bpos; const duk_uint8_t *p_start, *p_end, *p; const duk_uint8_t *q_start; duk_int_t q_blen; duk_uint8_t firstbyte; duk_uint8_t t; duk_small_int_t is_lastindexof = duk_get_current_magic(ctx); /* 0=indexOf, 1=lastIndexOf */ h_this = duk_push_this_coercible_to_string(ctx); DUK_ASSERT(h_this != NULL); clen_this = (duk_int_t) DUK_HSTRING_GET_CHARLEN(h_this); h_search = duk_to_hstring(ctx, 0); DUK_ASSERT(h_search != NULL); q_start = DUK_HSTRING_GET_DATA(h_search); q_blen = (duk_int_t) DUK_HSTRING_GET_BYTELEN(h_search); duk_to_number(ctx, 1); if (duk_is_nan(ctx, 1) && is_lastindexof) { /* indexOf: NaN should cause pos to be zero. * lastIndexOf: NaN should cause pos to be +Infinity * (and later be clamped to len). */ cpos = clen_this; } else { cpos = duk_to_int_clamped(ctx, 1, 0, clen_this); } /* Empty searchstring always matches; cpos must be clamped here. * (If q_blen were < 0 due to clamped coercion, it would also be * caught here.) */ if (q_blen <= 0) { duk_push_int(ctx, cpos); return 1; } DUK_ASSERT(q_blen > 0); bpos = (duk_int_t) duk_heap_strcache_offset_char2byte(thr, h_this, (duk_uint32_t) cpos); p_start = DUK_HSTRING_GET_DATA(h_this); p_end = p_start + DUK_HSTRING_GET_BYTELEN(h_this); p = p_start + bpos; /* This loop is optimized for size. For speed, there should be * two separate loops, and we should ensure that memcmp() can be * used without an extra "will searchstring fit" check. Doing * the preconditioning for 'p' and 'p_end' is easy but cpos * must be updated if 'p' is wound back (backward scanning). */ firstbyte = q_start[0]; /* leading byte of match string */ while (p <= p_end && p >= p_start) { t = *p; /* For Ecmascript strings, this check can only match for * initial UTF-8 bytes (not continuation bytes). For other * strings all bets are off. */ if ((t == firstbyte) && ((duk_size_t) (p_end - p) >= (duk_size_t) q_blen)) { DUK_ASSERT(q_blen > 0); /* no issues with memcmp() zero size, even if broken */ if (DUK_MEMCMP(p, q_start, (duk_size_t) q_blen) == 0) { duk_push_int(ctx, cpos); return 1; } } /* track cpos while scanning */ if (is_lastindexof) { /* when going backwards, we decrement cpos 'early'; * 'p' may point to a continuation byte of the char * at offset 'cpos', but that's OK because we'll * backtrack all the way to the initial byte. */ if ((t & 0xc0) != 0x80) { cpos--; } p--; } else { if ((t & 0xc0) != 0x80) { cpos++; } p++; } } /* Not found. Empty string case is handled specially above. */ duk_push_int(ctx, -1); return 1; }
bool Context::isNaN(index_t i) { return (duk_is_nan(m_handle, i) ? true: false); }
//duk_bool_t duk_is_nan(duk_context *ctx, duk_idx_t index); duk_bool_t aperl_duk_is_nan(duk_context *ctx, duk_idx_t index) { duk_bool_t ret = duk_is_nan(ctx, index); return ret; }
void StyleContext::parseStyleResult(StyleParamKey _key, StyleParam::Value& _val) const { _val = none_type{}; if (duk_is_string(m_ctx, -1)) { std::string value(duk_get_string(m_ctx, -1)); _val = StyleParam::parseString(_key, value); } else if (duk_is_boolean(m_ctx, -1)) { bool value = duk_get_boolean(m_ctx, -1); switch (_key) { case StyleParamKey::interactive: case StyleParamKey::text_interactive: case StyleParamKey::visible: _val = value; break; case StyleParamKey::extrude: _val = value ? glm::vec2(NAN, NAN) : glm::vec2(0.0f, 0.0f); break; default: break; } } else if (duk_is_array(m_ctx, -1)) { duk_get_prop_string(m_ctx, -1, "length"); int len = duk_get_int(m_ctx, -1); duk_pop(m_ctx); switch (_key) { case StyleParamKey::extrude: { if (len != 2) { LOGW("Wrong array size for extrusion: '%d'.", len); break; } duk_get_prop_index(m_ctx, -1, 0); double v1 = duk_get_number(m_ctx, -1); duk_pop(m_ctx); duk_get_prop_index(m_ctx, -1, 1); double v2 = duk_get_number(m_ctx, -1); duk_pop(m_ctx); _val = glm::vec2(v1, v2); break; } case StyleParamKey::color: case StyleParamKey::outline_color: case StyleParamKey::text_font_fill: case StyleParamKey::text_font_stroke_color: { if (len < 3 || len > 4) { LOGW("Wrong array size for color: '%d'.", len); break; } duk_get_prop_index(m_ctx, -1, 0); double r = duk_get_number(m_ctx, -1); duk_pop(m_ctx); duk_get_prop_index(m_ctx, -1, 1); double g = duk_get_number(m_ctx, -1); duk_pop(m_ctx); duk_get_prop_index(m_ctx, -1, 2); double b = duk_get_number(m_ctx, -1); duk_pop(m_ctx); double a = 1.0; if (len == 4) { duk_get_prop_index(m_ctx, -1, 3); a = duk_get_number(m_ctx, -1); duk_pop(m_ctx); } _val = (((uint32_t)(255.0 * a) & 0xff) << 24) | (((uint32_t)(255.0 * r) & 0xff)<< 16) | (((uint32_t)(255.0 * g) & 0xff)<< 8) | (((uint32_t)(255.0 * b) & 0xff)); break; } default: break; } } else if (duk_is_nan(m_ctx, -1)) { // Ignore setting value LOGD("duk evaluates JS method to NAN.\n"); } else if (duk_is_number(m_ctx, -1)) { switch (_key) { case StyleParamKey::extrude: _val = glm::vec2(0.f, static_cast<float>(duk_get_number(m_ctx, -1))); break; case StyleParamKey::width: case StyleParamKey::outline_width: { // TODO more efficient way to return pixels. // atm this only works by return value as string double v = duk_get_number(m_ctx, -1); _val = StyleParam::Width{static_cast<float>(v)}; break; } case StyleParamKey::text_font_stroke_width: { _val = static_cast<float>(duk_get_number(m_ctx, -1)); break; } case StyleParamKey::order: case StyleParamKey::outline_order: case StyleParamKey::priority: case StyleParamKey::color: case StyleParamKey::outline_color: case StyleParamKey::text_font_fill: case StyleParamKey::text_font_stroke_color: { _val = static_cast<uint32_t>(duk_get_uint(m_ctx, -1)); break; } default: break; } } else if (duk_is_null_or_undefined(m_ctx, -1)) { // Ignore setting value LOGD("duk evaluates JS method to null or undefined."); } else { LOGW("Unhandled return type from Javascript style function for %d.", _key); } DUMP("parseStyleResult\n"); }