- Similar refactor on XKB

This commit is contained in:
2025-08-22 02:53:09 -04:00
parent cbcd699ab0
commit 540c7fbce8
16 changed files with 208 additions and 3984 deletions

View File

@@ -16,16 +16,16 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// =====================================================================================================================
#define FENNEC_LIB(name) bool FENNEC_HAS_LIB_##name;
#define FENNEC_SYMBOL(ret, fn, ...) using sym_##fn = ret(*)(__VA_ARGS__); \
sym_##fn fn;
#define FENNEC_GLOBAL(type, name) type* name;
#include <fennec/platform/linux/xkb/lib/sym.h>
#include <fennec/platform/linux/xkb/lib/xkbcommon.h>
#include <fennec/platform/linux/xkb/lib/xkb.h>
#include <fennec/platform/linux/xkb/lib/loader.h>
#include <fennec/platform/interface/platform.h>
#define FENNEC_LIB(name) bool FENNEC_HAS_LIB_##name;
#define FENNEC_SYMBOL(ret, fn, ...) using XKB_sym_##fn = ret(*)(__VA_ARGS__); \
XKB_sym_##fn XKB_##fn;
#define FENNEC_GLOBAL(type, name) type* XKB_##name;
#include <fennec/platform/linux/xkb/lib/sym.h>
namespace fennec
{
@@ -58,10 +58,10 @@ bool load_symbols(platform* platform) {
return false; \
} \
current_lib = &_FENNEC_LIB_##lib;
#define FENNEC_SYMBOL(ret, fn, ...) fn = (sym_##fn)(platform->find_symbol(current_lib->obj, #fn)); \
assertf(fn != nullptr, "Failed to find symbol: " #fn);
#define FENNEC_GLOBAL(type, name) name = (type*)(platform->find_symbol(current_lib->obj, #name)); \
assertf(name != nullptr, "Failed to find global: " #name);
#define FENNEC_SYMBOL(ret, fn, ...) XKB_##fn = (XKB_sym_##fn)(platform->find_symbol(current_lib->obj, #fn)); \
assertf(XKB_##fn != nullptr, "Failed to find symbol: " #fn);
#define FENNEC_GLOBAL(type, name) XKB_##name = (type*)(platform->find_symbol(current_lib->obj, #name)); \
assertf(XKB_##name != nullptr, "Failed to find global: " #name);
#include <fennec/platform/linux/xkb/lib/sym.h>
@@ -76,8 +76,8 @@ void unload_symbols(platform* platform) {
#define FENNEC_LIB(lib) platform->unload_object(_FENNEC_LIB_##lib.obj); \
_FENNEC_LIB_##lib.obj = nullptr;
#define FENNEC_SYMBOL(ret, fn, ...) fn = nullptr;
#define FENNEC_GLOBAL(type, name) name = nullptr;
#define FENNEC_SYMBOL(ret, fn, ...) XKB_##fn = nullptr;
#define FENNEC_GLOBAL(type, name) XKB_##name = nullptr;
#include <fennec/platform/linux/xkb/lib/sym.h>
}