/[cvs]/eggdrop1.8/src/tclegg.h
ViewVC logotype

Contents of /eggdrop1.8/src/tclegg.h

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


Revision 1.1.1.1 - (show annotations) (download) (as text) (vendor branch)
Mon Jul 26 21:11:06 2010 UTC (8 years, 9 months ago) by simple
Branch: eggheads
CVS Tags: v1
Changes since 1.1: +0 -0 lines
File MIME type: text/x-csrc
Imported Eggdrop 1.6.20

1 /*
2 * tclegg.h
3 * stuff used by tcl.c and tclhash.c
4 *
5 * $Id: tclegg.h,v 1.40 2010/06/29 15:52:24 thommey Exp $
6 */
7 /*
8 * Copyright (C) 1997 Robey Pointer
9 * Copyright (C) 1999 - 2010 Eggheads Development Team
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 */
25
26 #ifndef _EGG_TCLEGG_H
27 #define _EGG_TCLEGG_H
28
29 #include "lush.h"
30
31 #ifndef MAKING_MODS
32 # include "proto.h"
33 #endif
34
35
36 /*
37 * Wow, this is old...CMD_LEAVE goes back to before version 0.9.
38 * This is for partyline and filesys 'quit'.
39 */
40 #define CMD_LEAVE (Function)(-1)
41
42
43 /* Match types for check_tcl_bind(). */
44 #define MATCH_PARTIAL 0
45 #define MATCH_EXACT 1
46 #define MATCH_MASK 2
47 #define MATCH_CASE 3
48 #define MATCH_MODE 4
49 #define MATCH_CRON 5
50
51 /*
52 * Bitwise 'or' these:
53 */
54
55 /* Check flags; make sure the user has the flags required. */
56 #define BIND_USE_ATTR 0x010
57
58 /* Bind is stackable; more than one bind can have the same name. */
59 #define BIND_STACKABLE 0x020
60
61 /* Additional flag checking; check for +d, +k, etc.
62 * Currently used for dcc, fil, msg, and pub bind types.
63 * Note that this just causes the flag checking to use flagrec_ok()
64 * instead of flagrec_eq().
65 */
66 /* FIXME: Should this really be used for the dcc and fil types since
67 * they are only available to the partyline/filesys (+p/+x)?
68 * Eggdrop's revenge code does not add default flags when
69 * adding a user record for +d or +k flags.
70 */
71 /* FIXME: This type actually seems to be obsolete. This was originally
72 * used to check built-in types in Eggdrop version 1.0.
73 */
74 #define BIND_HAS_BUILTINS 0x040
75
76 /* Want return; we want to know if the proc returns 1.
77 * Side effect: immediate return; don't do any further
78 * processing of stacked binds.
79 */
80 #define BIND_WANTRET 0x080
81
82 /* Alternate args; replace args with the return result from the Tcl proc. */
83 #define BIND_ALTER_ARGS 0x100
84
85 /* Stacked return; we want to know if any proc returns 1,
86 * and also want to process all stacked binds.
87 */
88 #define BIND_STACKRET 0x200
89
90
91 /* Return values. */
92 #define BIND_NOMATCH 0
93 #define BIND_AMBIGUOUS 1
94 #define BIND_MATCHED 2 /* But the proc couldn't be found */
95 #define BIND_EXECUTED 3
96 #define BIND_EXEC_LOG 4 /* Proc returned 1 -> wants to be logged */
97 #define BIND_QUIT 5 /* CMD_LEAVE 'quit' from partyline or filesys */
98
99 /* Extra commands are stored in Tcl hash tables (one hash table for each type
100 * of command: msg, dcc, etc).
101 */
102 typedef struct timer_str {
103 struct timer_str *next;
104 unsigned int mins; /* Time to elapse */
105 char *cmd; /* Command linked to */
106 unsigned long id; /* Used to remove timers */
107 } tcl_timer_t;
108
109
110 /* Used for Tcl stub functions */
111 #define STDVAR (cd, irp, argc, argv) \
112 ClientData cd; \
113 Tcl_Interp *irp; \
114 int argc; \
115 char *argv[];
116
117 #define BADARGS(nl, nh, example) do { \
118 if ((argc < (nl)) || ((argc > (nh)) && ((nh) != -1))) { \
119 Tcl_AppendResult(irp, "wrong # args: should be \"", \
120 argv[0], (example), "\"", NULL); \
121 return TCL_ERROR; \
122 } \
123 } while (0)
124
125 #define CHECKVALIDITY(a) do { \
126 if (!check_validity(argv[0], (a))) { \
127 Tcl_AppendResult(irp, "bad builtin command call!", \
128 NULL); \
129 return TCL_ERROR; \
130 } \
131 } while (0)
132
133 unsigned long add_timer(tcl_timer_t **, int, char *, unsigned long);
134 int remove_timer(tcl_timer_t **, unsigned long);
135 void list_timers(Tcl_Interp *, tcl_timer_t *);
136 void wipe_timers(Tcl_Interp *, tcl_timer_t **);
137 void do_check_timers(tcl_timer_t **);
138
139 typedef struct _tcl_strings {
140 char *name;
141 char *buf;
142 int length;
143 int flags;
144 } tcl_strings;
145
146 typedef struct _tcl_int {
147 char *name;
148 int *val;
149 int readonly;
150 } tcl_ints;
151
152 typedef struct _tcl_coups {
153 char *name;
154 int *lptr;
155 int *rptr;
156 } tcl_coups;
157
158 typedef struct _tcl_cmds {
159 char *name;
160 IntFunc func;
161 } tcl_cmds;
162
163 typedef struct _cd_tcl_cmd {
164 char *name;
165 IntFunc callback;
166 void *cdata;
167 } cd_tcl_cmd;
168
169 void add_tcl_commands(tcl_cmds *);
170 void add_cd_tcl_cmds(cd_tcl_cmd *);
171 void rem_tcl_commands(tcl_cmds *);
172 void rem_cd_tcl_cmds(cd_tcl_cmd *);
173 void add_tcl_strings(tcl_strings *);
174 void rem_tcl_strings(tcl_strings *);
175 void add_tcl_coups(tcl_coups *);
176 void rem_tcl_coups(tcl_coups *);
177 void add_tcl_ints(tcl_ints *);
178 void rem_tcl_ints(tcl_ints *);
179 const char *tcl_resultstring();
180 int tcl_resultint();
181 int tcl_resultempty();
182 int tcl_threaded();
183 int fork_before_tcl();
184
185 /* From Tcl's tclUnixInit.c */
186 /* The following table is used to map from Unix locale strings to
187 * encoding files.
188 */
189 typedef struct LocaleTable {
190 const char *lang;
191 const char *encoding;
192 } LocaleTable;
193
194 static const LocaleTable localeTable[] = {
195 {"ja_JP.SJIS", "shiftjis"},
196 {"ja_JP.EUC", "euc-jp"},
197 {"ja_JP.JIS", "iso2022-jp"},
198 {"ja_JP.mscode", "shiftjis"},
199 {"ja_JP.ujis", "euc-jp"},
200 {"ja_JP", "euc-jp"},
201 {"Ja_JP", "shiftjis"},
202 {"Jp_JP", "shiftjis"},
203 {"japan", "euc-jp"},
204 #ifdef hpux
205 {"japanese", "shiftjis"},
206 {"ja", "shiftjis"},
207 #else
208 {"japanese", "euc-jp"},
209 {"ja", "euc-jp"},
210 #endif
211 {"japanese.sjis", "shiftjis"},
212 {"japanese.euc", "euc-jp"},
213 {"japanese-sjis", "shiftjis"},
214 {"japanese-ujis", "euc-jp"},
215
216 {"ko", "euc-kr"},
217 {"ko_KR", "euc-kr"},
218 {"ko_KR.EUC", "euc-kr"},
219 {"ko_KR.euc", "euc-kr"},
220 {"ko_KR.eucKR", "euc-kr"},
221 {"korean", "euc-kr"},
222
223 {"ru", "iso8859-5"},
224 {"ru_RU", "iso8859-5"},
225 {"ru_SU", "iso8859-5"},
226
227 {"zh", "cp936"},
228
229 {NULL, NULL}
230 };
231
232 #endif /* _EGG_TCLEGG_H */

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23