tclhash.h 3.9 KB

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