4 * Copyright (c) Tuomo Valkonen 1999-2007.
6 * Ion is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
12 #ifndef ION_LIBMAINLOOP_HOOKS_H
13 #define ION_LIBMAINLOOP_HOOKS_H
15 #include <libtu/types.h>
16 #include <libextl/extl.h>
18 INTRSTRUCT(WHookItem);
21 typedef void WHookDummy();
22 typedef bool WHookMarshall(WHookDummy *fn, void *param);
23 typedef bool WHookMarshallExtl(ExtlFn fn, void *param);
25 DECLSTRUCT(WHookItem){
28 WHookItem *next, *prev;
37 /* If hk==NULL to register, new is attempted to be created. */
38 extern WHook *mainloop_register_hook(const char *name, WHook *hk);
39 extern WHook *mainloop_unregister_hook(const char *name, WHook *hk);
40 extern WHook *mainloop_get_hook(const char *name);
42 extern WHook *create_hook();
43 extern bool hook_init(WHook *hk);
44 extern void hook_deinit(WHook *hk);
46 extern bool hook_add(WHook *hk, WHookDummy *fn);
47 extern bool hook_remove(WHook *hk, WHookDummy *fn);
48 extern WHookItem *hook_find(WHook *hk, WHookDummy *fn);
50 extern bool hook_add_extl(WHook *hk, ExtlFn fn);
51 extern bool hook_remove_extl(WHook *hk, ExtlFn fn);
52 extern WHookItem *hook_find_extl(WHook *hk, ExtlFn efn);
54 extern void hook_call(const WHook *hk, void *p,
55 WHookMarshall *m, WHookMarshallExtl *em);
56 extern void hook_call_v(const WHook *hk);
57 extern void hook_call_o(const WHook *hk, Obj *o);
58 extern void hook_call_p(const WHook *hk, void *p, WHookMarshallExtl *em);
60 extern bool hook_call_alt(const WHook *hk, void *p,
61 WHookMarshall *m, WHookMarshallExtl *em);
62 extern bool hook_call_alt_v(const WHook *hk);
63 extern bool hook_call_alt_o(const WHook *hk, Obj *o);
64 extern bool hook_call_alt_p(const WHook *hk, void *p, WHookMarshallExtl *em);
67 #endif /* ION_LIBMAINLOOP_HOOKS_H */