changeset 469:0d6206cee6b9

core: state -> mlk_state
author David Demelier <markand@malikania.fr>
date Mon, 27 Feb 2023 11:11:23 +0100
parents 91ce23a36143
children 5690bbf12528
files examples/example-animation/example-animation.c examples/example-audio/example-audio.c examples/example-battle/example-battle.c examples/example-cursor/example-cursor.c examples/example-debug/example-debug.c examples/example-drawable/example-drawable.c examples/example-font/example-font.c examples/example-gridmenu/example-gridmenu.c examples/example-label/example-label.c examples/example-message/example-message.c examples/example-notify/example-notify.c examples/example-sprite/example-sprite.c examples/example-trace/example-trace.c examples/example-ui/example-ui.c libmlk-core/mlk/core/game.c libmlk-core/mlk/core/game.h libmlk-core/mlk/core/state.c libmlk-core/mlk/core/state.h tests/test-state.c
diffstat 19 files changed, 131 insertions(+), 131 deletions(-) [+]
line wrap: on
line diff
--- a/examples/example-animation/example-animation.c	Mon Feb 27 11:08:28 2023 +0100
+++ b/examples/example-animation/example-animation.c	Mon Feb 27 11:11:23 2023 +0100
@@ -45,7 +45,7 @@
 	.flags = LABEL_FLAGS_SHADOW
 };
 
-static struct state *states[1];
+static struct mlk_state *states[1];
 static struct texture numbers;
 static struct mlk_animation animation;
 static struct mlk_sprite sprite;
@@ -63,7 +63,7 @@
 }
 
 static void
-handle(struct state *st, const union mlk_event *ev)
+handle(struct mlk_state *st, const union mlk_event *ev)
 {
 	(void)st;
 
@@ -87,7 +87,7 @@
 }
 
 static void
-update(struct state *st, unsigned int ticks)
+update(struct mlk_state *st, unsigned int ticks)
 {
 	(void)st;
 
@@ -96,7 +96,7 @@
 }
 
 static void
-draw(struct state *st)
+draw(struct mlk_state *st)
 {
 	(void)st;
 
@@ -113,7 +113,7 @@
 static void
 run(void)
 {
-	struct state state = {
+	struct mlk_state state = {
 		.handle = handle,
 		.update = update,
 		.draw = draw
--- a/examples/example-audio/example-audio.c	Mon Feb 27 11:08:28 2023 +0100
+++ b/examples/example-audio/example-audio.c	Mon Feb 27 11:11:23 2023 +0100
@@ -38,7 +38,7 @@
 #define W       1280
 #define H       720
 
-static struct state *states[1];
+static struct mlk_state *states[1];
 static struct mlk_music music;
 static struct mlk_sound sound;
 
@@ -77,7 +77,7 @@
 }
 
 static void
-handle(struct state *st, const union mlk_event *ev)
+handle(struct mlk_state *st, const union mlk_event *ev)
 {
 	(void)st;
 
@@ -116,7 +116,7 @@
 }
 
 static void
-draw(struct state *st)
+draw(struct mlk_state *st)
 {
 	(void)st;
 
@@ -130,7 +130,7 @@
 static void
 run(void)
 {
-	struct state state = {
+	struct mlk_state state = {
 		.handle = handle,
 		.draw = draw
 	};
--- a/examples/example-battle/example-battle.c	Mon Feb 27 11:08:28 2023 +0100
+++ b/examples/example-battle/example-battle.c	Mon Feb 27 11:11:23 2023 +0100
@@ -141,8 +141,8 @@
 	theme_default()->sprites[THEME_SPRITE_CURSOR] = &registry_sprites[REGISTRY_TEXTURE_CURSOR];
 }
 
-static struct state *states[2];
-static struct state fight_state;
+static struct mlk_state *states[2];
+static struct mlk_state fight_state;
 
 static struct {
 	struct character ch;
@@ -230,7 +230,7 @@
 }
 
 static void
-empty_handle(struct state *st, const union mlk_event *ev)
+empty_handle(struct mlk_state *st, const union mlk_event *ev)
 {
 	(void)st;
 
@@ -248,7 +248,7 @@
 }
 
 static void
-empty_draw(struct state *st)
+empty_draw(struct mlk_state *st)
 {
 	(void)st;
 
@@ -265,13 +265,13 @@
 	mlk_painter_present();
 }
 
-static struct state empty_state = {
+static struct mlk_state empty_state = {
 	.handle = empty_handle,
 	.draw = empty_draw
 };
 
 static void
-fight_handle(struct state *st, const union mlk_event *ev)
+fight_handle(struct mlk_state *st, const union mlk_event *ev)
 {
 	(void)st;
 
@@ -279,7 +279,7 @@
 }
 
 static void
-fight_update(struct state *st, unsigned int ticks)
+fight_update(struct mlk_state *st, unsigned int ticks)
 {
 	(void)st;
 
@@ -288,7 +288,7 @@
 }
 
 static void
-fight_draw(struct state *st)
+fight_draw(struct mlk_state *st)
 {
 	(void)st;
 
@@ -299,7 +299,7 @@
 }
 
 static void
-fight_finish(struct state *st)
+fight_finish(struct mlk_state *st)
 {
 	(void)st;
 
@@ -308,7 +308,7 @@
 	battle_finish(&bt);
 }
 
-static struct state fight_state = {
+static struct mlk_state fight_state = {
 	.handle = fight_handle,
 	.update = fight_update,
 	.draw = fight_draw,
--- a/examples/example-cursor/example-cursor.c	Mon Feb 27 11:08:28 2023 +0100
+++ b/examples/example-cursor/example-cursor.c	Mon Feb 27 11:11:23 2023 +0100
@@ -35,7 +35,7 @@
 #define W 1280
 #define H 720
 
-static struct state *states[1];
+static struct mlk_state *states[1];
 static char help_text[128];
 static enum window_cursor cursor = WINDOW_CURSOR_ARROW;
 
@@ -73,7 +73,7 @@
 }
 
 static void
-handle(struct state *st, const union mlk_event *ev)
+handle(struct mlk_state *st, const union mlk_event *ev)
 {
 	(void)st;
 
@@ -103,7 +103,7 @@
 }
 
 static void
-draw(struct state *st)
+draw(struct mlk_state *st)
 {
 	(void)st;
 
@@ -116,7 +116,7 @@
 static void
 run(void)
 {
-	struct state state = {
+	struct mlk_state state = {
 		.handle = handle,
 		.draw = draw
 	};
--- a/examples/example-debug/example-debug.c	Mon Feb 27 11:08:28 2023 +0100
+++ b/examples/example-debug/example-debug.c	Mon Feb 27 11:11:23 2023 +0100
@@ -32,7 +32,7 @@
 #define W 1280
 #define H 720
 
-static struct state *states[1];
+static struct mlk_state *states[1];
 static int mouse_x;
 static int mouse_y;
 
@@ -48,7 +48,7 @@
 }
 
 static void
-handle(struct state *st, const union mlk_event *ev)
+handle(struct mlk_state *st, const union mlk_event *ev)
 {
 	(void)st;
 
@@ -66,7 +66,7 @@
 }
 
 static void
-draw(struct state *st)
+draw(struct mlk_state *st)
 {
 	(void)st;
 
@@ -82,7 +82,7 @@
 static void
 run(void)
 {
-	struct state state = {
+	struct mlk_state state = {
 		.handle = handle,
 		.draw = draw
 	};
--- a/examples/example-drawable/example-drawable.c	Mon Feb 27 11:08:28 2023 +0100
+++ b/examples/example-drawable/example-drawable.c	Mon Feb 27 11:11:23 2023 +0100
@@ -53,7 +53,7 @@
 	.flags = LABEL_FLAGS_SHADOW
 };
 
-static struct state *states[1];
+static struct mlk_state *states[1];
 static struct mlk_drawable *drawables[64];
 static struct mlk_drawable_stack stack;
 
@@ -126,7 +126,7 @@
 }
 
 static void
-handle(struct state *st, const union mlk_event *ev)
+handle(struct mlk_state *st, const union mlk_event *ev)
 {
 	(void)st;
 
@@ -152,7 +152,7 @@
 }
 
 static void
-update(struct state *st, unsigned int ticks)
+update(struct mlk_state *st, unsigned int ticks)
 {
 	(void)st;
 
@@ -161,7 +161,7 @@
 }
 
 static void
-draw(struct state *st)
+draw(struct mlk_state *st)
 {
 	(void)st;
 
@@ -175,7 +175,7 @@
 static void
 run(void)
 {
-	struct state state = {
+	struct mlk_state state = {
 		.handle = handle,
 		.update = update,
 		.draw = draw
--- a/examples/example-font/example-font.c	Mon Feb 27 11:08:28 2023 +0100
+++ b/examples/example-font/example-font.c	Mon Feb 27 11:11:23 2023 +0100
@@ -46,7 +46,7 @@
 	0xc7cfccff,     /* Christian Grey. */
 };
 
-static struct state *states[1];
+static struct mlk_state *states[1];
 static int ci = 0;
 static enum mlk_font_style style = MLK_FONT_STYLE_ANTIALIASED;
 
@@ -60,7 +60,7 @@
 }
 
 static void
-handle(struct state *st, const union mlk_event *ev)
+handle(struct mlk_state *st, const union mlk_event *ev)
 {
 	(void)st;
 
@@ -95,7 +95,7 @@
 }
 
 static void
-draw(struct state *st)
+draw(struct mlk_state *st)
 {
 	(void)st;
 
@@ -116,7 +116,7 @@
 static void
 run(void)
 {
-	struct state state = {
+	struct mlk_state state = {
 		.handle = handle,
 		.draw = draw
 	};
--- a/examples/example-gridmenu/example-gridmenu.c	Mon Feb 27 11:08:28 2023 +0100
+++ b/examples/example-gridmenu/example-gridmenu.c	Mon Feb 27 11:11:23 2023 +0100
@@ -36,7 +36,7 @@
 #define W       (1280)
 #define H       (720)
 
-static struct state *states[1];
+static struct mlk_state *states[1];
 
 static void
 init(void)
@@ -56,7 +56,7 @@
 }
 
 static void
-handle(struct state *st, const union mlk_event *ev)
+handle(struct mlk_state *st, const union mlk_event *ev)
 {
 	struct gridmenu *menu = st->data;
 
@@ -72,7 +72,7 @@
 }
 
 static void
-draw(struct state *st)
+draw(struct mlk_state *st)
 {
 	mlk_painter_set_color(0x4f8fbaff);
 	mlk_painter_clear();
@@ -104,7 +104,7 @@
 	};
 
 	struct gridmenu menu = {0};
-	struct state state = {
+	struct mlk_state state = {
 		.data = &menu,
 		.handle = handle,
 		.draw = draw,
--- a/examples/example-label/example-label.c	Mon Feb 27 11:08:28 2023 +0100
+++ b/examples/example-label/example-label.c	Mon Feb 27 11:11:23 2023 +0100
@@ -101,7 +101,7 @@
 	.text = "This one follows your mouse and is not aligned."
 };
 
-static struct state *states[1];
+static struct mlk_state *states[1];
 
 static void
 init(void)
@@ -129,7 +129,7 @@
 }
 
 static void
-handle(struct state *st, const union mlk_event *ev)
+handle(struct mlk_state *st, const union mlk_event *ev)
 {
 	(void)st;
 
@@ -147,7 +147,7 @@
 }
 
 static void
-draw(struct state *st)
+draw(struct mlk_state *st)
 {
 	(void)st;
 
@@ -164,7 +164,7 @@
 static void
 run(void)
 {
-	struct state state = {
+	struct mlk_state state = {
 		.handle = handle,
 		.draw = draw
 	};
--- a/examples/example-message/example-message.c	Mon Feb 27 11:08:28 2023 +0100
+++ b/examples/example-message/example-message.c	Mon Feb 27 11:11:23 2023 +0100
@@ -43,7 +43,7 @@
 #define MX      ((W / 2) - (MW / 2))
 #define MY      (100)
 
-static struct state *states[1];
+static struct mlk_state *states[1];
 
 static void
 init(void)
@@ -64,7 +64,7 @@
 }
 
 static void
-handle(struct state *st, const union mlk_event *ev)
+handle(struct mlk_state *st, const union mlk_event *ev)
 {
 	switch (ev->type) {
 	case MLK_EVENT_QUIT:
@@ -77,14 +77,14 @@
 }
 
 static void
-update(struct state *st, unsigned int ticks)
+update(struct mlk_state *st, unsigned int ticks)
 {
 	if (message_update(st->data, ticks))
 		mlk_game_quit();
 }
 
 static void
-draw(struct state *st)
+draw(struct mlk_state *st)
 {
 	mlk_painter_set_color(0xffffffff);
 	mlk_painter_clear();
@@ -95,7 +95,7 @@
 static void
 run(struct message *msg)
 {
-	struct state state = {
+	struct mlk_state state = {
 		.data = msg,
 		.handle = handle,
 		.update = update,
--- a/examples/example-notify/example-notify.c	Mon Feb 27 11:08:28 2023 +0100
+++ b/examples/example-notify/example-notify.c	Mon Feb 27 11:11:23 2023 +0100
@@ -46,7 +46,7 @@
 	.flags = LABEL_FLAGS_SHADOW
 };
 static struct texture icon;
-static struct state *states[1];
+static struct mlk_state *states[1];
 
 static void
 init(void)
@@ -60,7 +60,7 @@
 }
 
 static void
-handle(struct state *st, const union mlk_event *ev)
+handle(struct mlk_state *st, const union mlk_event *ev)
 {
 	(void)st;
 
@@ -78,7 +78,7 @@
 }
 
 static void
-update(struct state *st, unsigned int ticks)
+update(struct mlk_state *st, unsigned int ticks)
 {
 	(void)st;
 
@@ -86,7 +86,7 @@
 }
 
 static void
-draw(struct state *st)
+draw(struct mlk_state *st)
 {
 	(void)st;
 
@@ -100,7 +100,7 @@
 static void
 run(void)
 {
-	struct state state = {
+	struct mlk_state state = {
 		.handle = handle,
 		.update = update,
 		.draw = draw
--- a/examples/example-sprite/example-sprite.c	Mon Feb 27 11:08:28 2023 +0100
+++ b/examples/example-sprite/example-sprite.c	Mon Feb 27 11:11:23 2023 +0100
@@ -47,7 +47,7 @@
 static struct texture texture;
 static struct mlk_sprite sprite;
 static unsigned int row, column;
-static struct state *states[1];
+static struct mlk_state *states[1];
 
 static struct label help = {
 	.x = 10,
@@ -76,7 +76,7 @@
 }
 
 static void
-handle(struct state *st, const union mlk_event *ev)
+handle(struct mlk_state *st, const union mlk_event *ev)
 {
 	(void)st;
 
@@ -114,7 +114,7 @@
 }
 
 static void
-draw(struct state *st)
+draw(struct mlk_state *st)
 {
 	(void)st;
 
@@ -131,7 +131,7 @@
 static void
 run(void)
 {
-	struct state state = {
+	struct mlk_state state = {
 		.handle = handle,
 		.draw = draw
 	};
--- a/examples/example-trace/example-trace.c	Mon Feb 27 11:08:28 2023 +0100
+++ b/examples/example-trace/example-trace.c	Mon Feb 27 11:11:23 2023 +0100
@@ -35,7 +35,7 @@
 #define W 1280
 #define H 720
 
-static struct state *states[1];
+static struct mlk_state *states[1];
 
 static void
 init(void)
@@ -49,7 +49,7 @@
 }
 
 static void
-handle(struct state *st, const union mlk_event *ev)
+handle(struct mlk_state *st, const union mlk_event *ev)
 {
 	(void)st;
 
@@ -76,7 +76,7 @@
 }
 
 static void
-update(struct state *st, unsigned int ticks)
+update(struct mlk_state *st, unsigned int ticks)
 {
 	(void)st;
 
@@ -84,7 +84,7 @@
 }
 
 static void
-draw(struct state *st)
+draw(struct mlk_state *st)
 {
 	(void)st;
 
@@ -97,7 +97,7 @@
 static void
 run(void)
 {
-	struct state state = {
+	struct mlk_state state = {
 		.handle = handle,
 		.update = update,
 		.draw = draw
--- a/examples/example-ui/example-ui.c	Mon Feb 27 11:08:28 2023 +0100
+++ b/examples/example-ui/example-ui.c	Mon Feb 27 11:11:23 2023 +0100
@@ -118,7 +118,7 @@
 	}
 };
 
-static struct state *states[1];
+static struct mlk_state *states[1];
 
 static void
 init(void)
@@ -197,7 +197,7 @@
 }
 
 static void
-handle(struct state *st, const union mlk_event *ev)
+handle(struct mlk_state *st, const union mlk_event *ev)
 {
 	(void)st;
 
@@ -237,7 +237,7 @@
 }
 
 static void
-draw(struct state *st)
+draw(struct mlk_state *st)
 {
 	(void)st;
 
@@ -254,7 +254,7 @@
 static void
 run(void)
 {
-	struct state state = {
+	struct mlk_state state = {
 		.handle = handle,
 		.draw = draw
 	};
--- a/libmlk-core/mlk/core/game.c	Mon Feb 27 11:08:28 2023 +0100
+++ b/libmlk-core/mlk/core/game.c	Mon Feb 27 11:11:23 2023 +0100
@@ -29,7 +29,7 @@
 struct mlk_game game = {0};
 
 void
-mlk_game_init(struct state **states, size_t statesz)
+mlk_game_init(struct mlk_state **states, size_t statesz)
 {
 	assert(states);
 	assert(statesz);
@@ -44,17 +44,17 @@
 }
 
 void
-mlk_game_push(struct state *state)
+mlk_game_push(struct mlk_state *state)
 {
 	assert(state);
 	assert(!game.state || game.state != &game.states[game.statesz - 1]);
 
 	if (!game.state) {
 		game.state = &game.states[0];
-		state_start(*game.state = state);
+		mlk_state_start(*game.state = state);
 	} else {
-		state_suspend(*game.state);
-		state_start(*(++game.state) = state);
+		mlk_state_suspend(*game.state);
+		mlk_state_start(*(++game.state) = state);
 	}
 }
 
@@ -63,13 +63,13 @@
 {
 	assert(game.state);
 
-	state_end(*game.state);
-	state_finish(*game.state);
+	mlk_state_end(*game.state);
+	mlk_state_finish(*game.state);
 
 	if (game.state == game.states)
 		game.state = NULL;
 	else
-		state_resume(*--game.state);
+		mlk_state_resume(*--game.state);
 }
 
 void
@@ -78,21 +78,21 @@
 	assert(ev);
 
 	if (*game.state && !(game.inhibit & MLK_INHIBIT_STATE_INPUT))
-		state_handle(*game.state, ev);
+		mlk_state_handle(*game.state, ev);
 }
 
 void
 mlk_game_update(unsigned int ticks)
 {
 	if (*game.state && !(game.inhibit & MLK_INHIBIT_STATE_UPDATE))
-		state_update(*game.state, ticks);
+		mlk_state_update(*game.state, ticks);
 }
 
 void
 mlk_game_draw(void)
 {
 	if (*game.state && !(game.inhibit & MLK_INHIBIT_STATE_DRAW))
-		state_draw(*game.state);
+		mlk_state_draw(*game.state);
 }
 
 void
@@ -133,7 +133,7 @@
 {
 	for (size_t i = 0; i < game.statesz; ++i) {
 		if (game.states[i])
-			state_finish(game.states[i]);
+			mlk_state_finish(game.states[i]);
 
 		game.states[i] = NULL;
 	}
--- a/libmlk-core/mlk/core/game.h	Mon Feb 27 11:08:28 2023 +0100
+++ b/libmlk-core/mlk/core/game.h	Mon Feb 27 11:11:23 2023 +0100
@@ -24,15 +24,15 @@
 #include "core.h"
 #include "inhibit.h"
 
-struct state;
+struct mlk_state;
 
 union mlk_event;
 
 struct mlk_game {
 	enum mlk_inhibit inhibit;
-	struct state **states;
+	struct mlk_state **states;
 	size_t statesz;
-	struct state **state;
+	struct mlk_state **state;
 };
 
 extern struct mlk_game game;
@@ -40,10 +40,10 @@
 MLK_CORE_BEGIN_DECLS
 
 void
-mlk_game_init(struct state **, size_t);
+mlk_game_init(struct mlk_state **, size_t);
 
 void
-mlk_game_push(struct state *);
+mlk_game_push(struct mlk_state *);
 
 void
 mlk_game_pop(void);
--- a/libmlk-core/mlk/core/state.c	Mon Feb 27 11:08:28 2023 +0100
+++ b/libmlk-core/mlk/core/state.c	Mon Feb 27 11:11:23 2023 +0100
@@ -21,7 +21,7 @@
 #include "state.h"
 
 void
-state_start(struct state *state)
+mlk_state_start(struct mlk_state *state)
 {
 	assert(state);
 
@@ -30,7 +30,7 @@
 }
 
 void
-state_handle(struct state *state, const union mlk_event *ev)
+mlk_state_handle(struct mlk_state *state, const union mlk_event *ev)
 {
 	assert(state);
 	assert(ev);
@@ -40,7 +40,7 @@
 }
 
 void
-state_update(struct state *state, unsigned int ticks)
+mlk_state_update(struct mlk_state *state, unsigned int ticks)
 {
 	assert(state);
 
@@ -49,7 +49,7 @@
 }
 
 void
-state_draw(struct state *state)
+mlk_state_draw(struct mlk_state *state)
 {
 	assert(state);
 
@@ -58,7 +58,7 @@
 }
 
 void
-state_suspend(struct state *state)
+mlk_state_suspend(struct mlk_state *state)
 {
 	assert(state);
 
@@ -67,7 +67,7 @@
 }
 
 void
-state_resume(struct state *state)
+mlk_state_resume(struct mlk_state *state)
 {
 	assert(state);
 
@@ -76,7 +76,7 @@
 }
 
 void
-state_end(struct state *state)
+mlk_state_end(struct mlk_state *state)
 {
 	assert(state);
 
@@ -85,7 +85,7 @@
 }
 
 void
-state_finish(struct state *state)
+mlk_state_finish(struct mlk_state *state)
 {
 	assert(state);
 
--- a/libmlk-core/mlk/core/state.h	Mon Feb 27 11:08:28 2023 +0100
+++ b/libmlk-core/mlk/core/state.h	Mon Feb 27 11:11:23 2023 +0100
@@ -23,43 +23,43 @@
 
 union mlk_event;
 
-struct state {
+struct mlk_state {
 	void *data;
-	void (*start)(struct state *);
-	void (*handle)(struct state *, const union mlk_event *);
-	void (*update)(struct state *, unsigned int);
-	void (*draw)(struct state *);
-	void (*suspend)(struct state *);
-	void (*resume)(struct state *);
-	void (*end)(struct state *);
-	void (*finish)(struct state *);
+	void (*start)(struct mlk_state *);
+	void (*handle)(struct mlk_state *, const union mlk_event *);
+	void (*update)(struct mlk_state *, unsigned int);
+	void (*draw)(struct mlk_state *);
+	void (*suspend)(struct mlk_state *);
+	void (*resume)(struct mlk_state *);
+	void (*end)(struct mlk_state *);
+	void (*finish)(struct mlk_state *);
 };
 
 MLK_CORE_BEGIN_DECLS
 
 void
-state_start(struct state *);
+mlk_state_start(struct mlk_state *);
 
 void
-state_handle(struct state *, const union mlk_event *);
+mlk_state_handle(struct mlk_state *, const union mlk_event *);
 
 void
-state_update(struct state *, unsigned int);
+mlk_state_update(struct mlk_state *, unsigned int);
 
 void
-state_draw(struct state *);
+mlk_state_draw(struct mlk_state *);
 
 void
-state_suspend(struct state *);
+mlk_state_suspend(struct mlk_state *);
 
 void
-state_resume(struct state *);
+mlk_state_resume(struct mlk_state *);
 
 void
-state_end(struct state *);
+mlk_state_end(struct mlk_state *);
 
 void
-state_finish(struct state *);
+mlk_state_finish(struct mlk_state *);
 
 MLK_CORE_END_DECLS
 
--- a/tests/test-state.c	Mon Feb 27 11:08:28 2023 +0100
+++ b/tests/test-state.c	Mon Feb 27 11:11:23 2023 +0100
@@ -36,16 +36,16 @@
 	unsigned int finish;
 };
 
-static struct state *mainstates[16];
+static struct mlk_state *mainstates[16];
 
 static void
-my_start(struct state *state)
+my_start(struct mlk_state *state)
 {
 	((struct invokes *)state->data)->start++;
 }
 
 static void
-my_handle(struct state *state, const union mlk_event *ev)
+my_handle(struct mlk_state *state, const union mlk_event *ev)
 {
 	(void)ev;
 
@@ -53,7 +53,7 @@
 }
 
 static void
-my_update(struct state *state, unsigned int ticks)
+my_update(struct mlk_state *state, unsigned int ticks)
 {
 	(void)ticks;
 
@@ -61,31 +61,31 @@
 }
 
 static void
-my_draw(struct state *state)
+my_draw(struct mlk_state *state)
 {
 	((struct invokes *)state->data)->draw++;
 }
 
 static void
-my_suspend(struct state *state)
+my_suspend(struct mlk_state *state)
 {
 	((struct invokes *)state->data)->suspend++;
 }
 
 static void
-my_resume(struct state *state)
+my_resume(struct mlk_state *state)
 {
 	((struct invokes *)state->data)->resume++;
 }
 
 static void
-my_end(struct state *state)
+my_end(struct mlk_state *state)
 {
 	((struct invokes *)state->data)->end++;
 }
 
 static void
-my_finish(struct state *state)
+my_finish(struct mlk_state *state)
 {
 	((struct invokes *)state->data)->finish++;
 }
@@ -106,9 +106,9 @@
 test_basics_start(void)
 {
 	struct invokes inv = {0};
-	struct state state = INIT(&inv);
+	struct mlk_state state = INIT(&inv);
 
-	state_start(&state);
+	mlk_state_start(&state);
 	DT_EQ_UINT(inv.start, 1U);
 	DT_EQ_UINT(inv.handle, 0U);
 	DT_EQ_UINT(inv.update, 0U);
@@ -121,9 +121,9 @@
 test_basics_handle(void)
 {
 	struct invokes inv = {0};
-	struct state state = INIT(&inv);
+	struct mlk_state state = INIT(&inv);
 
-	state_handle(&state, &(const union mlk_event){0});
+	mlk_state_handle(&state, &(const union mlk_event){0});
 	DT_EQ_UINT(inv.start, 0U);
 	DT_EQ_UINT(inv.handle, 1U);
 	DT_EQ_UINT(inv.update, 0U);
@@ -136,9 +136,9 @@
 test_basics_update(void)
 {
 	struct invokes inv = {0};
-	struct state state = INIT(&inv);
+	struct mlk_state state = INIT(&inv);
 
-	state_update(&state, 0);
+	mlk_state_update(&state, 0);
 	DT_EQ_UINT(inv.start, 0U);
 	DT_EQ_UINT(inv.handle, 0U);
 	DT_EQ_UINT(inv.update, 1U);
@@ -151,9 +151,9 @@
 test_basics_draw(void)
 {
 	struct invokes inv = {0};
-	struct state state = INIT(&inv);
+	struct mlk_state state = INIT(&inv);
 
-	state_draw(&state);
+	mlk_state_draw(&state);
 	DT_EQ_UINT(inv.start, 0U);
 	DT_EQ_UINT(inv.handle, 0U);
 	DT_EQ_UINT(inv.update, 0U);
@@ -166,9 +166,9 @@
 test_basics_end(void)
 {
 	struct invokes inv = {0};
-	struct state state = INIT(&inv);
+	struct mlk_state state = INIT(&inv);
 
-	state_end(&state);
+	mlk_state_end(&state);
 	DT_EQ_UINT(inv.start, 0U);
 	DT_EQ_UINT(inv.handle, 0U);
 	DT_EQ_UINT(inv.update, 0U);
@@ -181,9 +181,9 @@
 test_basics_finish(void)
 {
 	struct invokes inv = {0};
-	struct state state = INIT(&inv);
+	struct mlk_state state = INIT(&inv);
 
-	state_finish(&state);
+	mlk_state_finish(&state);
 	DT_EQ_UINT(inv.start, 0U);
 	DT_EQ_UINT(inv.handle, 0U);
 	DT_EQ_UINT(inv.update, 0U);
@@ -197,7 +197,7 @@
 {
 	static struct {
 		struct invokes inv;
-		struct state state;
+		struct mlk_state state;
 	} states[] = {
 		{ .state = INIT(&states[0].inv) },
 		{ .state = INIT(&states[1].inv) }