modules.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * modules.h
  3. * support for modules in eggdrop
  4. *
  5. * by Darrin Smith (beldin@light.iinet.net.au)
  6. *
  7. */
  8. #ifndef _EGG_MODULE_H
  9. #define _EGG_MODULE_H
  10. /* Module related structures
  11. */
  12. #include "mod/modvals.h"
  13. #ifndef MAKING_NUMMODS
  14. /* Modules specific functions and functions called by eggdrop
  15. */
  16. void do_module_report(int, int, char *);
  17. int module_register(char *name, Function * funcs,
  18. int major, int minor);
  19. const char *module_load(char *module_name);
  20. char *module_unload(char *module_name, char *nick);
  21. module_entry *module_find(char *name, int, int);
  22. Function *module_depend(char *, char *, int major, int minor);
  23. int module_undepend(char *);
  24. void *mod_malloc(int size, const char *modname, const char *filename, int line);
  25. void *mod_realloc(void *ptr, int size, const char *modname,
  26. const char *filename, int line);
  27. void mod_free(void *ptr, const char *modname, const char *filename, int line);
  28. void add_hook(int hook_num, Function func);
  29. void del_hook(int hook_num, Function func);
  30. void *get_next_hook(int hook_num, void *func);
  31. extern struct hook_entry {
  32. struct hook_entry *next;
  33. int (*func) ();
  34. } *hook_list[REAL_HOOKS];
  35. #define call_hook(x) do { \
  36. register struct hook_entry *p, *pn; \
  37. \
  38. for (p = hook_list[x]; p; p = pn) { \
  39. pn = p->next; \
  40. p->func(); \
  41. } \
  42. } while (0)
  43. int call_hook_cccc(int, char *, char *, char *, char *);
  44. #endif
  45. typedef struct _dependancy {
  46. struct _module_entry *needed;
  47. struct _module_entry *needing;
  48. struct _dependancy *next;
  49. int major;
  50. int minor;
  51. } dependancy;
  52. extern dependancy *dependancy_list;
  53. #endif /* _EGG_MODULE_H */