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

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

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


Revision 1.9 - (hide annotations) (download) (as text)
Thu Aug 23 23:15:34 2001 UTC (18 years, 2 months ago) by stdarg
Branch: MAIN
Changes since 1.8: +28 -1 lines
File MIME type: text/x-csrc
Making way for tcl-less bind tables.

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

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23