00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef _EGG_TCLEGG_H
00027 #define _EGG_TCLEGG_H
00028
00029 #include "lush.h"
00030
00031 #ifndef MAKING_MODS
00032 # include "proto.h"
00033 #endif
00034
00035
00036
00037
00038
00039
00040 #define CMD_LEAVE (Function)(-1)
00041
00042
00043
00044 #define MATCH_PARTIAL 0
00045 #define MATCH_EXACT 1
00046 #define MATCH_MASK 2
00047 #define MATCH_CASE 3
00048 #define MATCH_MODE 4
00049 #define MATCH_CRON 5
00050
00051
00052
00053
00054
00055
00056 #define BIND_USE_ATTR 0x010
00057
00058
00059 #define BIND_STACKABLE 0x020
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074 #define BIND_HAS_BUILTINS 0x040
00075
00076
00077
00078
00079
00080 #define BIND_WANTRET 0x080
00081
00082
00083 #define BIND_ALTER_ARGS 0x100
00084
00085
00086
00087
00088 #define BIND_STACKRET 0x200
00089
00090
00091
00092 #define BIND_NOMATCH 0
00093 #define BIND_AMBIGUOUS 1
00094 #define BIND_MATCHED 2
00095 #define BIND_EXECUTED 3
00096 #define BIND_EXEC_LOG 4
00097 #define BIND_QUIT 5
00098
00099
00100
00101
00102 typedef struct timer_str {
00103 struct timer_str *next;
00104 unsigned int mins;
00105 char *cmd;
00106 unsigned long id;
00107 } tcl_timer_t;
00108
00109
00110
00111
00112
00113
00114 typedef void (*tcleventcallback)(char *, char *, int, const char *, int);
00115
00116
00117 void do_tcl_async(char *, char *, tcleventcallback);
00118
00119 #ifdef REPLACE_NOTIFIER
00120
00121
00122 typedef struct tclevent {
00123 char *script;
00124 void *context;
00125 tcleventcallback callback;
00126 struct tclevent *next;
00127 } tclevent_t;
00128
00129 #endif
00130
00131
00132 #define STDVAR (cd, irp, argc, argv) \
00133 ClientData cd; \
00134 Tcl_Interp *irp; \
00135 int argc; \
00136 char *argv[];
00137
00138 #define BADARGS(nl, nh, example) do { \
00139 if ((argc < (nl)) || ((argc > (nh)) && ((nh) != -1))) { \
00140 Tcl_AppendResult(irp, "wrong # args: should be \"", \
00141 argv[0], (example), "\"", NULL); \
00142 return TCL_ERROR; \
00143 } \
00144 } while (0)
00145
00146 #define CHECKVALIDITY(a) do { \
00147 if (!check_validity(argv[0], (a))) { \
00148 Tcl_AppendResult(irp, "bad builtin command call!", \
00149 NULL); \
00150 return TCL_ERROR; \
00151 } \
00152 } while (0)
00153
00154 unsigned long add_timer(tcl_timer_t **, int, char *, unsigned long);
00155 int remove_timer(tcl_timer_t **, unsigned long);
00156 void list_timers(Tcl_Interp *, tcl_timer_t *);
00157 void wipe_timers(Tcl_Interp *, tcl_timer_t **);
00158 void do_check_timers(tcl_timer_t **);
00159
00160 typedef struct _tcl_strings {
00161 char *name;
00162 char *buf;
00163 int length;
00164 int flags;
00165 } tcl_strings;
00166
00167 typedef struct _tcl_int {
00168 char *name;
00169 int *val;
00170 int readonly;
00171 } tcl_ints;
00172
00173 typedef struct _tcl_coups {
00174 char *name;
00175 int *lptr;
00176 int *rptr;
00177 } tcl_coups;
00178
00179 typedef struct _tcl_cmds {
00180 char *name;
00181 IntFunc func;
00182 } tcl_cmds;
00183
00184 typedef struct _cd_tcl_cmd {
00185 char *name;
00186 IntFunc callback;
00187 void *cdata;
00188 } cd_tcl_cmd;
00189
00190 void add_tcl_commands(tcl_cmds *);
00191 void add_cd_tcl_cmds(cd_tcl_cmd *);
00192 void rem_tcl_commands(tcl_cmds *);
00193 void rem_cd_tcl_cmds(cd_tcl_cmd *);
00194 void add_tcl_strings(tcl_strings *);
00195 void rem_tcl_strings(tcl_strings *);
00196 void add_tcl_coups(tcl_coups *);
00197 void rem_tcl_coups(tcl_coups *);
00198 void add_tcl_ints(tcl_ints *);
00199 void rem_tcl_ints(tcl_ints *);
00200 void do_tcl_sync(char *, char *, tcleventcallback, int);
00201 const char *tcl_resultstring();
00202 int tcl_resultint();
00203 int tcl_resultempty();
00204 int tcl_threaded();
00205 int fork_before_tcl();
00206
00207
00208
00209
00210
00211 typedef struct LocaleTable {
00212 const char *lang;
00213 const char *encoding;
00214 } LocaleTable;
00215
00216 static const LocaleTable localeTable[] = {
00217 {"ja_JP.SJIS", "shiftjis"},
00218 {"ja_JP.EUC", "euc-jp"},
00219 {"ja_JP.JIS", "iso2022-jp"},
00220 {"ja_JP.mscode", "shiftjis"},
00221 {"ja_JP.ujis", "euc-jp"},
00222 {"ja_JP", "euc-jp"},
00223 {"Ja_JP", "shiftjis"},
00224 {"Jp_JP", "shiftjis"},
00225 {"japan", "euc-jp"},
00226 #ifdef hpux
00227 {"japanese", "shiftjis"},
00228 {"ja", "shiftjis"},
00229 #else
00230 {"japanese", "euc-jp"},
00231 {"ja", "euc-jp"},
00232 #endif
00233 {"japanese.sjis", "shiftjis"},
00234 {"japanese.euc", "euc-jp"},
00235 {"japanese-sjis", "shiftjis"},
00236 {"japanese-ujis", "euc-jp"},
00237
00238 {"ko", "euc-kr"},
00239 {"ko_KR", "euc-kr"},
00240 {"ko_KR.EUC", "euc-kr"},
00241 {"ko_KR.euc", "euc-kr"},
00242 {"ko_KR.eucKR", "euc-kr"},
00243 {"korean", "euc-kr"},
00244
00245 {"ru", "iso8859-5"},
00246 {"ru_RU", "iso8859-5"},
00247 {"ru_SU", "iso8859-5"},
00248
00249 {"zh", "cp936"},
00250
00251 {NULL, NULL}
00252 };
00253
00254 #endif