/[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.11 - (show annotations) (download) (as text)
Fri Aug 24 19:46:54 2001 UTC (18 years, 1 month ago) by stdarg
Branch: MAIN
Changes since 1.10: +3 -3 lines
File MIME type: text/x-csrc
Fixed some stuff and added some more.

1 /*
2 * tclhash.h
3 *
4 * $Id: tclhash.h,v 1.10 2001/08/24 01:07:26 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 /* Will replace tcl_cmd_t */
32 /* This holds the final information for a function listening on a bind
33 table. */
34 typedef struct bind_entry_b {
35 struct bind_entry_b *next;
36 struct flag_record user_flags;
37 char *function_name;
38 Function callback;
39 void *client_data;
40 int hits;
41 int bind_flags;
42 } bind_entry_t;
43
44 typedef struct tcl_cmd_b {
45 struct tcl_cmd_b *next;
46
47 struct flag_record flags;
48 char *func_name; /* Proc name. */
49 int hits; /* Number of times this proc
50 was triggered. */
51 u_8bit_t attributes; /* Flags for this entry. TC_* */
52 } tcl_cmd_t;
53
54
55 #define TBM_DELETED 0x0001 /* This mask was deleted. */
56
57 /* Will replace tcl_bind_mask_t */
58 /* This is the list of bind masks in a given table.
59 For instance, in the "msg" table you might have "pass", "op",
60 and "invite". */
61 typedef struct bind_chain_b {
62 struct bind_chain_b *next;
63 bind_entry_t *entries;
64 char *mask;
65 int flags;
66 } bind_chain_t;
67
68 typedef struct tcl_bind_mask_b {
69 struct tcl_bind_mask_b *next;
70
71 tcl_cmd_t *first; /* List of commands registered
72 for this bind. */
73 char *mask;
74 u_8bit_t flags; /* Flags for this entry. TBM_* */
75 } tcl_bind_mask_t;
76
77
78 #define HT_STACKABLE 0x0001 /* Triggers in this bind list may be
79 stacked. */
80 #define HT_DELETED 0x0002 /* This bind list was already deleted.
81 Do not use it anymore. */
82
83 /* Will replace tcl_bind_list_b */
84 /* This is the highest-level structure. It's like the "msg" table
85 or the "pubm" table. */
86 typedef struct bind_table_b {
87 struct bind_table_b *next;
88 bind_chain_t *chains;
89 char *name;
90 int flags;
91 } bind_table_t;
92
93 typedef struct tcl_bind_list_b {
94 struct tcl_bind_list_b *next;
95
96 tcl_bind_mask_t *first; /* Pointer to registered binds
97 for this list. */
98 char name[5]; /* Name of the bind. */
99 u_8bit_t flags; /* Flags for this element. HT_* */
100 Function func; /* Function used as the Tcl
101 calling interface for procs
102 actually representing C
103 functions. */
104 } tcl_bind_list_t, *p_tcl_bind_list;
105
106
107 #ifndef MAKING_MODS
108
109 inline void garbage_collect_tclhash(void);
110
111 void init_bind(void);
112 void kill_bind(void);
113 int expmem_tclhash(void);
114
115 tcl_bind_list_t *add_bind_table(const char *nme, int flg, Function func);
116 void del_bind_table(tcl_bind_list_t *tl_which);
117
118 tcl_bind_list_t *find_bind_table(const char *nme);
119
120 int check_tcl_bind(tcl_bind_list_t *, const char *, struct flag_record *, const char *, int);
121 int check_tcl_dcc(const char *, int, const char *);
122 void check_tcl_chjn(const char *, const char *, int, char, int, const char *);
123 void check_tcl_chpt(const char *, const char *, int, int);
124 void check_tcl_bot(const char *, const char *, const char *);
125 void check_tcl_link(const char *, const char *);
126 void check_tcl_disc(const char *);
127 const char *check_tcl_filt(int, const char *);
128 int check_tcl_note(const char *, const char *, const char *);
129 void check_tcl_listen(const char *, int);
130 void check_tcl_time(struct tm *);
131 void tell_binds(int, char *);
132 void check_tcl_nkch(const char *, const char *);
133 void check_tcl_away(const char *, int, const char *);
134 void check_tcl_chatactbcst(const char *, int, const char *, tcl_bind_list_t *);
135 void check_tcl_event(const char *);
136
137 #define check_tcl_chat(a, b, c) check_tcl_chatactbcst(a ,b, c, H_chat)
138 #define check_tcl_act(a, b, c) check_tcl_chatactbcst(a, b, c, H_act)
139 #define check_tcl_bcst(a, b, c) check_tcl_chatactbcst(a, b, c, H_bcst)
140 void check_tcl_chonof(char *, int, tcl_bind_list_t *);
141
142 #define check_tcl_chon(a, b) check_tcl_chonof(a, b, H_chon)
143 #define check_tcl_chof(a, b) check_tcl_chonof(a, b, H_chof)
144 void check_tcl_loadunld(const char *, tcl_bind_list_t *);
145
146 #define check_tcl_load(a) check_tcl_loadunld(a, H_load)
147 #define check_tcl_unld(a) check_tcl_loadunld(a, H_unld)
148
149 void rem_builtins(tcl_bind_list_t *, cmd_t *);
150 void add_builtins(tcl_bind_list_t *, cmd_t *);
151
152 int check_validity(char *, Function);
153 extern p_tcl_bind_list H_chat, H_act, H_bcst, H_chon, H_chof;
154 extern p_tcl_bind_list H_load, H_unld, H_dcc, H_bot, H_link;
155 extern p_tcl_bind_list H_away, H_nkch, H_filt, H_disc, H_event;
156
157 #endif
158
159
160 #define CHECKVALIDITY(a) do { \
161 if (!check_validity(argv[0], (a))) { \
162 Tcl_AppendResult(irp, "bad builtin command call!", \
163 NULL); \
164 return TCL_ERROR; \
165 } \
166 } while (0)
167
168 #endif /* _EGG_TCLHASH_H */

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23