Also log date and time
[notion/jeffpc.git] / libmainloop / hooks.h
blobbb9c54078e07a1fedf71c269776523fd7aa78c08
1 /*
2 * ion/mainloop/hooks.h
4 * Copyright (c) Tuomo Valkonen 1999-2009.
6 * See the included file LICENSE for details.
7 */
9 #ifndef ION_LIBMAINLOOP_HOOKS_H
10 #define ION_LIBMAINLOOP_HOOKS_H
12 #include <libtu/types.h>
13 #include <libextl/extl.h>
15 INTRSTRUCT(WHookItem);
16 INTRCLASS(WHook);
18 typedef void WHookDummy();
19 typedef bool WHookMarshall(WHookDummy *fn, void *param);
20 typedef bool WHookMarshallExtl(ExtlFn fn, void *param);
22 DECLSTRUCT(WHookItem){
23 WHookDummy *fn;
24 ExtlFn efn;
25 WHookItem *next, *prev;
28 DECLCLASS(WHook){
29 Obj obj;
30 WHookItem *items;
34 /* If hk==NULL to register, new is attempted to be created. */
35 extern WHook *mainloop_register_hook(const char *name, WHook *hk);
36 extern WHook *mainloop_unregister_hook(const char *name, WHook *hk);
37 extern WHook *mainloop_get_hook(const char *name);
39 extern WHook *create_hook();
40 extern bool hook_init(WHook *hk);
41 extern void hook_deinit(WHook *hk);
43 extern bool hook_add(WHook *hk, WHookDummy *fn);
44 extern bool hook_remove(WHook *hk, WHookDummy *fn);
45 extern WHookItem *hook_find(WHook *hk, WHookDummy *fn);
47 extern bool hook_add_extl(WHook *hk, ExtlFn fn);
48 extern bool hook_remove_extl(WHook *hk, ExtlFn fn);
49 extern WHookItem *hook_find_extl(WHook *hk, ExtlFn efn);
51 extern void hook_call(const WHook *hk, void *p,
52 WHookMarshall *m, WHookMarshallExtl *em);
53 extern void hook_call_v(const WHook *hk);
54 extern void hook_call_o(const WHook *hk, Obj *o);
55 extern void hook_call_p(const WHook *hk, void *p, WHookMarshallExtl *em);
57 extern bool hook_call_alt(const WHook *hk, void *p,
58 WHookMarshall *m, WHookMarshallExtl *em);
59 extern bool hook_call_alt_v(const WHook *hk);
60 extern bool hook_call_alt_o(const WHook *hk, Obj *o);
61 extern bool hook_call_alt_p(const WHook *hk, void *p, WHookMarshallExtl *em);
64 #endif /* ION_LIBMAINLOOP_HOOKS_H */