[async] ax__msg_name()
This commit is contained in:
parent
7b2c1f0e07
commit
435c43da3f
|
@ -0,0 +1,4 @@
|
|||
[msg (ax_msg_shutdown_TAG "shutdown")
|
||||
(ax_msg_load_font_TAG "load_font")
|
||||
(ax_msg_theme_loaded_TAG "theme_loaded")
|
||||
(ax_msg_make_window_TAG "make_window")]
|
|
@ -1,11 +1,16 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct msgq;
|
||||
struct ax_window;
|
||||
struct ax_theme;
|
||||
|
||||
enum {
|
||||
ax_msg_shutdown_TAG,
|
||||
ax_msg_load_font_TAG,
|
||||
ax_msg_theme_loaded_TAG,
|
||||
ax_msg_make_window_TAG,
|
||||
};
|
||||
|
||||
struct ax_msg_shutdown {
|
||||
|
@ -19,3 +24,26 @@ struct ax_msg_load_font {
|
|||
struct ax_msg_theme_loaded {
|
||||
struct ax_theme* theme;
|
||||
};
|
||||
|
||||
struct ax_msg_make_window {
|
||||
struct ax_window* dst_win;
|
||||
const char* title;
|
||||
uint64_t width;
|
||||
uint64_t height;
|
||||
int flags;
|
||||
};
|
||||
|
||||
static inline const char* ax__msg_name(int val)
|
||||
{
|
||||
#ifdef IMPOSSIBLE
|
||||
#undef IMPOSSIBLE
|
||||
#endif
|
||||
|
||||
#define IMPOSSIBLE(_) return "???";
|
||||
const char* str;
|
||||
#include "../../_build/msg.printer.inc"
|
||||
return str;
|
||||
|
||||
#undef IMPOSSIBLE
|
||||
#define IMPOSSIBLE(x) IMPOSSIBLE_(x)
|
||||
}
|
||||
|
|
|
@ -18,5 +18,8 @@
|
|||
#define UNIMPLEMENTED() \
|
||||
ASSERT(0, "not implemented")
|
||||
|
||||
#define IMPOSSIBLE(what) \
|
||||
#define IMPOSSIBLE_(what) \
|
||||
ASSERT(0, "unreachable: " what)
|
||||
|
||||
// hard to explain why this is necessary ...
|
||||
#define IMPOSSIBLE(x) IMPOSSIBLE_(x)
|
||||
|
|
Loading…
Reference in New Issue