tclhash.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. * tclhash.h
  3. *
  4. */
  5. #ifndef _EGG_TCLHASH_H
  6. #define _EGG_TCLHASH_H
  7. #define TC_DELETED 0x0001 /* This command/trigger was deleted. */
  8. typedef struct tcl_cmd_b {
  9. struct tcl_cmd_b *next;
  10. struct flag_record flags;
  11. char *func_name; /* Proc name. */
  12. int hits; /* Number of times this proc
  13. was triggered. */
  14. u_8bit_t attributes; /* Flags for this entry. TC_* */
  15. } tcl_cmd_t;
  16. #define TBM_DELETED 0x0001 /* This mask was deleted. */
  17. typedef struct tct {
  18. struct flag_record flags;
  19. void *func;
  20. struct tct *next;
  21. } bind_cmd_t;
  22. typedef struct tcl_bind_mask_b {
  23. struct tcl_bind_mask_b *next;
  24. tcl_cmd_t *first; /* List of commands registered
  25. for this bind. */
  26. char *mask;
  27. u_8bit_t flags; /* Flags for this entry. TBM_* */
  28. } tcl_bind_mask_t;
  29. #define HT_STACKABLE 0x0001 /* Triggers in this bind list may be
  30. stacked. */
  31. #define HT_DELETED 0x0002 /* This bind list was already deleted.
  32. Do not use it anymore. */
  33. typedef struct {
  34. char *name;
  35. struct flag_record flags;
  36. } mycmds;
  37. typedef struct tcl_bind_list_b {
  38. struct tcl_bind_list_b *next;
  39. tcl_bind_mask_t *first; /* Pointer to registered binds
  40. for this list. */
  41. char name[5]; /* Name of the bind. */
  42. u_8bit_t flags; /* Flags for this element. HT_* */
  43. Function func; /* Function used as the Tcl
  44. calling interface for procs
  45. actually representing C
  46. functions. */
  47. } tcl_bind_list_t, *p_tcl_bind_list;
  48. #ifndef MAKING_MODS
  49. inline void garbage_collect_tclhash(void);
  50. void init_bind(void);
  51. void kill_bind(void);
  52. int expmem_tclhash(void);
  53. tcl_bind_list_t *add_bind_table(const char *nme, int flg, Function func);
  54. void del_bind_table(tcl_bind_list_t *tl_which);
  55. tcl_bind_list_t *find_bind_table(const char *nme);
  56. int check_tcl_bind(tcl_bind_list_t *, const char *, struct flag_record *, const char *, int);
  57. int check_tcl_dcc(char *, int, char *);
  58. void check_tcl_chjn(const char *, const char *, int, char, int, const char *);
  59. void check_tcl_chpt(const char *, const char *, int, int);
  60. void check_tcl_bot(const char *, const char *, const char *);
  61. void check_tcl_link(const char *, const char *);
  62. void check_tcl_disc(const char *);
  63. const char *check_tcl_filt(int, const char *);
  64. int check_tcl_note(const char *, const char *, const char *);
  65. void check_tcl_listen(const char *, int);
  66. void check_tcl_time(struct tm *);
  67. void tell_binds(int, char *);
  68. void check_tcl_nkch(const char *, const char *);
  69. void check_tcl_away(const char *, int, const char *);
  70. void check_tcl_chatactbcst(const char *, int, const char *, tcl_bind_list_t *);
  71. void check_tcl_event(const char *);
  72. #define check_tcl_chat(a, b, c) check_tcl_chatactbcst(a ,b, c, H_chat)
  73. #define check_tcl_act(a, b, c) check_tcl_chatactbcst(a, b, c, H_act)
  74. #define check_tcl_bcst(a, b, c) check_tcl_chatactbcst(a, b, c, H_bcst)
  75. void check_tcl_chonof(char *, int, tcl_bind_list_t *);
  76. #define check_tcl_chon(a, b) check_tcl_chonof(a, b, H_chon)
  77. #define check_tcl_chof(a, b) check_tcl_chonof(a, b, H_chof)
  78. void check_tcl_loadunld(const char *, tcl_bind_list_t *);
  79. #define check_tcl_load(a) check_tcl_loadunld(a, H_load)
  80. #define check_tcl_unld(a) check_tcl_loadunld(a, H_unld)
  81. void rem_builtins(tcl_bind_list_t *, cmd_t *);
  82. void add_builtins(tcl_bind_list_t *, cmd_t *);
  83. int check_validity(char *, Function);
  84. extern p_tcl_bind_list H_chat, H_act, H_bcst, H_chon, H_chof;
  85. extern p_tcl_bind_list H_load, H_unld, H_dcc, H_bot, H_link;
  86. extern p_tcl_bind_list H_away, H_nkch, H_filt, H_disc, H_event;
  87. #endif
  88. #define CHECKVALIDITY(a) do { \
  89. if (!check_validity(argv[0], (a))) { \
  90. Tcl_AppendResult(irp, "bad builtin command call!", \
  91. NULL); \
  92. return TCL_ERROR; \
  93. } \
  94. } while (0)
  95. #endif /* _EGG_TCLHASH_H */