~hp/lv2lint

63b627554cdc10c9903d20ba8a9120414407dfd0 — Hanspeter Portner 2 years ago 0309c05
put state:restore into wrap
4 files changed, 40 insertions(+), 5 deletions(-)

M lv2lint/lv2lint.h
M meson_options.txt
M src/lv2lint.c
M src/lv2lint_plugin.c
M lv2lint/lv2lint.h => lv2lint/lv2lint.h +1 -0
@@ 644,6 644,7 @@ struct _app_t {
		int ui_cleanup;
		int work;
		int work_response;
		int state_restore;
	} status;
	varchunk_t *to_worker;
	varchunk_t *from_worker;

M meson_options.txt => meson_options.txt +1 -1
@@ 4,4 4,4 @@
option('online-tests', type : 'feature', value : 'disabled')
option('elf-tests', type : 'feature', value : 'disabled')
option('x11-tests', type : 'feature', value : 'disabled')
option('version', type : 'string', value : '0.1.41')
option('version', type : 'string', value : '0.1.43')

M src/lv2lint.c => src/lv2lint.c +17 -4
@@ 1654,6 1654,22 @@ _wrap_instantiate(app_t *app, void *data)
}

static int
_wrap_restore(app_t *app, void *data)
{
	LilvState *state = data;

	if(!app->instance)
	{
		return 1;
	}

	lilv_state_restore(state, app->instance, _state_set_value, app,
		LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE, NULL); //FIXME features

	return 0;
}

static int
_wrap_activate(app_t *app, void *data __attribute__((unused)))
{
	if(!app->instance)


@@ 2334,10 2350,7 @@ main(int argc, char **argv)
							LilvState *state = lilv_state_new_from_world(app.world, app.map, pset);
							if(state)
							{
								//FIXME wrap or trace
								lilv_state_restore(state, app.instance, _state_set_value, &app,
									LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE, NULL); //FIXME features

								app.status.state_restore = lv2lint_wrap(&app, _wrap_restore, state);
								lilv_state_free(state);
							}


M src/lv2lint_plugin.c => src/lv2lint_plugin.c +21 -0
@@ 250,6 250,26 @@ _test_work_response(app_t *app)
}

static const ret_t *
_test_state_restore(app_t *app)
{
	static const ret_t ret_crash = {
		.lnt = LINT_FAIL,
		.msg = "crashed",
		.uri = LV2_STATE__State,
		.dsc = "Well - fix your plugin."
	};

	const ret_t *ret = NULL;

	if(app->status.state_restore)
	{
		ret = &ret_crash;
	}

	return ret;
}

static const ret_t *
_test_activate(app_t *app)
{
	static const ret_t ret_crash = {


@@ 1855,6 1875,7 @@ static const test_t tests [] = {
	{"Plugin Run",             _test_run},
	{"Plugin Work",            _test_work},
	{"Plugin Work Response",   _test_work_response},
	{"Plugin State Restore",   _test_state_restore},
	{"Plugin Activate",        _test_activate},
	{"Plugin Deactivate",      _test_deactivate},
#ifdef ENABLE_PTRACE_TESTS