static duk_ret_t IAssetStorage_SetReplicated_bool(duk_context* ctx)
{
    IAssetStorage* thisObj = GetThisWeakObject<IAssetStorage>(ctx);
    bool isReplicated_ = duk_require_boolean(ctx, 0);
    thisObj->SetReplicated(isReplicated_);
    return 0;
}
Esempio n. 2
0
static gboolean
gum_duk_exception_handler_on_exception (GumExceptionDetails * details,
                                        gpointer user_data)
{
  GumDukExceptionHandler * handler = user_data;
  GumDukCore * core = handler->core;
  GumDukScope scope;
  duk_context * ctx;
  GumDukCpuContext * cpu_context;
  gboolean handled = FALSE;

  ctx = _gum_duk_scope_enter (&scope, core);

  _gum_duk_push_exception_details (ctx, details, core, &cpu_context);

  duk_push_heapptr (ctx, handler->callback);
  duk_dup (ctx, -2);
  if (_gum_duk_scope_call (&scope, 1))
  {
    if (duk_is_boolean (ctx, -1))
      handled = duk_require_boolean (ctx, -1);
  }

  _gum_duk_cpu_context_make_read_only (cpu_context);

  duk_pop_2 (ctx);

  _gum_duk_scope_leave (&scope);

  return handled;
}
static duk_ret_t PhysicsWorld_SetDebugGeometryEnabled_bool(duk_context* ctx)
{
    PhysicsWorld* thisObj = GetThisWeakObject<PhysicsWorld>(ctx);
    bool enable = duk_require_boolean(ctx, 0);
    thisObj->SetDebugGeometryEnabled(enable);
    return 0;
}
Esempio n. 4
0
static duk_ret_t Light_SetTemporary_bool(duk_context* ctx)
{
    Light* thisObj = GetThisWeakObject<Light>(ctx);
    bool enable = duk_require_boolean(ctx, 0);
    thisObj->SetTemporary(enable);
    return 0;
}
static duk_ret_t RigidBody_SetClientExtrapolating_bool(duk_context* ctx)
{
    RigidBody* thisObj = GetThisWeakObject<RigidBody>(ctx);
    bool isClientExtrapolating = duk_require_boolean(ctx, 0);
    thisObj->SetClientExtrapolating(isClientExtrapolating);
    return 0;
}
static duk_ret_t RigidBody_SetTemporary_bool(duk_context* ctx)
{
    RigidBody* thisObj = GetThisWeakObject<RigidBody>(ctx);
    bool enable = duk_require_boolean(ctx, 0);
    thisObj->SetTemporary(enable);
    return 0;
}
Esempio n. 7
0
File: vm.c Progetto: joegen/sjs
static int sjs__compile_execute(duk_context *ctx) {
    const char *code;
    const char* filename;
    duk_size_t len;
    bool use_strict;
    int flags;

    /* [ ... use_strict code len filename ] */

    use_strict = duk_require_boolean(ctx, -4);
    code = duk_require_pointer(ctx, -3);
    len = duk_require_uint(ctx, -2);
    filename = duk_require_string(ctx, -1);

    flags = 0;
    if (use_strict) {
        flags |= DUK_COMPILE_STRICT;
    }

    /* remove shebang if present */
    if (strncmp(code, "#!", 2) == 0) {
        memcpy((void*) code, "//", 2);
    }

    duk_compile_lstring_filename(ctx, flags, code, len);

    /* [ ... use_strict code len function ] */

    duk_push_global_object(ctx);  /* 'this' binding */
    duk_push_string(ctx, filename);
    duk_put_prop_string(ctx, -2, "__file__");
    duk_call_method(ctx, 0);

    return 1;    /* either the result or error are on the stack top */
}
static duk_ret_t ParticleSystem_SetTemporary_bool(duk_context* ctx)
{
    ParticleSystem* thisObj = GetThisWeakObject<ParticleSystem>(ctx);
    bool enable = duk_require_boolean(ctx, 0);
    thisObj->SetTemporary(enable);
    return 0;
}
Esempio n. 9
0
static duk_ret_t Avatar_SetTemporary_bool(duk_context* ctx)
{
    Avatar* thisObj = GetThisWeakObject<Avatar>(ctx);
    bool enable = duk_require_boolean(ctx, 0);
    thisObj->SetTemporary(enable);
    return 0;
}
static duk_ret_t IAssetTransfer_SetCachingBehavior_bool_String(duk_context* ctx)
{
    IAssetTransfer* thisObj = GetThisWeakObject<IAssetTransfer>(ctx);
    bool cachingAllowed = duk_require_boolean(ctx, 0);
    String diskSource = duk_require_string(ctx, 1);
    thisObj->SetCachingBehavior(cachingAllowed, diskSource);
    return 0;
}
static duk_ret_t IAssetStorage_SerializeToString_bool(duk_context* ctx)
{
    int numArgs = duk_get_top(ctx);
    IAssetStorage* thisObj = GetThisWeakObject<IAssetStorage>(ctx);
    bool networkTransfer = numArgs > 0 ? duk_require_boolean(ctx, 0) : false;
    String ret = thisObj->SerializeToString(networkTransfer);
    duk_push_string(ctx, ret.CString());
    return 1;
}
Esempio n. 12
0
static duk_ret_t
js_OpenRawFile(duk_context* ctx)
{
	int n_args = duk_get_top(ctx);
	duk_require_string(ctx, 0);
	if (n_args >= 2) duk_require_boolean(ctx, 1);

	js_new_RawFile(ctx);
	return 1;
}
Esempio n. 13
0
static int
es_backend_open(duk_context *ctx)
{
  prop_t *p = es_stprop_get(ctx, 0);
  const char *url = duk_require_string(ctx, 1);
  int sync = duk_require_boolean(ctx, 2);
  if(backend_open(p, url, sync))
    duk_error(ctx, DUK_ERR_ERROR, "No handler for URL");
  return 0;
}
static duk_ret_t SignalWrapper_RigidBody_PhysicsCollision_Emit(duk_context* ctx)
{
    SignalWrapper_RigidBody_PhysicsCollision* wrapper = GetThisValueObject<SignalWrapper_RigidBody_PhysicsCollision>(ctx, SignalWrapper_RigidBody_PhysicsCollision_ID);
    if (!wrapper->owner_) return 0;
    Entity* param0 = GetWeakObject<Entity>(ctx, 0);
    float3& param1 = *GetCheckedValueObject<float3>(ctx, 1, float3_ID);
    float3& param2 = *GetCheckedValueObject<float3>(ctx, 2, float3_ID);
    float param3 = (float)duk_require_number(ctx, 3);
    float param4 = (float)duk_require_number(ctx, 4);
    bool param5 = duk_require_boolean(ctx, 5);
    wrapper->signal_->Emit(param0, param1, param2, param3, param4, param5);
    return 0;
}
Esempio n. 15
0
static duk_ret_t
js_Sound_setRepeat(duk_context* ctx)
{
	bool is_looped = duk_require_boolean(ctx, 0);
	
	sound_t* sound;

	duk_push_this(ctx);
	duk_get_prop_string(ctx, -1, "\xFF" "ptr"); sound = duk_get_pointer(ctx, -1); duk_pop(ctx);
	duk_pop(ctx);
	set_sound_looping(sound, is_looped);
	return 0;
}
Esempio n. 16
0
static duk_ret_t
js_OutlinedCircle(duk_context* ctx)
{
	bool    antialiased = false;
	color_t color;
	int     n_args;
	int     x, y, radius;

	n_args = duk_get_top(ctx);
	x = duk_to_int(ctx, 0);
	y = duk_to_int(ctx, 1);
	radius = duk_to_int(ctx, 2);
	color = duk_require_sphere_color(ctx, 3);
	if (n_args >= 5) antialiased = duk_require_boolean(ctx, 4);
	if (!is_skipped_frame()) al_draw_circle(x, y, radius, nativecolor(color), 1);
	return 0;
}
Esempio n. 17
0
duk_ret_t JsLibrarian::DependencyCheck(duk_context* duktapeContext)
{
   try {
      int args = duk_get_top(duktapeContext);

      duk_push_this(duktapeContext);
      auto obj = JavaScriptHelper::CppObject<JsLibrarian>(duktapeContext);

      if (!args) duk_push_boolean(duktapeContext, obj->librarian.DependencyCheck());
      else if (args == 1) obj->librarian.DependencyCheck(duk_require_boolean(duktapeContext, 0) != 0);
      else JavaScriptHelper::Throw(duktapeContext, "One argument for Librarian::DependencyCheck() expected");

      return 1;
   }
   catch (std::exception& e) {
      JavaScriptHelper::Throw(duktapeContext, e.what());
   }
}
Esempio n. 18
0
duk_ret_t JsExe::WarningAsError(duk_context* duktapeContext)
{
   try {
      int args = duk_get_top(duktapeContext);

      duk_push_this(duktapeContext);
      auto obj = JavaScriptHelper::CppObject<JsExe>(duktapeContext);

      if (!args) duk_push_boolean(duktapeContext, obj->compiler.WarningAsError());
      else if (args == 1) obj->compiler.WarningAsError(duk_require_boolean(duktapeContext, 0) != 0);
      else JavaScriptHelper::Throw(duktapeContext, "One argument for Exe::WarningAsError() expected");

      return 1;
   }
   catch (std::exception& e) {
      JavaScriptHelper::Throw(duktapeContext, e.what());
   }
}
Esempio n. 19
0
static duk_ret_t
js_new_RawFile(duk_context* ctx)
{
	int n_args = duk_get_top(ctx);
	const char* filename = duk_require_string(ctx, 0);
	bool writable = n_args >= 2 ? duk_require_boolean(ctx, 1) : false;

	FILE* file;
	char* path;

	path = get_asset_path(filename, "other", writable);
	file = fopen(path, writable ? "w+b" : "rb");
	free(path);
	if (file == NULL)
		duk_error_ni(ctx, -1, DUK_ERR_ERROR, "OpenRawFile(): Failed to open file '%s' for %s",
			filename, writable ? "writing" : "reading");
	duk_push_sphere_obj(ctx, "RawFile", file);
	return 1;
}
Esempio n. 20
0
static duk_ret_t
js_LoadSound(duk_context* ctx)
{
	duk_int_t n_args = duk_get_top(ctx);
	const char* filename = duk_require_string(ctx, 0);
	duk_bool_t is_stream = n_args >= 2 ? duk_require_boolean(ctx, 1) : true;

	sound_t* sound;
	char*    sound_path;

	sound_path = get_asset_path(filename, "sounds", false);
	sound = load_sound(sound_path, is_stream);
	free(sound_path);
	if (sound == NULL)
		duk_error_ni(ctx, -1, DUK_ERR_ERROR, "LoadSound(): Failed to load sound file '%s'", filename);
	duk_push_sphere_sound(ctx, sound);
	free_sound(sound);
	return 1;
}
Esempio n. 21
0
static duk_ret_t
js_Sound_play(duk_context* ctx)
{
	int n_args = duk_get_top(ctx);

	bool     is_looping;
	sound_t* sound;

	duk_push_this(ctx);
	duk_get_prop_string(ctx, -1, "\xFF" "ptr"); sound = duk_get_pointer(ctx, -1); duk_pop(ctx);
	duk_pop(ctx);
	if (n_args >= 1) {
		reload_sound(sound);
		is_looping = duk_require_boolean(ctx, 0);
		set_sound_looping(sound, is_looping);
	}
	play_sound(sound);
	return 0;
}
Esempio n. 22
0
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;
}
static duk_ret_t test_4(duk_context *ctx) {
	duk_set_top(ctx, 0);
	printf("boolean: %d\n", (int) duk_require_boolean(ctx, DUK_INVALID_INDEX));
	return 0;
}
static duk_ret_t test_3(duk_context *ctx) {
	duk_set_top(ctx, 0);
	printf("boolean: %d\n", (int) duk_require_boolean(ctx, 0));
	return 0;
}
static duk_ret_t test__boolean(duk_context *ctx, void *udata) {
	(void) udata;

	(void) duk_require_boolean(ctx, -3);
	return 0;
}
Esempio n. 26
0
bool Context::requireBool(index_t i)
{
    return (duk_require_boolean(m_handle, i) ? true: false);
}
//duk_bool_t duk_require_boolean(duk_context *ctx, duk_idx_t index);
duk_bool_t aperl_duk_require_boolean(duk_context *ctx, duk_idx_t index) {
	duk_bool_t ret = duk_require_boolean(ctx, index);
	return ret;
}