/[cvs]/eggdrop1.9/src/tclhash.h
ViewVC logotype

Contents of /eggdrop1.9/src/tclhash.h

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.12 - (show annotations) (download) (as text)
Sun Aug 26 03:52:32 2001 UTC (18 years, 1 month ago) by stdarg
Branch: MAIN
Changes since 1.11: +4 -1 lines
File MIME type: text/x-csrc
Continuing with new check_bind function.

1 /*
2 * tclhash.h
3 *
4 * $Id: tclhash.h,v 1.11 2001/08/24 19:46:54 stdarg Exp $
5 */
6 /*
7 * Copyright (C) 1997 Robey Pointer
8 * Copyright (C) 1999, 2000, 2001 Eggheads Development Team
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 */
24
25 #ifndef _EGG_TCLHASH_H
26 #define _EGG_TCLHASH_H
27
28
29 #define TC_DELETED 0x0001 /* This command/trigger was deleted. */
30
31 /* Does the callback want their client_data inserted as the first argument? */
32 #define BIND_WANTS_CD 1
33
34 /* Will replace tcl_cmd_t */
35 /* This holds the final information for a function listening on a bind
36 table. */
37 typedef struct bind_entry_b {
38 struct bind_entry_b *next;
39 struct flag_record user_flags;
40 char *function_name;
41 Function callback;
42 void *client_data;
43 int hits;
44 int bind_flags;
45 } bind_entry_t;
46
47 typedef struct tcl_cmd_b {
48 struct tcl_cmd_b *next;
49
50 struct flag_record flags;
51 char *func_name; /* Proc name. */
52 int hits; /* Number of times this proc
53 was triggered. */
54 u_8bit_t attributes; /* Flags for this entry. TC_* */
55 } tcl_cmd_t;
56
57
58 #define TBM_DELETED 0x0001 /* This mask was deleted. */
59
60 /* Will replace tcl_bind_mask_t */
61 /* This is the list of bind masks in a given table.
62 For instance, in the "msg" table you might have "pass", "op",
63 and "invite". */
64 typedef struct bind_chain_b {
65 struct bind_chain_b *next;
66 bind_entry_t *entries;
67 char *mask;
68 int flags;
69 } bind_chain_t;
70
71 typedef struct tcl_bind_mask_b {
72 struct tcl_bind_mask_b *next;
73
74 tcl_cmd_t *first; /* List of commands registered
75 for this bind. */
76 char *mask;
77 u_8bit_t flags; /* Flags for this entry. TBM_* */
78 } tcl_bind_mask_t;
79
80
81 #define HT_STACKABLE 0x0001 /* Triggers in this bind list may be
82 stacked. */
83 #define HT_DELETED 0x0002 /* This bind list was already deleted.
84 Do not use it anymore. */
85
86 /* Will replace tcl_bind_list_b */
87 /* This is the highest-level structure. It's like the "msg" table
88 or the "pubm" table. */
89 typedef struct bind_table_b {
90 struct bind_table_b *next;
91 bind_chain_t *chains;
92 char *name;
93 int flags;
94 } bind_table_t;
95
96 typedef struct tcl_bind_list_b {
97 struct tcl_bind_list_b *next;
98
99 tcl_bind_mask_t *first; /* Pointer to registered binds
100 for this list. */
101 char name[5]; /* Name of the bind. */
102 u_8bit_t flags; /* Flags for this element. HT_* */
103 Function func; /* Function used as the Tcl
104 calling interface for procs
105 actually representing C
106 functions. */
107 } tcl_bind_list_t, *p_tcl_bind_list;
108
109
110 #ifndef MAKING_MODS
111
112 inline void garbage_collect_tclhash(void);
113
114 void init_bind(void);
115 void kill_bind(void);
116 int expmem_tclhash(void);
117
118 tcl_bind_list_t *add_bind_table(const char *nme, int flg, Function func);
119 void del_bind_table(tcl_bind_list_t *tl_which);
120
121 tcl_bind_list_t *find_bind_table(const char *nme);
122
123 int check_tcl_bind(tcl_bind_list_t *, const char *, struct flag_record *, const char *, int);
124 int check_tcl_dcc(const char *, int, const char *);
125 void check_tcl_chjn(const char *, const char *, int, char, int, const char *);
126 void check_tcl_chpt(const char *, const char *, int, int);
127 void check_tcl_bot(const char *, const char *, const char *);
128 void check_tcl_link(const char *, const char *);
129 void check_tcl_disc(const char *);
130 const char *check_tcl_filt(int, const char *);
131 int check_tcl_note(const char *, const char *, const char *);
132 void check_tcl_listen(const char *, int);
133 void check_tcl_time(struct tm *);
134 void tell_binds(int, char *);
135 void check_tcl_nkch(const char *, const char *);
136 void check_tcl_away(const char *, int, const char *);
137 void check_tcl_chatactbcst(const char *, int, const char *, tcl_bind_list_t *);
138 void check_tcl_event(const char *);
139
140 #define check_tcl_chat(a, b, c) check_tcl_chatactbcst(a ,b, c, H_chat)
141 #define check_tcl_act(a, b, c) check_tcl_chatactbcst(a, b, c, H_act)
142 #define check_tcl_bcst(a, b, c) check_tcl_chatactbcst(a, b, c, H_bcst)
143 void check_tcl_chonof(char *, int, tcl_bind_list_t *);
144
145 #define check_tcl_chon(a, b) check_tcl_chonof(a, b, H_chon)
146 #define check_tcl_chof(a, b) check_tcl_chonof(a, b, H_chof)
147 void check_tcl_loadunld(const char *, tcl_bind_list_t *);
148
149 #define check_tcl_load(a) check_tcl_loadunld(a, H_load)
150 #define check_tcl_unld(a) check_tcl_loadunld(a, H_unld)
151
152 void rem_builtins(tcl_bind_list_t *, cmd_t *);
153 void add_builtins(tcl_bind_list_t *, cmd_t *);
154
155 int check_validity(char *, Function);
156 extern p_tcl_bind_list H_chat, H_act, H_bcst, H_chon, H_chof;
157 extern p_tcl_bind_list H_load, H_unld, H_dcc, H_bot, H_link;
158 extern p_tcl_bind_list H_away, H_nkch, H_filt, H_disc, H_event;
159
160 #endif
161
162
163 #define CHECKVALIDITY(a) do { \
164 if (!check_validity(argv[0], (a))) { \
165 Tcl_AppendResult(irp, "bad builtin command call!", \
166 NULL); \
167 return TCL_ERROR; \
168 } \
169 } while (0)
170
171 #endif /* _EGG_TCLHASH_H */

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23