]>
jfr.im git - irc/evilnet/x3.git/blob - src/eventhooks.h
1 /* eventhooks.h - Event hooks
2 * Copyright 2000-2024 Evilnet Development
4 * This file is part of x3.
6 * x3 is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with srvx; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 #ifndef INCLUDED_eventhooks_h
22 #define INCLUDED_eventhooks_h
25 #define EH_ADD_TAIL -1
26 #define EH_ADD_DEFAULT 0
28 #define DEFINE_EH_FUNC_LIST(l, d, cf) struct eh_func_list l = {NULL, NULL, d, 0, cf}
29 #define INIT_EH_FUNC_LIST(d) {NULL, NULL, d, 0}
36 typedef int (*eh_func_t
) (void *extra
, void *callextra
);
37 typedef void (*eh_clean_func_t
) (struct eh_func
*ehf
);
50 eh_clean_func_t clean
;
53 struct eh_func_list
*init_hook_func_list(struct eh_func_list
*list
, int defpos
);
54 void reg_hook_func(struct eh_func_list
*list
, eh_func_t func
, void *extra
);
55 void reg_hook_func_pos(struct eh_func_list
*list
, eh_func_t func
, void *extra
, int pos
);
56 void unreg_hook_func(struct eh_func_list
*list
, eh_func_t func
, void *extra
);
57 void free_hook_func_list(struct eh_func_list
*list
);
58 void call_hook_func_noargs(struct eh_func_list
*list
);
59 void call_hook_func_args(struct eh_func_list
*list
, void *callextra
);
61 #endif /* INCLUDED_eventhooks_h */