Techneck/code/source-c/hook.h

30 lines
696 B
C

#ifndef TC_HOOK_H
#define TC_HOOK_H
#include <utility/utility.h>
typedef bool_t (*tc_fn_hook) (void *subject, void *userdata);
typedef struct tc_hook
{
tc_fn_hook function;
void *userdata;
} tc_hook_s;
typedef struct tc_hooklist
{
u32_t capacity;
u32_t num_hooks;
tc_hook_s *hooks;
} tc_hooklist_s;
tc_hooklist_s tc_new_hooklist (u32_t capacity);
void tc_add_to_hooklist (tc_hooklist_s *list, tc_fn_hook function, void *subject);
void tc_run_hooklist (tc_hooklist_s *list, void *subject);
#endif // TC_HOOK_h