#include <libzth/macros.h>
#include <stdlib.h>
Go to the source code of this file.
|
void | zth_init () |
| Perform one-time global initialization of the Zth library. More...
|
|
void | zth_preinit () |
| Initialization function to be called by the default-supplied main() , before doing anything else. More...
|
|
int | zth_postdeinit () |
| Initialization function to be called by the default-supplied main() , just before shutting down. More...
|
|
◆ ZTH_DEINIT_CALL
#define ZTH_DEINIT_CALL |
( |
|
f | ) |
|
Value:
static f##__init f##__deinit_;
#define ZTH_INIT_CALL_(f,...)
Mark the given function f to be invoked during static initialization.
Mark the given function f
to be invoked at exit.
Definition at line 64 of file init.h.
◆ ZTH_INIT_CALL
#define ZTH_INIT_CALL |
( |
|
f | ) |
|
Value:
static f##__init const f##__init_;
Definition at line 51 of file init.h.
◆ ZTH_INIT_CALL_
#define ZTH_INIT_CALL_ |
( |
|
f, |
|
|
|
... |
|
) |
| |
Value:
f##__init() \
{ \
zth_init_tail->next = this; \
zth_init_tail = this; \
zth_init_head = this; \
} \
static void exec(){__VA_ARGS__}; \
};
struct zth_init_entry * zth_init_tail
struct zth_init_entry const * zth_init_head
zth_init_entry(void(*f)(void), zth_init_entry const *next)
Mark the given function f
to be invoked during static initialization.
Definition at line 38 of file init.h.
◆ zth_init()
Perform one-time global initialization of the Zth library.
Initialization is only done once. It is safe to call it multiple times.
The initialization sequence is initialized by ZTH_INIT_CALL() and processed in the same order as normal static initializers are executed.
Definition at line 25 of file init.cpp.
◆ zth_postdeinit()
Initialization function to be called by the default-supplied main()
, just before shutting down.
This function can be used to run machine/board-specific cleanup in main()
before returning. The default (weak) implementation does nothing.
- Returns
- the exit code of the application, which overrides the returned value from
main_fiber()
when non-zero
Definition at line 42 of file main.cpp.
◆ zth_preinit()
Initialization function to be called by the default-supplied main()
, before doing anything else.
This function can be used to run machine/board-specific initialization in main()
even before zth_init() is invoked. The default (weak) implementation does nothing.
Definition at line 30 of file main.cpp.
◆ zth_init_head
◆ zth_init_tail