Esempio n. 1
0
duk_ret_t nsp_texture_display(duk_context *ctx) {
    duk_push_this(ctx);
    duk_get_prop_string(ctx, -1, "width");
    int width = duk_get_int(ctx, -1);
    duk_pop(ctx);
    duk_get_prop_string(ctx, -1, "height");
    int height = duk_get_int(ctx, -1);
    duk_pop(ctx);
    duk_get_prop_string(ctx, -1, "transparentColor");
    if (width != 320 || height != 240 || !duk_is_null(ctx, -1)) {
	duk_push_error_object(ctx, DUK_ERR_RANGE_ERROR, "must have dimensions 230x240 without transparency");
	duk_throw(ctx);
    }
    duk_pop(ctx);
    duk_get_prop_string(ctx, -1, "bitmap");
    size_t size;
    uint16_t *bitmap;
    bitmap = duk_get_buffer(ctx, -1, &size);
    if (bitmap == NULL || size != 320 * 240 * 2) {
	duk_push_error_object(ctx, DUK_ERR_ERROR, "bitmap buffer does not match with dimensions");
	duk_throw(ctx);
    }
    memcpy(SCREEN_BASE_ADDRESS, bitmap, 320 * 240 * 2);
    return 0;
}
Esempio n. 2
0
duk_ret_t nsp_texture_set_pixel(duk_context *ctx) {
    int x = duk_require_int(ctx, 0);
    int y = duk_require_int(ctx, 1);
    uint16_t color = duk_require_int(ctx, 2);
    duk_push_this(ctx);
    duk_get_prop_string(ctx, -1, "width");
    int w = duk_require_int(ctx, -1);
    duk_pop(ctx);
    duk_get_prop_string(ctx, -1, "height");
    int h = duk_require_int(ctx, -1);
    duk_pop(ctx);

    if (w <= 0 || h <= 0) {
	duk_push_error_object(ctx, DUK_ERR_RANGE_ERROR, "width and height must be positive");
	duk_throw(ctx);
    }

    duk_get_prop_string(ctx, -1, "bitmap");
    size_t size;
    uint16_t *bitmap = duk_get_buffer(ctx, -1, &size);
    if (bitmap == NULL) {
	duk_push_error_object(ctx, DUK_ERR_ERROR, "bitmap pointer is NULL");
	duk_throw(ctx);
    }

    if (0 <= x && x < w && 0 <= y && y < h && size >= (size_t)(w * h * 2)) {
	bitmap[w * y + x] = (uint16_t)color;
	return 0;
    } else {
	duk_push_error_object(ctx, DUK_ERR_RANGE_ERROR, "coordinates out of range");
	duk_throw(ctx);
    }
}
Esempio n. 3
0
static duk_ret_t nsp_texture_constructor(duk_context *ctx) {
    int width = duk_require_int(ctx, 0);
    int height = duk_require_int(ctx, 1);
    if (width < 1 || height < 1) {
	duk_push_error_object(ctx, DUK_ERR_RANGE_ERROR, "Width and height must be positive");
	duk_throw(ctx);
    }
    bool has_transparency;
    uint16_t transparent_color;
    if ((has_transparency = duk_is_number(ctx, 2))) {
	transparent_color = (uint16_t)duk_get_int(ctx, 2);
    }
    duk_push_this(ctx);
    duk_push_fixed_buffer(ctx, width * height * 2);
    duk_put_prop_string(ctx, -2, "bitmap");
    duk_push_int(ctx, width);
    duk_put_prop_string(ctx, -2, "width");
    duk_push_int(ctx, height);
    duk_put_prop_string(ctx, -2, "height");
    if (has_transparency) {
	duk_push_int(ctx, transparent_color);
    } else {
	duk_push_null(ctx);
    }
    duk_put_prop_string(ctx, -2, "transparentColor");
    return 0;
}
Esempio n. 4
0
void test(duk_context *ctx) {
	int err_idx;

	/* dummy values */
	duk_push_int(ctx, 123);
	duk_push_int(ctx, 123);

	err_idx = duk_push_error_object(ctx, DUK_ERR_TYPE_ERROR, "invalid argument: %d", 234);
	printf("err_idx: %d\n", err_idx);

	duk_get_prop_string(ctx, -1, "name");
	printf("name: %s\n", duk_to_string(ctx, -1));
	duk_pop(ctx);

	duk_get_prop_string(ctx, -1, "message");
	printf("message: %s\n", duk_to_string(ctx, -1));
	duk_pop(ctx);

	/* 'code' was a property which was once augmented to error instances,
	 * but has since been removed.
	 */
	duk_get_prop_string(ctx, -1, "code");
	printf("code: %s\n", duk_to_string(ctx, -1));
	duk_pop(ctx);

	printf("final top: %d\n", duk_get_top(ctx));
}
Esempio n. 5
0
static duk_ret_t duk__console_log_helper(duk_context *ctx, const char *error_name) {
	duk_idx_t i, n;

	n = duk_get_top(ctx);

	duk_get_global_string(ctx, "console");
	duk_get_prop_string(ctx, -1, "format");

	for (i = 0; i < n; i++) {
		if (duk_check_type_mask(ctx, i, DUK_TYPE_MASK_OBJECT)) {
			/* Slow path formatting. */
			duk_dup(ctx, -1);  /* console.format */
			duk_dup(ctx, i);
			duk_call(ctx, 1);
			duk_replace(ctx, i);  /* arg[i] = console.format(arg[i]); */
		}
	}

	duk_pop_2(ctx);

	duk_push_string(ctx, " ");
	duk_insert(ctx, 0);
	duk_join(ctx, n);

	if (error_name) {
		duk_push_error_object(ctx, DUK_ERR_ERROR, "%s", duk_require_string(ctx, -1));
		duk_push_string(ctx, "name");
		duk_push_string(ctx, error_name);
		duk_def_prop(ctx, -3, DUK_DEFPROP_FORCE | DUK_DEFPROP_HAVE_VALUE);  /* to get e.g. 'Trace: 1 2 3' */
		duk_get_prop_string(ctx, -1, "stack");
	}

	printf("%s\n", duk_to_string(ctx, -1));
	return 0;
}
static duk_ret_t test_1(duk_context *ctx, void *udata) {
	duk_idx_t err_idx;

	(void) udata;

	/* dummy values */
	duk_push_int(ctx, 123);
	duk_push_int(ctx, 123);

	err_idx = duk_push_error_object(ctx, DUK_ERR_TYPE_ERROR, "invalid argument: %d", 234);
	printf("err_idx: %ld\n", (long) err_idx);

	duk_get_prop_string(ctx, -1, "name");
	printf("name: %s\n", duk_to_string(ctx, -1));
	duk_pop(ctx);

	duk_get_prop_string(ctx, -1, "message");
	printf("message: %s\n", duk_to_string(ctx, -1));
	duk_pop(ctx);

	/* 'code' was a property which was once augmented to error instances,
	 * but has since been removed.
	 */
	duk_get_prop_string(ctx, -1, "code");
	printf("code: %s\n", duk_to_string(ctx, -1));
	duk_pop(ctx);

	printf("final top: %ld\n", (long) duk_get_top(ctx));
	return 0;
}
Esempio n. 7
0
void duv_push_status(duk_context *ctx, int status) {
  if (status < 0) {
    duk_push_error_object(ctx, DUK_ERR_ERROR, "%s: %s", uv_err_name(status), uv_strerror(status));
  }
  else {
    duk_push_null(ctx);
  }
}
static duk_ret_t my_thrower_3(duk_context *ctx) {
	/* When an error is constructed using duk_push_error_object() and then
	 * thrown, the same thing happens as with duk_error().
	 */
#line 2345 "dummy.c"
	duk_push_error_object(ctx, DUK_ERR_RANGE_ERROR, "user error");
	duk_throw(ctx);
	return 0;
}
Esempio n. 9
0
duk_ret_t nsp_texture_fill_polygon(duk_context *ctx) {

    duk_require_object_coercible(ctx, 0);
    int* xys = getIntArray(ctx,0);

    int nbPts = duk_require_int(ctx, 1);

    uint16_t color = duk_require_int(ctx, 2);


    duk_push_this(ctx);
    duk_get_prop_string(ctx, -1, "width");
    int w = duk_require_int(ctx, -1);
    duk_pop(ctx);

    duk_get_prop_string(ctx, -1, "height");
    int h = duk_require_int(ctx, -1);
    duk_pop(ctx);

    if (w <= 0 || h <= 0) {
			duk_push_error_object(ctx, DUK_ERR_RANGE_ERROR, "width and height must be positive");
			duk_throw(ctx);
    }

    duk_get_prop_string(ctx, -1, "bitmap");
    size_t size;
    uint16_t *bitmap = duk_get_buffer(ctx, -1, &size);
    if (bitmap == NULL) {
			duk_push_error_object(ctx, DUK_ERR_ERROR, "bitmap pointer is NULL");
			duk_throw(ctx);
    }

		FbDev* fb = (FbDev*)malloc( 1 * sizeof(FbDev) );
		  fb->width = w;
		  fb->height = h;
		  fb->fb_size = w * h;
		  fb->fb = bitmap;
		  fillPolygon( xys, nbPts, color, fb );
		free(fb);
    return 0;
}
void checkRethrowDuktapeError(JNIEnv* env, duk_context* ctx) {
  if (!env->ExceptionCheck()) {
    return;
  }

  // The Java call threw an exception - it should be propagated back through JavaScript.
  duk_push_error_object(ctx, DUK_ERR_API_ERROR, "Java Exception");
  duk_push_pointer(ctx, env->ExceptionOccurred());
  env->ExceptionClear();
  duk_put_prop_string(ctx, -2, JAVA_EXCEPTION_PROP_NAME);
  duk_throw(ctx);
}
Esempio n. 11
0
duk_ret_t nsp_texture_fill_rect(duk_context *ctx) {
    int x = duk_require_int(ctx, 0);
    int y = duk_require_int(ctx, 1);

    int w_ = duk_require_int(ctx, 2);
    int h_ = duk_require_int(ctx, 3);

    uint16_t color = duk_require_int(ctx, 4);


    duk_push_this(ctx);
    duk_get_prop_string(ctx, -1, "width");
    int w = duk_require_int(ctx, -1);
    duk_pop(ctx);
    duk_get_prop_string(ctx, -1, "height");
    int h = duk_require_int(ctx, -1);
    duk_pop(ctx);

    if (w <= 0 || h <= 0) {
			duk_push_error_object(ctx, DUK_ERR_RANGE_ERROR, "width and height must be positive");
			duk_throw(ctx);
    }

    duk_get_prop_string(ctx, -1, "bitmap");
    size_t size;
    uint16_t *bitmap = duk_get_buffer(ctx, -1, &size);
    if (bitmap == NULL) {
			duk_push_error_object(ctx, DUK_ERR_ERROR, "bitmap pointer is NULL");
			duk_throw(ctx);
    }

		FbDev* fb = (FbDev*)malloc( 1 * sizeof(FbDev) );
		  fb->width = w;
		  fb->height = h;
		  fb->fb_size = w * h;
		  fb->fb = bitmap;
		  fillRect(x,y,w_,h_,color,fb);
		free(fb);
    return 0;
}
Esempio n. 12
0
int
mn_push_status(duk_context *ctx, int status) {
	if (status < 0) {
		return duk_push_error_object(
			ctx,
			DUK_ERR_ERROR,
			"%s: %s",
			uv_err_name(status),
			uv_strerror(status)
		);
	}
	duk_push_null(ctx);
	return 0;
}
Esempio n. 13
0
int test_1(duk_context *ctx) {
	duk_set_top(ctx, 0);

	remove_handlers(ctx);
	duk_eval_string(ctx, "Duktape.errThrow = function (err) { err.name = 'ForcedName'; return err; }");
	duk_pop(ctx);

	/* Throw with duk_throw(). */

	duk_push_error_object(ctx, DUK_ERR_RANGE_ERROR, "range error: %d", 123);
	duk_throw(ctx);

	printf("final top: %d\n", duk_get_top(ctx));
	return 0;
}
Esempio n. 14
0
duk_ret_t nsp_texture_fill(duk_context *ctx) {
    uint16_t color = duk_require_int(ctx, 0);
    duk_push_this(ctx);
    duk_get_prop_string(ctx, -1, "bitmap");
    size_t size;
    uint16_t *bitmap = duk_get_buffer(ctx, -1, &size);
    if (bitmap == NULL) {
	duk_push_error_object(ctx, DUK_ERR_ERROR, "bitmap pointer is NULL");
	duk_throw(ctx);
    }
    for (size_t i = 0; i < size / 2; i++) {
	bitmap[i] = (uint16_t)color;
    }

    return 0;
}
Esempio n. 15
0
int test_4(duk_context *ctx) {
	duk_set_top(ctx, 0);

	remove_handlers(ctx);
	duk_eval_string(ctx, "Duktape.errCreate = function (err) { err.name = 'ForcedName'; return err; }");
	duk_pop(ctx);

	/* Create without throwing. */

	duk_push_error_object(ctx, DUK_ERR_RANGE_ERROR, "range error: %d", 123);
	printf("string coerced: %s\n", duk_to_string(ctx, -1));
	duk_pop(ctx);

	printf("final top: %d\n", duk_get_top(ctx));
	return 0;
}
Esempio n. 16
0
int invoke_java_method_call(duk_context *ctx) {
    int num = duk_get_top(ctx);
	const char * method = duk_to_string(ctx, 0);
	DEBUG_LOG("ScriptEngine","invoke_java_method call, method name %s  args num %d",  method, (num - 1));
	duk_push_this(ctx);
	if(duk_get_prop_string(ctx, -1, JAVA_OBJECT_MARK)){
		jobject  ref = duk_to_pointer(ctx, -1);
		JNIEnv*  env =  get_java_jni_env();
		DEBUG_LOG("ScriptEngine","invoke_java_method call, method  new String  %s", method);
		jstring methodName = (*env)->NewStringUTF(env, method);
	    jobjectArray args = duk_to_java_object_array(ctx, 1, num-1, env);
	    DEBUG_LOG("ScriptEngine","invoke_java_method call, with args %p   %p", java_api_class,  java_function_method);
		jobject value =  (*env)->CallStaticObjectMethod(env, java_api_class, java_function_method, ref, methodName, args);
		jthrowable exp = ( *env)->ExceptionOccurred(env);
        if(exp != NULL){
        	      ( *env)->ExceptionClear(env);
        	      jstring exceptionMessage = (*env)->CallStaticObjectMethod(env, java_api_class, java_exception_get_stack_trace_method, exp);
              jboolean isCopy = JNI_FALSE;
        	      const char* cstrMessage = (*env)->GetStringUTFChars(env, exceptionMessage, &isCopy);
        	      duk_push_error_object(ctx, DUK_ERR_EVAL_ERROR, "invoke java method  %s exception \n %s",  method, cstrMessage);
        	      (*env)->ReleaseStringUTFChars(env, exceptionMessage, cstrMessage);
        	      ( *env)->DeleteLocalRef(env , exceptionMessage);
        	      (*env)->DeleteLocalRef(env, args);
        	      (*env)->DeleteLocalRef(env, methodName);
        	      duk_throw(ctx);
        	      return 0;
        }
		duk_push_java_object(ctx, env, value);
	    (*env)->DeleteLocalRef(env, value);
	    (*env)->DeleteLocalRef(env, args);
	    (*env)->DeleteLocalRef(env, methodName);
	    DEBUG_LOG("ScriptEngine","invoke_java_method call with args success ");
		return 1;
	}else{
		duk_pop(ctx);
		duk_insert(ctx, 0);
		DEBUG_LOG("ScriptEngine","invoke_script_prop call, with args  num %d ", duk_get_top(ctx));
		if(duk_pcall_prop(ctx, 0, num - 1) != DUK_EXEC_SUCCESS){
			LOGE("ScriptEngine","ScriptEngine call %s method %s error %s", duk_to_string(ctx, 0), method, duk_js_error_to_string(ctx, -1));
			duk_pop(ctx);
			duk_push_null(ctx);
		}
		DEBUG_LOG("ScriptEngine","invoke_script_prop call, duk_get_prop_string with args  num %d ", duk_get_top(ctx));
		return 1;
	}
}
Esempio n. 17
0
// Duktape.modSearch function, needed for loading modules with require()
duk_ret_t module_search(duk_context *ctx) {
    const char *id = duk_require_string(ctx, 0);

    // C modules: add functions to exports variable (3rd argument) and return undefined
    for (int i = 0; i < c_module_count; i++) {
	if (!strcmp(c_module_list[i].name, id)) {
	    duk_push_c_function(ctx, c_module_list[i].init_func, 0);
	    duk_call(ctx, 0);
	    duk_enum(ctx, -1, 0);
	    while(duk_next(ctx, -1, 1)) {
		duk_put_prop(ctx, 2);
	    }
	    duk_pop_2(ctx);
	    return 0;
	}
    }

    // JS modules: return source code as a string
    // Read from file "modname.js.tns"
    int module_filename_len = strlen(id) + strlen(".js.tns") + 1;
    char *module_filename = malloc(module_filename_len);
    if (!module_filename) goto error;
    snprintf(module_filename, module_filename_len, "%s.js.tns", id);
    FILE *module_file = fopen(module_filename, "r");
    free(module_filename);
    if (!module_file) goto error;
    if (fseek(module_file, 0, SEEK_END) != 0) goto error;
    long module_file_size = ftell(module_file);
    if (module_file_size == -1) goto error;
    rewind(module_file);
    char *src = malloc(module_file_size);
    if (!src) goto error;
    fread(src, 1, module_file_size, module_file);
    if (ferror(module_file)) goto error;
    fclose(module_file);

    duk_push_lstring(ctx, src, module_file_size);
    free(src);

    return 1;
    
error:
    duk_push_error_object(ctx, DUK_ERR_ERROR, "module %s not found: %s", id, strerror(errno));
    duk_throw(ctx);
}
Esempio n. 18
0
static duk_ret_t duk_java_property_set(duk_context *ctx) {
	 const char* key  = duk_to_string(ctx, 0);
	 DEBUG_LOG("ScriptEngine", "duk_java_property_set  key %s ", key);
	 duk_push_this(ctx);
     if(duk_get_prop_string(ctx, -1, JAVA_OBJECT_MARK)){
			jobject  ref = duk_to_pointer(ctx, -1);
			JNIEnv*  env =  get_java_jni_env();
			jstring fieldName = (*env)->NewStringUTF(env, key);
			jobject  fieldValue = duk_to_java_object(ctx, env, 1);
			DEBUG_LOG("ScriptEngine", "duk_java_property_set  call staticVoidMethod %s ", key);
			(*env)->CallStaticVoidMethod(env, java_api_class, java_field_set_method, ref, fieldName, fieldValue);
			DEBUG_LOG("ScriptEngine", "duk_java_property_set  call staticVoidMethod Success");
			jthrowable exp = ( *env)->ExceptionOccurred(env);
			if(exp != NULL){
					  (*env)->ExceptionClear(env);
					  jstring exceptionMessage = (*env)->CallStaticObjectMethod(env, java_api_class, java_exception_get_stack_trace_method, exp);
				      jboolean isCopy = JNI_FALSE;
					  const char* cstrMessage = (*env)->GetStringUTFChars(env, exceptionMessage, &isCopy);
					  duk_push_error_object(ctx, DUK_ERR_EVAL_ERROR, "get java property %s error \n %s",  key, cstrMessage);
					  (*env)->ReleaseStringUTFChars(env, exceptionMessage, cstrMessage);
					  ( *env)->DeleteLocalRef(env , exceptionMessage);
					  (*env)->DeleteLocalRef(env, fieldValue);
					  (*env)->DeleteLocalRef(env, fieldName);
					  duk_throw(ctx);
					  return 0;
			 }
			(*env)->DeleteLocalRef(env, fieldValue);
			(*env)->DeleteLocalRef(env, fieldName);
			return 0;
	 }else{
		  DEBUG_LOG("ScriptEngine", "duk_java_property_set  key %d ", duk_get_top(ctx));
		  duk_pop(ctx);
		  DEBUG_LOG("ScriptEngine", "duk_java_property_set  key %d ", duk_get_top(ctx));
		  duk_replace(ctx, 0);
		  DEBUG_LOG("ScriptEngine", "duk_java_property_set  key %d ", duk_get_top(ctx));
	      duk_put_prop_string(ctx, 0, key);
	      DEBUG_LOG("ScriptEngine", "duk_java_property_set  key %d ", duk_get_top(ctx));
		  return 0;
	 }
}
Esempio n. 19
0
static duk_ret_t duk__console_log_helper(duk_context *ctx, const char *error_name) {
	duk_uint_t flags = (duk_uint_t) duk_get_current_magic(ctx);
	FILE *output = (flags & DUK_CONSOLE_STDOUT_ONLY) ? stdout : stderr;
	duk_idx_t n = duk_get_top(ctx);
	duk_idx_t i;

	duk_get_global_string(ctx, "console");
	duk_get_prop_string(ctx, -1, "format");

	for (i = 0; i < n; i++) {
		if (duk_check_type_mask(ctx, i, DUK_TYPE_MASK_OBJECT)) {
			/* Slow path formatting. */
			duk_dup(ctx, -1);  /* console.format */
			duk_dup(ctx, i);
			duk_call(ctx, 1);
			duk_replace(ctx, i);  /* arg[i] = console.format(arg[i]); */
		}
	}

	duk_pop_2(ctx);

	duk_push_string(ctx, " ");
	duk_insert(ctx, 0);
	duk_join(ctx, n);

	if (error_name) {
		duk_push_error_object(ctx, DUK_ERR_ERROR, "%s", duk_require_string(ctx, -1));
		duk_push_string(ctx, "name");
		duk_push_string(ctx, error_name);
		duk_def_prop(ctx, -3, DUK_DEFPROP_FORCE | DUK_DEFPROP_HAVE_VALUE);  /* to get e.g. 'Trace: 1 2 3' */
		duk_get_prop_string(ctx, -1, "stack");
	}

	fprintf(output, "%s\n", duk_to_string(ctx, -1));
	if (flags & DUK_CONSOLE_FLUSH) {
		fflush(output);
	}
	return 0;
}
Esempio n. 20
0
void
_gum_duk_push_exception_details (duk_context * ctx,
                                 GumExceptionDetails * details,
                                 GumDukCore * core,
                                 GumDukCpuContext ** cpu_context)
{
  const GumExceptionMemoryDetails * md = &details->memory;
  gchar * message;

  message = gum_exception_details_to_string (details);
  duk_push_error_object (ctx, DUK_ERR_ERROR, "%s", message);
  g_free (message);

  duk_push_string (ctx, gum_exception_type_to_string (details->type));
  duk_put_prop_string (ctx, -2, "type");
  _gum_duk_push_native_pointer (ctx, details->address, core);
  duk_put_prop_string (ctx, -2, "address");

  if (md->operation != GUM_MEMOP_INVALID)
  {
    duk_push_object (ctx);

    duk_push_string (ctx, _gum_duk_memory_operation_to_string (md->operation));
    duk_put_prop_string (ctx, -2, "operation");
    _gum_duk_push_native_pointer (ctx, md->address, core);
    duk_put_prop_string (ctx, -2, "address");

    duk_put_prop_string (ctx, -2, "memory");
  }

  *cpu_context = _gum_duk_push_cpu_context (ctx, &details->context,
      GUM_CPU_CONTEXT_READWRITE, core);
  duk_put_prop_string (ctx, -2, "context");
  _gum_duk_push_native_pointer (ctx, details->native_context, core);
  duk_put_prop_string (ctx, -2, "nativeContext");
}
Esempio n. 21
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;
}