mirror of
https://github.com/wiiu-env/WiiUModuleSystem.git
synced 2024-11-22 01:39:19 +01:00
Format the code via clang-format
This commit is contained in:
parent
c7b9039dae
commit
fdf9993069
67
.clang-format
Normal file
67
.clang-format
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
# Generated from CLion C/C++ Code Style settings
|
||||||
|
BasedOnStyle: LLVM
|
||||||
|
AccessModifierOffset: -4
|
||||||
|
AlignAfterOpenBracket: Align
|
||||||
|
AlignConsecutiveAssignments: Consecutive
|
||||||
|
AlignConsecutiveMacros: AcrossEmptyLinesAndComments
|
||||||
|
AlignOperands: Align
|
||||||
|
AllowAllArgumentsOnNextLine: false
|
||||||
|
AllowAllConstructorInitializersOnNextLine: false
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: false
|
||||||
|
AllowShortBlocksOnASingleLine: Always
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: All
|
||||||
|
AllowShortIfStatementsOnASingleLine: Always
|
||||||
|
AllowShortLambdasOnASingleLine: All
|
||||||
|
AllowShortLoopsOnASingleLine: true
|
||||||
|
AlwaysBreakAfterReturnType: None
|
||||||
|
AlwaysBreakTemplateDeclarations: Yes
|
||||||
|
BreakBeforeBraces: Custom
|
||||||
|
BraceWrapping:
|
||||||
|
AfterCaseLabel: false
|
||||||
|
AfterClass: false
|
||||||
|
AfterControlStatement: Never
|
||||||
|
AfterEnum: false
|
||||||
|
AfterFunction: false
|
||||||
|
AfterNamespace: false
|
||||||
|
AfterUnion: false
|
||||||
|
BeforeCatch: false
|
||||||
|
BeforeElse: false
|
||||||
|
IndentBraces: false
|
||||||
|
SplitEmptyFunction: false
|
||||||
|
SplitEmptyRecord: true
|
||||||
|
BreakBeforeBinaryOperators: None
|
||||||
|
BreakBeforeTernaryOperators: true
|
||||||
|
BreakConstructorInitializers: BeforeColon
|
||||||
|
BreakInheritanceList: BeforeColon
|
||||||
|
ColumnLimit: 0
|
||||||
|
CompactNamespaces: false
|
||||||
|
ContinuationIndentWidth: 8
|
||||||
|
IndentCaseLabels: true
|
||||||
|
IndentPPDirectives: None
|
||||||
|
IndentWidth: 4
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||||
|
MaxEmptyLinesToKeep: 2
|
||||||
|
NamespaceIndentation: All
|
||||||
|
ObjCSpaceAfterProperty: false
|
||||||
|
ObjCSpaceBeforeProtocolList: true
|
||||||
|
PointerAlignment: Right
|
||||||
|
ReflowComments: false
|
||||||
|
SpaceAfterCStyleCast: true
|
||||||
|
SpaceAfterLogicalNot: false
|
||||||
|
SpaceAfterTemplateKeyword: false
|
||||||
|
SpaceBeforeAssignmentOperators: true
|
||||||
|
SpaceBeforeCpp11BracedList: false
|
||||||
|
SpaceBeforeCtorInitializerColon: true
|
||||||
|
SpaceBeforeInheritanceColon: true
|
||||||
|
SpaceBeforeParens: ControlStatements
|
||||||
|
SpaceBeforeRangeBasedForLoopColon: true
|
||||||
|
SpaceInEmptyParentheses: false
|
||||||
|
SpacesBeforeTrailingComments: 1
|
||||||
|
SpacesInAngles: false
|
||||||
|
SpacesInCStyleCastParentheses: false
|
||||||
|
SpacesInContainerLiterals: false
|
||||||
|
SpacesInParentheses: false
|
||||||
|
SpacesInSquareBrackets: false
|
||||||
|
TabWidth: 4
|
||||||
|
UseTab: Never
|
25
.github/workflows/pr.yml
vendored
Normal file
25
.github/workflows/pr.yml
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
name: CI-PR
|
||||||
|
|
||||||
|
on: [pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
clang-format-lib:
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: clang-format
|
||||||
|
run: |
|
||||||
|
docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./include ./libraries
|
||||||
|
build-lib:
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
needs: clang-format-lib
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: build binary
|
||||||
|
run: |
|
||||||
|
docker build . -f Dockerfile.buildlocal -t builder
|
||||||
|
docker run --rm -v ${PWD}:/project builder make
|
||||||
|
- uses: actions/upload-artifact@master
|
||||||
|
with:
|
||||||
|
name: binary
|
||||||
|
path: "/lib/*.a"
|
19
.github/workflows/push_image.yml
vendored
19
.github/workflows/push_image.yml
vendored
@ -4,8 +4,25 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
clang-format-lib:
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: clang-format
|
||||||
|
run: |
|
||||||
|
docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./include ./libraries
|
||||||
|
build-lib:
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
needs: clang-format-lib
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: build binary
|
||||||
|
run: |
|
||||||
|
docker build . -f Dockerfile.buildlocal -t builder
|
||||||
|
docker run --rm -v ${PWD}:/project builder make
|
||||||
|
push_image:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: build-lib
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@master
|
||||||
- name: Get release version
|
- name: Get release version
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM wiiuenv/devkitppc:20210920
|
FROM wiiuenv/devkitppc:20211229
|
||||||
|
|
||||||
WORKDIR build
|
WORKDIR build
|
||||||
COPY . .
|
COPY . .
|
||||||
|
3
Dockerfile.buildlocal
Normal file
3
Dockerfile.buildlocal
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
FROM wiiuenv/devkitppc:20211229
|
||||||
|
|
||||||
|
WORKDIR project
|
80
README.MD
Normal file
80
README.MD
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
[![Publish Docker Image](https://github.com/wiiu-env/WiiUModuleSystem/actions/workflows/push_image.yml/badge.svg)](https://github.com/wiiu-env/WiiUModuleSystem/actions/workflows/push_image.yml)
|
||||||
|
|
||||||
|
# Wii U Module System
|
||||||
|
|
||||||
|
This lib is required to build Modules to be loaded with the [Wii U Module System Loader](https://github.com/wiiu-env/WUMSLoader).
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
A module needs to implements at least the following macros.
|
||||||
|
```C++
|
||||||
|
#include <wums.h>
|
||||||
|
|
||||||
|
WUMS_MODULE_EXPORT_NAME("homebrew_modulename");
|
||||||
|
|
||||||
|
WUMS_INITIALIZE() {
|
||||||
|
/** THIS CODE WILL BE RUN ONCE **/
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The `WUMS_MODULE_EXPORT_NAME` needs to be a globally unique name across all loaded modules. `WUMS_INITIALIZE` defines the code that will be run after the module was loaded.
|
||||||
|
The module will have full permission to the sd card via `fs:/vol/external01`.
|
||||||
|
|
||||||
|
### Optional macros/hooks
|
||||||
|
Other optional macros/hooks are support, here some examples:
|
||||||
|
|
||||||
|
```C++
|
||||||
|
WUMS_APPLICATION_STARTS() {
|
||||||
|
/** Is called when a new application was started. **/
|
||||||
|
}
|
||||||
|
|
||||||
|
WUMS_APPLICATION_REQUESTS_EXIT() {
|
||||||
|
/** Is called when a new application is going to be closed. **/
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This list is incomplete, see `hooks.h` for all hooks and `meta.h` for all macros.
|
||||||
|
|
||||||
|
### Export functions
|
||||||
|
|
||||||
|
Modules can be used to export functions for other modules or "normal" applications.
|
||||||
|
|
||||||
|
```C++
|
||||||
|
#include <wums.h>
|
||||||
|
|
||||||
|
void MyCustomFunction() {
|
||||||
|
/** Some special code that should be useable for everyone */
|
||||||
|
}
|
||||||
|
|
||||||
|
WUMS_EXPORT_FUNCTION(MyCustomFunction);
|
||||||
|
```
|
||||||
|
|
||||||
|
This function can then be used like they would be inside a .rpl, where the name of the "rpl" is the one defined in `WUMS_MODULE_EXPORT_NAME`.
|
||||||
|
|
||||||
|
Example using the Cafe OS OSDynLoad API:
|
||||||
|
```C++
|
||||||
|
if (OSDynLoad_Acquire("homebrew_modulename", &sModuleHandle) != OS_DYNLOAD_OK) {
|
||||||
|
OSFatal("OSDynLoad_Acquire failed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
void (*sMyCustomFunction)() = NULL;
|
||||||
|
|
||||||
|
if (OSDynLoad_FindExport(sModuleHandle, FALSE, "MyCustomFunction", (void**) &sMyCustomFunction) != OS_DYNLOAD_OK) {
|
||||||
|
OSFatal("OSDynLoad_FindExport failed.");
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Use this lib in Dockerfiles.
|
||||||
|
A prebuilt version of this lib can found on dockerhub. To use it for your projects, add this to your Dockerfile.
|
||||||
|
```Dockerfile
|
||||||
|
[...]
|
||||||
|
COPY --from=wiiuenv/wiiumodulesystem:[tag] /artifacts $DEVKITPRO
|
||||||
|
[...]
|
||||||
|
```
|
||||||
|
Replace [tag] with a tag you want to use, a list of tags can be found [here](https://hub.docker.com/r/wiiuenv/wiiumodulesystem/tags).
|
||||||
|
It's highly recommended to pin the version to the **latest date** instead of using `latest`.
|
||||||
|
|
||||||
|
## Format the code via docker
|
||||||
|
```bash
|
||||||
|
docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./include ./libraries -i
|
||||||
|
```
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "wums/meta.h"
|
|
||||||
#include "wums/common.h"
|
#include "wums/common.h"
|
||||||
#include "wums/exports.h"
|
#include "wums/exports.h"
|
||||||
#include "wums/hooks.h"
|
#include "wums/hooks.h"
|
||||||
|
#include "wums/meta.h"
|
@ -31,11 +31,11 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define WUMS_SECTION(x) __attribute__((__section__ (".wums." x)))
|
#define WUMS_SECTION(x) __attribute__((__section__(".wums." x)))
|
||||||
|
|
||||||
#define WUMS_META(id, value) \
|
#define WUMS_META(id, value) \
|
||||||
extern const char wums_meta_ ## id [] WUMS_SECTION("meta"); \
|
extern const char wums_meta_##id[] WUMS_SECTION("meta"); \
|
||||||
const char wums_meta_ ## id [] = #id "=" value
|
const char wums_meta_##id[] = #id "=" value
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -17,11 +17,11 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
#include "dynamic_linking_defines.h"
|
#include "dynamic_linking_defines.h"
|
||||||
#include "relocation_defines.h"
|
|
||||||
#include "export_defines.h"
|
#include "export_defines.h"
|
||||||
|
#include "relocation_defines.h"
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -41,11 +41,12 @@ typedef struct hook_data_t {
|
|||||||
} hook_data_t;
|
} hook_data_t;
|
||||||
|
|
||||||
typedef struct module_function_symbol_data_t {
|
typedef struct module_function_symbol_data_t {
|
||||||
char* name;
|
char *name;
|
||||||
void* address;
|
void *address;
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
} module_function_symbol_data_t;
|
} module_function_symbol_data_t;
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
typedef struct module_information_single_t {
|
typedef struct module_information_single_t {
|
||||||
char path[MAXIMUM_MODULE_PATH_NAME_LENGTH]; // Path where the module is stored
|
char path[MAXIMUM_MODULE_PATH_NAME_LENGTH]; // Path where the module is stored
|
||||||
dyn_linking_relocation_entry_t linking_entries[DYN_LINK_RELOCATION_LIST_LENGTH];
|
dyn_linking_relocation_entry_t linking_entries[DYN_LINK_RELOCATION_LIST_LENGTH];
|
||||||
@ -65,10 +66,12 @@ typedef struct module_information_single_t {
|
|||||||
module_function_symbol_data_t * function_symbol_entries;
|
module_function_symbol_data_t * function_symbol_entries;
|
||||||
uint32_t number_used_function_symbols;
|
uint32_t number_used_function_symbols;
|
||||||
} module_information_single_t;
|
} module_information_single_t;
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
#define MAXIMUM_MODULES 32
|
#define MAXIMUM_MODULES 32
|
||||||
#define MODULE_INFORMATION_VERSION 0x00000007
|
#define MODULE_INFORMATION_VERSION 0x00000007
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
typedef struct module_information_t {
|
typedef struct module_information_t {
|
||||||
uint32_t version;
|
uint32_t version;
|
||||||
int32_t number_used_modules; // Number of used function. Maximum is MAXIMUM_MODULES
|
int32_t number_used_modules; // Number of used function. Maximum is MAXIMUM_MODULES
|
||||||
@ -78,6 +81,7 @@ typedef struct module_information_t {
|
|||||||
uint32_t number_used_function_symbols;
|
uint32_t number_used_function_symbols;
|
||||||
module_information_single_t module_data[MAXIMUM_MODULES];
|
module_information_single_t module_data[MAXIMUM_MODULES];
|
||||||
} module_information_t;
|
} module_information_t;
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
typedef enum RelocationTrampolineStatus{
|
typedef enum RelocationTrampolineStatus {
|
||||||
RELOC_TRAMP_FREE = 0,
|
RELOC_TRAMP_FREE = 0,
|
||||||
RELOC_TRAMP_FIXED = 1,
|
RELOC_TRAMP_FIXED = 1,
|
||||||
RELOC_TRAMP_IMPORT_IN_PROGRESS = 2,
|
RELOC_TRAMP_IMPORT_IN_PROGRESS = 2,
|
||||||
RELOC_TRAMP_IMPORT_DONE = 3,
|
RELOC_TRAMP_IMPORT_DONE = 3,
|
||||||
} RelocationTrampolineStatus;
|
} RelocationTrampolineStatus;
|
||||||
|
|
||||||
typedef enum RelocationType{
|
typedef enum RelocationType {
|
||||||
RELOC_TYPE_FIXED = 0,
|
RELOC_TYPE_FIXED = 0,
|
||||||
RELOC_TYPE_IMPORT = 1
|
RELOC_TYPE_IMPORT = 1
|
||||||
} RelocationType;
|
} RelocationType;
|
||||||
|
@ -50,9 +50,8 @@ typedef struct wums_entry_t {
|
|||||||
WUMS_SECTION("exports"); \
|
WUMS_SECTION("exports"); \
|
||||||
const wums_loader_entry_t wums_entry_##pointer = { \
|
const wums_loader_entry_t wums_entry_##pointer = { \
|
||||||
.type = _type, \
|
.type = _type, \
|
||||||
.name = # pointer, \
|
.name = #pointer, \
|
||||||
.address = (const void*) value \
|
.address = (const void *) value}
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -33,11 +33,10 @@ 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, \
|
||||||
.target = (const void*)&(original_func) \
|
.target = (const void *) &(original_func)}
|
||||||
}
|
|
||||||
|
|
||||||
typedef enum wums_hook_type_t {
|
typedef enum wums_hook_type_t {
|
||||||
WUMS_HOOK_INIT_WUT_MALLOC,
|
WUMS_HOOK_INIT_WUT_MALLOC,
|
||||||
@ -75,27 +74,27 @@ typedef struct wums_relocs_done_args_t {
|
|||||||
} wums_relocs_done_args_t;
|
} wums_relocs_done_args_t;
|
||||||
|
|
||||||
#define WUMS_INITIALIZE(myargs) \
|
#define WUMS_INITIALIZE(myargs) \
|
||||||
void __wums__init(wums_app_init_args_t);\
|
void __wums__init(wums_app_init_args_t); \
|
||||||
WUMS_HOOK_EX(WUMS_HOOK_INIT, __wums__init); \
|
WUMS_HOOK_EX(WUMS_HOOK_INIT, __wums__init); \
|
||||||
void __wums__init(wums_app_init_args_t myargs)
|
void __wums__init(wums_app_init_args_t myargs)
|
||||||
|
|
||||||
#define WUMS_APPLICATION_STARTS() \
|
#define WUMS_APPLICATION_STARTS() \
|
||||||
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); \
|
||||||
void __wums_end()
|
void __wums_end()
|
||||||
|
|
||||||
#define WUMS_APPLICATION_REQUESTS_EXIT() \
|
#define WUMS_APPLICATION_REQUESTS_EXIT() \
|
||||||
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); \
|
||||||
void __wums_relocations_done(wums_relocs_done_args_t myargs)
|
void __wums_relocations_done(wums_relocs_done_args_t myargs)
|
||||||
|
|
||||||
@ -107,71 +106,71 @@ typedef struct wums_relocs_done_args_t {
|
|||||||
|
|
||||||
#define WUMS_USE_WUT_MALLOC() \
|
#define WUMS_USE_WUT_MALLOC() \
|
||||||
__EXTERN_C_MACRO void __init_wut_malloc(); \
|
__EXTERN_C_MACRO void __init_wut_malloc(); \
|
||||||
void on_init_wut_malloc(){ \
|
void on_init_wut_malloc() { \
|
||||||
__init_wut_malloc(); \
|
__init_wut_malloc(); \
|
||||||
}\
|
} \
|
||||||
WUMS_HOOK_EX(WUMS_HOOK_INIT_WUT_MALLOC,on_init_wut_malloc); \
|
WUMS_HOOK_EX(WUMS_HOOK_INIT_WUT_MALLOC, on_init_wut_malloc); \
|
||||||
__EXTERN_C_MACRO void __fini_wut_malloc(); \
|
__EXTERN_C_MACRO void __fini_wut_malloc(); \
|
||||||
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(); \
|
||||||
void on_init_wut_devoptab(){ \
|
void on_init_wut_devoptab() { \
|
||||||
__init_wut_devoptab(); \
|
__init_wut_devoptab(); \
|
||||||
}\
|
} \
|
||||||
WUMS_HOOK_EX(WUMS_HOOK_INIT_WUT_DEVOPTAB,on_init_wut_devoptab); \
|
WUMS_HOOK_EX(WUMS_HOOK_INIT_WUT_DEVOPTAB, on_init_wut_devoptab); \
|
||||||
__EXTERN_C_MACRO void __fini_wut_devoptab(); \
|
__EXTERN_C_MACRO void __fini_wut_devoptab(); \
|
||||||
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(); \
|
||||||
void on_init_wut_newlib(){ \
|
void on_init_wut_newlib() { \
|
||||||
__init_wut_newlib(); \
|
__init_wut_newlib(); \
|
||||||
}\
|
} \
|
||||||
WUMS_HOOK_EX(WUMS_HOOK_INIT_WUT_NEWLIB,on_init_wut_newlib); \
|
WUMS_HOOK_EX(WUMS_HOOK_INIT_WUT_NEWLIB, on_init_wut_newlib); \
|
||||||
__EXTERN_C_MACRO void __fini_wut_newlib(); \
|
__EXTERN_C_MACRO void __fini_wut_newlib(); \
|
||||||
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(); \
|
||||||
void on_init_wut_stdcpp(){ \
|
void on_init_wut_stdcpp() { \
|
||||||
__init_wut_stdcpp(); \
|
__init_wut_stdcpp(); \
|
||||||
}\
|
} \
|
||||||
WUMS_HOOK_EX(WUMS_HOOK_INIT_WUT_STDCPP,on_init_wut_stdcpp); \
|
WUMS_HOOK_EX(WUMS_HOOK_INIT_WUT_STDCPP, on_init_wut_stdcpp); \
|
||||||
__EXTERN_C_MACRO void __fini_wut_stdcpp(); \
|
__EXTERN_C_MACRO void __fini_wut_stdcpp(); \
|
||||||
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)
|
||||||
|
|
||||||
#define WUMS___INIT_WRAPPER() \
|
#define WUMS___INIT_WRAPPER() \
|
||||||
__EXTERN_C_MACRO void __init(); \
|
__EXTERN_C_MACRO void __init(); \
|
||||||
void __init_wrapper(){ \
|
void __init_wrapper() { \
|
||||||
__init(); \
|
__init(); \
|
||||||
}\
|
} \
|
||||||
WUMS_HOOK_EX(WUMS_HOOK_INIT_WRAPPER,__init_wrapper);
|
WUMS_HOOK_EX(WUMS_HOOK_INIT_WRAPPER, __init_wrapper);
|
||||||
|
|
||||||
#define WUMS___FINI_WRAPPER() \
|
#define WUMS___FINI_WRAPPER() \
|
||||||
__EXTERN_C_MACRO void __fini(); \
|
__EXTERN_C_MACRO void __fini(); \
|
||||||
void __fini_wrapper(){ \
|
void __fini_wrapper() { \
|
||||||
__fini(); \
|
__fini(); \
|
||||||
}\
|
} \
|
||||||
WUMS_HOOK_EX(WUMS_HOOK_FINI_WRAPPER,__fini_wrapper);
|
WUMS_HOOK_EX(WUMS_HOOK_FINI_WRAPPER, __fini_wrapper);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ static int __wut_socket_devoptab_added = 0;
|
|||||||
extern void socket_lib_init();
|
extern void socket_lib_init();
|
||||||
|
|
||||||
void __attribute__((weak)) __init_wut_socket() {
|
void __attribute__((weak)) __init_wut_socket() {
|
||||||
if(!&__wut_socket_init_devoptab) return;
|
if (!&__wut_socket_init_devoptab) return;
|
||||||
if (!__wut_socket_devoptab_added) {
|
if (!__wut_socket_devoptab_added) {
|
||||||
socket_lib_init();
|
socket_lib_init();
|
||||||
__wut_socket_init_devoptab();
|
__wut_socket_init_devoptab();
|
||||||
@ -19,7 +19,7 @@ void __attribute__((weak)) __init_wut_socket() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void __attribute__((weak)) __fini_wut_socket() {
|
void __attribute__((weak)) __fini_wut_socket() {
|
||||||
if(!&__wut_socket_init_devoptab || !&__wut_socket_fini_devoptab) return;
|
if (!&__wut_socket_init_devoptab || !&__wut_socket_fini_devoptab) return;
|
||||||
if (__wut_socket_devoptab_added) {
|
if (__wut_socket_devoptab_added) {
|
||||||
__wut_socket_fini_devoptab();
|
__wut_socket_fini_devoptab();
|
||||||
__wut_socket_devoptab_added = 0;
|
__wut_socket_devoptab_added = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user