Formatting

This commit is contained in:
Maschell 2021-09-23 22:40:10 +02:00
parent c5af736523
commit 47bbd9a3b3
5 changed files with 26 additions and 15 deletions

2
.gitignore vendored
View File

@ -28,3 +28,5 @@ debug/
*.jekyll-metadata *.jekyll-metadata
*.cbp *.cbp
*.a *.a
cmake-build-debug/
CMakeLists.txt

View File

@ -1,4 +1,5 @@
#pragma once #pragma once
#include <stdint.h> #include <stdint.h>
typedef enum RelocationTrampolinStatus{ typedef enum RelocationTrampolinStatus{

View File

@ -37,13 +37,13 @@ typedef enum wums_entry_type_t {
} wums_entry_type_t; } wums_entry_type_t;
typedef struct wums_entry_t { typedef struct wums_entry_t {
wums_entry_type_t type; wums_entry_type_t type;
const char *name; /* name of the export */ const char *name; /* name of the export */
const void *address; /* pointer to the export */ const void *address; /* pointer to the export */
} wums_loader_entry_t; } wums_loader_entry_t;
#define WUMS_EXPORT_FUNCTION(function) WUMS_EXPORT(WUMS_FUNCTION_EXPORT, function, function); #define WUMS_EXPORT_FUNCTION(function) WUMS_EXPORT(WUMS_FUNCTION_EXPORT, function, function)
#define WUMS_EXPORT_DATA(pointer) WUMS_EXPORT(WUMS_DATA_EXPORT, pointer, &pointer); #define WUMS_EXPORT_DATA(pointer) WUMS_EXPORT(WUMS_DATA_EXPORT, pointer, &pointer)
#define WUMS_EXPORT(_type, pointer, value) \ #define WUMS_EXPORT(_type, pointer, value) \
extern const wums_loader_entry_t wums_entry_##pointer \ extern const wums_loader_entry_t wums_entry_##pointer \

View File

@ -32,7 +32,7 @@
extern "C" { extern "C" {
#endif #endif
#define WUMS_HOOK_EX(type_def,original_func) \ #define WUMS_HOOK_EX(type_def, original_func) \
extern const wums_hook_t wums_hooks_ ## original_func WUMS_SECTION("hooks"); \ extern const wums_hook_t wums_hooks_ ## original_func WUMS_SECTION("hooks"); \
const wums_hook_t wums_hooks_ ## original_func = { \ const wums_hook_t wums_hooks_ ## original_func = { \
.type = type_def, \ .type = type_def, \
@ -64,11 +64,11 @@ typedef struct wums_hook_t {
} wums_hook_t; } wums_hook_t;
typedef struct wums_app_init_args_t { typedef struct wums_app_init_args_t {
module_information_t* module_information; module_information_t *module_information;
} wums_app_init_args_t; } wums_app_init_args_t;
typedef struct wums_relocs_done_args_t { typedef struct wums_relocs_done_args_t {
module_information_t* module_information; module_information_t *module_information;
} wums_relocs_done_args_t; } wums_relocs_done_args_t;
#define WUMS_INITIALIZE(myargs) \ #define WUMS_INITIALIZE(myargs) \
@ -80,7 +80,7 @@ typedef struct wums_relocs_done_args_t {
void __wums_start(void);\ void __wums_start(void);\
WUMS_HOOK_EX(WUMS_HOOK_APPLICATION_STARTS, __wums_start); \ WUMS_HOOK_EX(WUMS_HOOK_APPLICATION_STARTS, __wums_start); \
void __wums_start() void __wums_start()
#define WUMS_APPLICATION_ENDS() \ #define WUMS_APPLICATION_ENDS() \
void __wums_end(void);\ void __wums_end(void);\
WUMS_HOOK_EX(WUMS_HOOK_APPLICATION_ENDS, __wums_end); \ WUMS_HOOK_EX(WUMS_HOOK_APPLICATION_ENDS, __wums_end); \
@ -90,7 +90,7 @@ typedef struct wums_relocs_done_args_t {
void __wums_requests_exit(void);\ void __wums_requests_exit(void);\
WUMS_HOOK_EX(WUMS_HOOK_APPLICATION_REQUESTS_EXIT, __wums_requests_exit); \ WUMS_HOOK_EX(WUMS_HOOK_APPLICATION_REQUESTS_EXIT, __wums_requests_exit); \
void __wums_requests_exit() void __wums_requests_exit()
#define WUMS_RELOCATIONS_DONE(myargs) \ #define WUMS_RELOCATIONS_DONE(myargs) \
void __wums_relocations_done(wums_relocs_done_args_t);\ void __wums_relocations_done(wums_relocs_done_args_t);\
WUMS_HOOK_EX(WUMS_HOOK_RELOCATIONS_DONE, __wums_relocations_done); \ WUMS_HOOK_EX(WUMS_HOOK_RELOCATIONS_DONE, __wums_relocations_done); \
@ -112,7 +112,7 @@ typedef struct wums_relocs_done_args_t {
void on_fini_wut_malloc(){ \ void on_fini_wut_malloc(){ \
__fini_wut_malloc(); \ __fini_wut_malloc(); \
} \ } \
WUMS_HOOK_EX(WUMS_HOOK_FINI_WUT_MALLOC,on_fini_wut_malloc); \ WUMS_HOOK_EX(WUMS_HOOK_FINI_WUT_MALLOC,on_fini_wut_malloc)
#define WUMS_USE_WUT_DEVOPTAB() \ #define WUMS_USE_WUT_DEVOPTAB() \
__EXTERN_C_MACRO void __init_wut_devoptab(); \ __EXTERN_C_MACRO void __init_wut_devoptab(); \
@ -124,7 +124,7 @@ typedef struct wums_relocs_done_args_t {
void on_fini_wut_devoptab(){ \ void on_fini_wut_devoptab(){ \
__fini_wut_devoptab(); \ __fini_wut_devoptab(); \
}\ }\
WUMS_HOOK_EX(WUMS_HOOK_FINI_WUT_DEVOPTAB,on_fini_wut_devoptab); WUMS_HOOK_EX(WUMS_HOOK_FINI_WUT_DEVOPTAB,on_fini_wut_devoptab)
#define WUMS_USE_WUT_NEWLIB() \ #define WUMS_USE_WUT_NEWLIB() \
__EXTERN_C_MACRO void __init_wut_newlib(); \ __EXTERN_C_MACRO void __init_wut_newlib(); \
@ -136,7 +136,7 @@ typedef struct wums_relocs_done_args_t {
void on_fini_wut_newlib(){ \ void on_fini_wut_newlib(){ \
__fini_wut_newlib(); \ __fini_wut_newlib(); \
}\ }\
WUMS_HOOK_EX(WUMS_HOOK_FINI_WUT_NEWLIB,on_fini_wut_newlib); WUMS_HOOK_EX(WUMS_HOOK_FINI_WUT_NEWLIB,on_fini_wut_newlib)
#define WUMS_USE_WUT_STDCPP() \ #define WUMS_USE_WUT_STDCPP() \
__EXTERN_C_MACRO void __init_wut_stdcpp(); \ __EXTERN_C_MACRO void __init_wut_stdcpp(); \
@ -148,13 +148,13 @@ typedef struct wums_relocs_done_args_t {
void on_fini_wut_stdcpp(){ \ void on_fini_wut_stdcpp(){ \
__fini_wut_stdcpp(); \ __fini_wut_stdcpp(); \
}\ }\
WUMS_HOOK_EX(WUMS_HOOK_FINI_WUT_STDCPP,on_fini_wut_stdcpp); WUMS_HOOK_EX(WUMS_HOOK_FINI_WUT_STDCPP,on_fini_wut_stdcpp)
#define WUMS_USE_WUT_SOCKETS() \ #define WUMS_USE_WUT_SOCKETS() \
__EXTERN_C_MACRO void __init_wut_socket(); \ __EXTERN_C_MACRO void __init_wut_socket(); \
WUMS_HOOK_EX(WUMS_HOOK_INIT_WUT_SOCKETS,__init_wut_socket); \ WUMS_HOOK_EX(WUMS_HOOK_INIT_WUT_SOCKETS,__init_wut_socket); \
__EXTERN_C_MACRO void __fini_wut_socket(); \ __EXTERN_C_MACRO void __fini_wut_socket(); \
WUMS_HOOK_EX(WUMS_HOOK_FINI_WUT_SOCKETS,__fini_wut_socket); WUMS_HOOK_EX(WUMS_HOOK_FINI_WUT_SOCKETS,__fini_wut_socket)
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -32,7 +32,15 @@
extern "C" { extern "C" {
#endif #endif
#define WUMS_MODULE_EXPORT_NAME(x) WUMS_META(export_name, x); WUMS_META(wum, "0.2"); WUMS_USE_WUT_MALLOC() WUMS_USE_WUT_SOCKETS() WUMS_USE_WUT_NEWLIB() WUMS_USE_WUT_STDCPP() WUMS_META(buildtimestamp, __DATE__ " " __TIME__); #define WUMS_MODULE_EXPORT_NAME(x) \
WUMS_META(export_name, x); \
WUMS_META(wum, "0.2"); \
WUMS_USE_WUT_MALLOC(); \
WUMS_USE_WUT_SOCKETS(); \
WUMS_USE_WUT_NEWLIB(); \
WUMS_USE_WUT_STDCPP(); \
WUMS_META(buildtimestamp, __DATE__ " " __TIME__)
#define WUMS_MODULE_AUTHOR(x) WUMS_META(author, x) #define WUMS_MODULE_AUTHOR(x) WUMS_META(author, x)
#define WUMS_MODULE_VERSION(x) WUMS_META(version, x) #define WUMS_MODULE_VERSION(x) WUMS_META(version, x)
#define WUMS_MODULE_LICENSE(x) WUMS_META(license, x) #define WUMS_MODULE_LICENSE(x) WUMS_META(license, x)