[cvslog] Module eggdrop1.7: Change committed

cvslog cvs at tsss.org
Sat Dec 8 21:57:00 CST 2001


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.7
Commit time: 2001-12-09 03:56:08 UTC
Commited by: stdarg <stdarg at techmonkeys.org>

Modified files:
     src/main.c src/modules.c src/tcl.c src/tclhash.c src/tclhash.h
     src/tclmisc.c

Log message:

* Converted more tcl commands to language-independence.

---------------------- diff included ----------------------
Index: eggdrop1.7/src/main.c
diff -u eggdrop1.7/src/main.c:1.99 eggdrop1.7/src/main.c:1.100
--- eggdrop1.7/src/main.c:1.99	Mon Nov 26 20:08:20 2001
+++ eggdrop1.7/src/main.c	Sat Dec  8 21:55:57 2001
@@ -5,7 +5,7 @@
  *   command line arguments
  *   context and assert debugging
  *
- * $Id: main.c,v 1.99 2001/11/27 02:08:20 ite Exp $
+ * $Id: main.c,v 1.100 2001/12/09 03:55:57 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -608,6 +608,7 @@
   sprintf(&egg_xtra[strlen(egg_xtra)], " %s", str);
 }
 
+/*
 static inline void garbage_collect(void)
 {
   static u_8bit_t	run_cnt = 0;
@@ -617,6 +618,7 @@
   else
     run_cnt++;
 }
+*/
 
 int main(int argc, char **argv)
 {
@@ -889,7 +891,7 @@
       socket_cleanup--;
 
     /* Free unused structures. */
-    garbage_collect();
+    /* garbage_collect(); */
 
     xx = sockgets(buf, &i);
     if (xx >= 0) {		/* Non-error */
Index: eggdrop1.7/src/modules.c
diff -u eggdrop1.7/src/modules.c:1.85 eggdrop1.7/src/modules.c:1.86
--- eggdrop1.7/src/modules.c:1.85	Mon Oct 29 17:01:35 2001
+++ eggdrop1.7/src/modules.c	Sat Dec  8 21:55:58 2001
@@ -4,7 +4,7 @@
  * 
  * by Darrin Smith (beldin at light.iinet.net.au)
  * 
- * $Id: modules.c,v 1.85 2001/10/29 23:01:35 ite Exp $
+ * $Id: modules.c,v 1.86 2001/12/09 03:55:58 stdarg Exp $
  */
 /* 
  * Copyright (C) 1997  Robey Pointer
@@ -232,7 +232,7 @@
   (Function) chatout,
   (Function) chanout_but,
   /* 72 - 75 */
-  (Function) check_validity,
+  (Function) 0,
   (Function) list_delete,
   (Function) list_append,
   (Function) list_contains,
Index: eggdrop1.7/src/tcl.c
diff -u eggdrop1.7/src/tcl.c:1.55 eggdrop1.7/src/tcl.c:1.56
--- eggdrop1.7/src/tcl.c:1.55	Sun Nov  4 21:47:36 2001
+++ eggdrop1.7/src/tcl.c	Sat Dec  8 21:55:58 2001
@@ -4,7 +4,7 @@
  *   Tcl initialization
  *   getting and setting Tcl/eggdrop variables
  *
- * $Id: tcl.c,v 1.55 2001/11/05 03:47:36 stdarg Exp $
+ * $Id: tcl.c,v 1.56 2001/12/09 03:55:58 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -391,7 +391,7 @@
   rem_tcl_coups(def_tcl_coups);
   rem_tcl_strings(def_tcl_strings);
   rem_tcl_ints(def_tcl_ints);
-  kill_bind();
+  kill_bind2();
   Tcl_DeleteInterp(interp);
 }
 
Index: eggdrop1.7/src/tclhash.c
diff -u eggdrop1.7/src/tclhash.c:1.56 eggdrop1.7/src/tclhash.c:1.57
--- eggdrop1.7/src/tclhash.c:1.56	Fri Oct 26 17:22:22 2001
+++ eggdrop1.7/src/tclhash.c	Sat Dec  8 21:55:58 2001
@@ -7,7 +7,7 @@
  *   (non-Tcl) procedure lookups for msg/dcc/file commands
  *   (Tcl) binding internal procedures to msg/dcc/file commands
  *
- * $Id: tclhash.c,v 1.56 2001/10/26 22:22:22 stdarg Exp $
+ * $Id: tclhash.c,v 1.57 2001/12/09 03:55:58 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -40,23 +40,12 @@
 extern int		 dcc_total;
 extern time_t		 now;
 
-/* New bind table list. */
+/* Our bind tables. */
 static bind_table_t *bind_table_list_head = NULL;
-static bind_table_t *BT_link;
-static bind_table_t *BT_disc;
-static bind_table_t *BT_away;
-static bind_table_t *BT_dcc;
-static bind_table_t *BT_chat;
-static bind_table_t *BT_act;
-static bind_table_t *BT_bcst;
-static bind_table_t *BT_note;
-static bind_table_t *BT_bot;
-static bind_table_t *BT_nkch;
-static bind_table_t *BT_chon;
-static bind_table_t *BT_chof;
-static bind_table_t *BT_chpt;
-static bind_table_t *BT_chjn;
-static bind_table_t *BT_filt;
+static bind_table_t *BT_link, *BT_disc, *BT_away, *BT_dcc;
+static bind_table_t *BT_chat, *BT_act, *BT_bcst, *BT_note;
+static bind_table_t *BT_bot, *BT_nkch, *BT_chon, *BT_chof;
+static bind_table_t *BT_chpt, *BT_chjn, *BT_filt;
 
 static char *global_filt_string; /* String for FILT binds to modify. */
 static script_str_t tclhash_script_strings[] = {
@@ -64,111 +53,28 @@
 	{0}
 };
 
-p_tcl_bind_list		bind_table_list;
-
-/* Delete trigger/command.
- */
-static inline void tcl_cmd_delete(tcl_cmd_t *tc)
-{
-  free(tc->func_name);
-  free(tc);
-}
-
-/* Delete bind and its elements.
- */
-static inline void tcl_bind_mask_delete(tcl_bind_mask_t *tm)
-{
-  tcl_cmd_t		*tc, *tc_next;
-
-  for (tc = tm->first; tc; tc = tc_next) {
-    tc_next = tc->next;
-    tcl_cmd_delete(tc);
-  }
-  free(tm->mask);
-  free(tm);
-}
-
-/* Delete bind list and its elements.
- */
-static inline void tcl_bind_list_delete(tcl_bind_list_t *tl)
-{
-  tcl_bind_mask_t	*tm, *tm_next;
-
-  for (tm = tl->first; tm; tm = tm_next) {
-    tm_next = tm->next;
-    tcl_bind_mask_delete(tm);
-  }
-  free(tl);
-}
-
-inline void garbage_collect_tclhash(void)
-{
-  tcl_bind_list_t	*tl, *tl_next, *tl_prev;
-  tcl_bind_mask_t	*tm, *tm_next, *tm_prev;
-  tcl_cmd_t		*tc, *tc_next, *tc_prev;
-
-  for (tl = bind_table_list, tl_prev = NULL; tl; tl = tl_next) {
-    tl_next = tl->next;
-
-    if (tl->flags & HT_DELETED) {
-      if (tl_prev)
-	tl_prev->next = tl->next;
-      else
-	bind_table_list = tl->next;
-      tcl_bind_list_delete(tl);
-    } else {
-      for (tm = tl->first, tm_prev = NULL; tm; tm = tm_next) {
-	tm_next = tm->next;
-
-	if (!(tm->flags & TBM_DELETED)) {
-	  for (tc = tm->first, tc_prev = NULL; tc; tc = tc_next) {
-	    tc_next = tc->next;
-
-	    if (tc->attributes & TC_DELETED) {
-	      if (tc_prev)
-		tc_prev->next = tc->next;
-	      else
-		tm->first = tc->next;
-	      tcl_cmd_delete(tc);
-	    } else
-	      tc_prev = tc;
-	  }
-	}
-
-	/* Delete the bind when it's marked as deleted or
-	   when it's empty. */
-	if ((tm->flags & TBM_DELETED) || tm->first == NULL) {
-	  if (tm_prev)
-	    tm_prev->next = tm->next;
-	  else
-	    tl->first = tm_next;
-	  tcl_bind_mask_delete(tm);
-	} else
-	  tm_prev = tm;
-      }
-      tl_prev = tl;
-    }
-  }
-}
-
-
-extern cmd_t C_dcc[];
+/* Prototypes for the commands we create in this file. */
 static int script_bind();
 static int script_unbind();
+static int script_bind_tables(script_var_t *retval);
+static int script_binds(script_var_t *retval, char *tablename);
 
-static script_simple_command_t script_commands[] = {
-	{"", NULL, NULL, NULL, 0},
-	{"bind", script_bind, "sssc", "table flags mask command", SCRIPT_INTEGER},
-	{"unbind", script_unbind, "ssss", "table flags mask command", SCRIPT_INTEGER},
+static script_command_t tclhash_script_cmds[] = {
+	{"", "bindtables", script_bind_tables, NULL, 0, "", "", 0, SCRIPT_PASS_RETVAL},
+	{"", "binds", script_binds, NULL, 1, "s", "bind-table", 0, SCRIPT_PASS_RETVAL},
+	{"", "bind", script_bind, NULL, 4, "sssc", "table flags mask command", SCRIPT_INTEGER, 0},
+	{"", "unbind", script_unbind, NULL, 4, "ssss", "table flags mask command", SCRIPT_INTEGER},
 	{0}
 };
 
+extern cmd_t C_dcc[];
+
 void binds_init(void)
 {
 	bind_table_list_head = NULL;
 	malloc_strcpy(global_filt_string, "");
 	script_link_str_table(tclhash_script_strings);
-	script_create_simple_cmd_table(script_commands);
+	script_create_cmd_table(tclhash_script_cmds);
 	BT_link = add_bind_table2("link", 2, "ss", MATCH_MASK, BIND_STACKABLE);
 	BT_nkch = add_bind_table2("nkch", 2, "ss", MATCH_MASK, BIND_STACKABLE);
 	BT_disc = add_bind_table2("disc", 1, "s", MATCH_MASK, BIND_STACKABLE);
@@ -192,22 +98,6 @@
 	while (bind_table_list_head) del_bind_table2(bind_table_list_head);
 }
 
-void kill_bind(void)
-{
-  tcl_bind_list_t	*tl, *tl_next;
-
-  rem_builtins2(BT_dcc, C_dcc);
-
-  for (tl = bind_table_list; tl; tl = tl_next) {
-    tl_next = tl->next;
-
-    if (!(tl->flags |= HT_DELETED))
-      putlog(LOG_DEBUG, "*", "De-Allocated bind table %s", tl->name);
-    tcl_bind_list_delete(tl);
-  }
-  bind_table_list = NULL;
-}
-
 bind_table_t *add_bind_table2(const char *name, int nargs, const char *syntax, int match_type, int flags)
 {
 	bind_table_t *table;
@@ -228,42 +118,6 @@
 	return(table);
 }
 
-tcl_bind_list_t *add_bind_table(const char *nme, int flg, Function func)
-{
-  tcl_bind_list_t	*tl, *tl_prev;
-  int			 v;
-
-  /* Do not allow coders to use bind table names longer than
-     4 characters. */
-  assert(strlen(nme) <= 4);
-
-  for (tl = bind_table_list, tl_prev = NULL; tl; tl_prev = tl, tl = tl->next) {
-    if (tl->flags & HT_DELETED)
-      continue;
-    v = strcasecmp(tl->name, nme);
-    if (!v)
-      return tl;	/* Duplicate, just return old value.	*/
-    if (v > 0)
-      break;		/* New. Insert at start of list.	*/
-  }
-
-  tl = calloc(1, sizeof(tcl_bind_list_t));
-  strcpy(tl->name, nme);
-  tl->flags = flg;
-  tl->func = func;
-
-  if (tl_prev) {
-    tl->next = tl_prev->next;
-    tl_prev->next = tl;
-  } else {
-    tl->next = bind_table_list;
-    bind_table_list = tl;
-  }
-
-  putlog(LOG_DEBUG, "*", "Allocated bind table %s (flags %d)", nme, flg);
-  return tl;
-}
-
 void del_bind_table2(bind_table_t *table)
 {
 	bind_table_t *cur, *prev;
@@ -293,22 +147,6 @@
 	}
 }
 
-void del_bind_table(tcl_bind_list_t *tl_which)
-{
-  tcl_bind_list_t	*tl;
-
-  for (tl = bind_table_list; tl; tl = tl->next) {
-    if (tl->flags & HT_DELETED)
-      continue;
-    if (tl == tl_which) {
-      tl->flags |= HT_DELETED;
-      putlog(LOG_DEBUG, "*", "De-Allocated bind table %s", tl->name);
-      return;
-    }
-  }
-  putlog(LOG_DEBUG, "*", "??? Tried to delete not listed bind table ???");
-}
-
 bind_table_t *find_bind_table2(const char *name)
 {
 	bind_table_t *table;
@@ -319,24 +157,7 @@
 	return(table);
 }
 
-tcl_bind_list_t *find_bind_table(const char *nme)
-{
-  tcl_bind_list_t	*tl;
-  int			 v;
-
-  for (tl = bind_table_list; tl; tl = tl->next) {
-    if (tl->flags & HT_DELETED)
-      continue;
-    v = strcasecmp(tl->name, nme);
-    if (!v)
-      return tl;
-    if (v > 0)
-      return NULL;
-  }
-  return NULL;
-}
-
-int del_bind_entry(bind_table_t *table, const char *flags, const char *mask, const char *function_name)
+int del_bind_entry(bind_table_t *table, const char *flags, const char *mask, const char *function_name, void *cdata)
 {
 	bind_chain_t *chain;
 	bind_entry_t *entry, *prev;
@@ -356,61 +177,13 @@
 	/* Delete it. */
 	if (prev) prev->next = entry->next;
 	else chain->entries = entry->next;
+	if (cdata) *(void **)cdata = entry->client_data;
 	free(entry->function_name);
 	free(entry);
 
 	return(0);
 }
 
-static void *get_bind_cdata(bind_table_t *table, const char *flags, const char *mask, const char *function_name)
-{
-	bind_chain_t *chain;
-	bind_entry_t *entry;
-
-	/* Find the correct mask entry. */
-	for (chain = table->chains; chain; chain = chain->next) {
-		if (!strcmp(chain->mask, mask)) break;
-	}
-	if (!chain) return(NULL);
-
-	/* Now find the function name in this mask entry. */
-	for (entry = chain->entries; entry; entry = entry->next) {
-		if (!strcmp(entry->function_name, function_name)) break;
-	}
-	if (!entry) return(NULL);
-	else return(entry->client_data);
-}
-
-static int unbind_bind_entry(tcl_bind_list_t *tl, const char *flags,
-			     const char *cmd, const char *proc)
-{
-  tcl_bind_mask_t	*tm;
-
-  /* Search for matching bind in bind list. */
-  for (tm = tl->first; tm; tm = tm->next) {
-    if (tm->flags & TBM_DELETED)
-      continue;
-    if (!strcmp(cmd, tm->mask))
-      break;			/* Found it! fall out! */
-  }
-
-  if (tm) {
-    tcl_cmd_t		*tc;
-
-    /* Search for matching proc in bind. */
-    for (tc = tm->first; tc; tc = tc->next) {
-      if (tc->attributes & TC_DELETED)
-	continue;
-      if (!strcasecmp(tc->func_name, proc)) {
-	/* Erase proc regardless of flags. */
-	tc->attributes |= TC_DELETED;
-	return 1;		/* Match.	*/
-      }
-    }
-  }
-  return 0;			/* No match.	*/
-}
-
 int add_bind_entry(bind_table_t *table, const char *flags, const char *mask, const char *function_name, int bind_flags, Function callback, void *client_data)
 {
 	bind_chain_t *chain;
@@ -463,72 +236,6 @@
 	return(0);
 }
 
-/* Add command (remove old one if necessary)
- */
-static int bind_bind_entry(tcl_bind_list_t *tl, const char *flags,
-			   const char *cmd, const char *proc)
-{
-  tcl_cmd_t		*tc;
-  tcl_bind_mask_t	*tm, *tm_last;
-
-  /* Search for matching bind in bind list. */
-  for (tm = tl->first, tm_last = NULL; tm; tm_last = tm, tm = tm->next) {
-    if (tm->flags & TBM_DELETED)
-      continue;
-    if (!strcmp(cmd, tm->mask))
-      break;			/* Found it! fall out! */
-  }
-
-  /* Create bind if it doesn't exist yet. */
-  if (!tm) {
-    tm = calloc(1, sizeof(tcl_bind_mask_t));
-    malloc_strcpy(tm->mask, cmd);
-
-#if (TCL_MAJOR_VERSION >= 8 && TCL_MINOR_VERSION >= 1) || (TCL_MAJOR_VERSION >= 9)
-    str_nutf8tounicode(tm->mask, strlen(tm->mask) + 1);
-#endif
-	
-    /* Link into linked list of binds. */
-    tm->next = tl->first;
-    tl->first = tm;
-  }
-
-  /* Proc already defined? If so, replace. */
-  for (tc = tm->first; tc; tc = tc->next) {
-    if (tc->attributes & TC_DELETED)
-      continue;
-    if (!strcasecmp(tc->func_name, proc)) {
-      tc->flags.match = FR_GLOBAL | FR_CHAN;
-      break_down_flags(flags, &(tc->flags), NULL);
-      return 1;
-    }
-  }
-
-  /* If this bind list is not stackable, remove the
-     old entry from this bind. */
-  if (!(tl->flags & HT_STACKABLE)) {
-    for (tc = tm->first; tc; tc = tc->next) {
-      if (tc->attributes & TC_DELETED)
-	continue;
-      /* NOTE: We assume there's only one not-yet-deleted
-               entry. */
-      tc->attributes |= TC_DELETED;
-      break;
-    }
-  }
-
-  tc = calloc(1, sizeof(tcl_cmd_t));
-  tc->flags.match = FR_GLOBAL | FR_CHAN;
-  break_down_flags(flags, &(tc->flags), NULL);
-  malloc_strcpy(tc->func_name, proc);
-
-  /* Link into linked list of the bind's command list. */
-  tc->next = tm->first;
-  tm->first = tc;
-
-  return 1;
-}
-
 static int script_bind(char *table_name, char *flags, char *mask, script_callback_t *callback)
 {
 	bind_table_t *table;
@@ -551,32 +258,11 @@
 	table = find_bind_table2(table_name);
 	if (!table) return(1);
 
-	callback = get_bind_cdata(table, flags, mask, name);
-	retval = del_bind_entry(table, flags, mask, name);
+	retval = del_bind_entry(table, flags, mask, name, &callback);
 	if (callback) callback->delete(callback);
 	return(retval);
 }
 
-int check_validity(char *nme, Function func)
-{
-  char			*p;
-  tcl_bind_list_t	*tl;
-
-  if (*nme != '*')
-    return 0;
-  p = strchr(nme + 1, ':');
-  if (p == NULL)
-    return 0;
-  *p = 0;
-  tl = find_bind_table(nme + 1);
-  *p = ':';
-  if (!tl)
-    return 0;
-  if (tl->func != func)
-    return 0;
-  return 1;
-}
-
 int findanyidx(register int z)
 {
   register int j;
@@ -587,6 +273,61 @@
   return -1;
 }
 
+/* Returns a list of bind table types. */
+static int script_bind_tables(script_var_t *retval)
+{
+	bind_table_t *table;
+	int ntables;
+	char **names;
+
+	retval->type = SCRIPT_ARRAY | SCRIPT_FREE | SCRIPT_STRING;
+
+	/* Count tables */
+	ntables = 0;
+	for (table = bind_table_list_head; table; table = table->next) ntables++;
+
+	retval->len = ntables;
+	names = (char **)malloc(sizeof(char *) * ntables);
+	ntables = 0;
+	for (table = bind_table_list_head; table; table = table->next) {
+		names[ntables] = strdup(table->name);
+		ntables++;
+	}
+	retval->value = (void *)names;
+
+	return(0);
+}
+
+/* Returns a list of binds in a given table. */
+static int script_binds(script_var_t *retval, char *tablename)
+{
+	bind_table_t *table;
+	bind_chain_t *chain;
+	bind_entry_t *entry;
+	script_var_t *sublist, *func, *flags, *mask, *hits;
+	char flagbuf[128];
+
+	retval->type = SCRIPT_ARRAY | SCRIPT_FREE | SCRIPT_VAR;
+	retval->len = 0;
+	retval->value = NULL;
+
+	table = find_bind_table2(tablename);
+	if (!table) return(0);
+
+	for (chain = table->chains; chain; chain = chain->next) {
+		for (entry = chain->entries; entry; entry = entry->next) {
+			mask = script_string(strdup(chain->mask), -1);
+			build_flags(flagbuf, &entry->user_flags, NULL);
+			flags = script_string(strdup(flagbuf), -1);
+			hits = script_int(entry->hits);
+			func = script_string(strdup(entry->function_name), -1);
+			sublist = script_list(4, flags, mask, hits, func);
+			script_list_append(retval, sublist);
+		}
+	}
+	return(0);
+}
+
 int check_bind(bind_table_t *table, const char *match, struct flag_record *_flags, ...)
 {
 	int *al; /* Argument list */
@@ -825,6 +566,6 @@
 
 	for (; cmds->name; cmds++) {
 		sprintf(name, "*%s:%s", table->name, cmds->funcname ? cmds->funcname : cmds->name);
-		del_bind_entry(table, cmds->flags, cmds->name, name);
+		del_bind_entry(table, cmds->flags, cmds->name, name, NULL);
 	}
 }
Index: eggdrop1.7/src/tclhash.h
diff -u eggdrop1.7/src/tclhash.h:1.25 eggdrop1.7/src/tclhash.h:1.26
--- eggdrop1.7/src/tclhash.h:1.25	Fri Oct 26 17:22:22 2001
+++ eggdrop1.7/src/tclhash.h	Sat Dec  8 21:55:58 2001
@@ -1,7 +1,7 @@
 /*
  * tclhash.h
  *
- * $Id: tclhash.h,v 1.25 2001/10/26 22:22:22 stdarg Exp $
+ * $Id: tclhash.h,v 1.26 2001/12/09 03:55:58 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -25,9 +25,6 @@
 #ifndef _EGG_TCLHASH_H
 #define _EGG_TCLHASH_H
 
-
-#define TC_DELETED	0x0001	/* This command/trigger was deleted.	*/
-
 /* Flags for bind entries */
 /* Does the callback want their client_data inserted as the first argument? */
 #define BIND_WANTS_CD 1
@@ -40,14 +37,6 @@
 #define BIND_RET_LOG 1
 #define BIND_RET_BREAK 2
 
-/* Callback clientdata for a tcl bind */
-typedef struct tcl_cmd_cdata_b {
-	Tcl_Interp *irp;
-	char *cmd;
-	char *syntax;
-} tcl_cmd_cdata;
-
-/* Will replace tcl_cmd_t */
 /* This holds the final information for a function listening on a bind
    table. */
 typedef struct bind_entry_b {
@@ -60,20 +49,6 @@
 	int bind_flags;
 } bind_entry_t;
 
-typedef struct tcl_cmd_b {
-  struct tcl_cmd_b	*next;
-
-  struct flag_record	 flags;
-  char			*func_name;	/* Proc name.			*/
-  int			 hits;		/* Number of times this proc
-					   was triggered.		*/
-  u_8bit_t		 attributes;	/* Flags for this entry. TC_*	*/
-} tcl_cmd_t;
-
-
-#define TBM_DELETED	0x0001	/* This mask was deleted.		*/
-
-/* Will replace tcl_bind_mask_t */
 /* This is the list of bind masks in a given table.
    For instance, in the "msg" table you might have "pass", "op",
    and "invite". */
@@ -84,22 +59,6 @@
 	int flags;
 } bind_chain_t;
 
-typedef struct tcl_bind_mask_b {
-  struct tcl_bind_mask_b *next;
-
-  tcl_cmd_t		 *first;	/* List of commands registered
-					   for this bind.		*/
-  char			 *mask;
-  u_8bit_t		  flags;	/* Flags for this entry. TBM_*	*/
-} tcl_bind_mask_t;
-
-
-#define HT_STACKABLE	0x0001	/* Triggers in this bind list may be
-				   stacked.				*/
-#define HT_DELETED	0x0002	/* This bind list was already deleted.
-				   Do not use it anymore.		*/
-
-/* Will replace tcl_bind_list_b */
 /* This is the highest-level structure. It's like the "msg" table
    or the "pubm" table. */
 typedef struct bind_table_b {
@@ -112,34 +71,10 @@
 	int flags;
 } bind_table_t;
 
-typedef struct tcl_bind_list_b {
-  struct tcl_bind_list_b *next;
-
-  tcl_bind_mask_t	 *first;	/* Pointer to registered binds
-					   for this list.		*/
-  char			  name[5];	/* Name of the bind.		*/
-  u_8bit_t		  flags;	/* Flags for this element. HT_*	*/
-  Function		  func;		/* Function used as the Tcl
-					   calling interface for procs
-					   actually representing C
-					   functions.			*/
-} tcl_bind_list_t, *p_tcl_bind_list;
-
-
 #ifndef MAKING_MODS
 
-inline void garbage_collect_tclhash(void);
-
-void init_bind(void);
-void init_bind2(void);
-void kill_bind(void);
 void kill_bind2(void);
 
-tcl_bind_list_t *add_bind_table(const char *nme, int flg, Function func);
-void del_bind_table(tcl_bind_list_t *tl_which);
-
-tcl_bind_list_t *find_bind_table(const char *nme);
-
 void check_tcl_dcc(const char *, int, const char *);
 void check_tcl_chjn(const char *, const char *, int, char, int, const char *);
 void check_tcl_chpt(const char *, const char *, int, int);
@@ -150,24 +85,15 @@
 int check_tcl_note(const char *, const char *, const char *);
 void check_tcl_listen(const char *, int);
 void check_tcl_time(struct tm *);
-void tell_binds(int, char *);
 void check_tcl_nkch(const char *, const char *);
 void check_tcl_away(const char *, int, const char *);
 void check_tcl_event(const char *);
-
 int check_tcl_chat(const char *, int, const char *);
 void check_tcl_act(const char *, int, const char *);
 void check_tcl_bcst(const char *, int, const char *);
 void check_tcl_chon(char *, int);
 void check_tcl_chof(char *, int);
 
-void check_tcl_loadunld(const char *, tcl_bind_list_t *);
-
-void rem_builtins(tcl_bind_list_t *, cmd_t *);
-void add_builtins(tcl_bind_list_t *, cmd_t *);
-
-int check_validity(char *, Function);
-
 int check_bind(bind_table_t *table, const char *match, struct flag_record *_flags, ...);
 
 bind_table_t *add_bind_table2(const char *name, int nargs, const char *syntax, int match_type, int flags);
@@ -178,21 +104,12 @@
 
 int add_bind_entry(bind_table_t *table, const char *flags, const char *mask, const char *function_name, int bind_flags, Function callback, void *client_data);
 
-int del_bind_entry(bind_table_t *table, const char *flags, const char *mask, const char *function_name);
+int del_bind_entry(bind_table_t *table, const char *flags, const char *mask, const char *function_name, void *cdata);
 
 void add_builtins2(bind_table_t *table, cmd_t *cmds);
 
 void rem_builtins2(bind_table_t *table, cmd_t *cmds);
 
 #endif
-
-
-#define CHECKVALIDITY(a)	do {					\
-	if (!check_validity(argv[0], (a))) {				\
-		Tcl_AppendResult(irp, "bad builtin command call!",	\
-				 NULL);					\
-		return TCL_ERROR;					\
-	}								\
-} while (0)
 
 #endif				/* _EGG_TCLHASH_H */
Index: eggdrop1.7/src/tclmisc.c
diff -u eggdrop1.7/src/tclmisc.c:1.35 eggdrop1.7/src/tclmisc.c:1.36
--- eggdrop1.7/src/tclmisc.c:1.35	Thu Oct 18 20:55:05 2001
+++ eggdrop1.7/src/tclmisc.c	Sat Dec  8 21:55:58 2001
@@ -3,7 +3,7 @@
  *   Tcl stubs for file system commands
  *   Tcl stubs for everything else
  *
- * $Id: tclmisc.c,v 1.35 2001/10/19 01:55:05 tothwolf Exp $
+ * $Id: tclmisc.c,v 1.36 2001/12/09 03:55:58 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -33,59 +33,12 @@
 #include <sys/utsname.h>
 #endif
 
-extern p_tcl_bind_list	 bind_table_list;
 extern struct dcc_t	*dcc;
 extern char		 origbotname[], botnetnick[], quit_msg[];
 extern struct userrec	*userlist;
 extern time_t		 now;
 extern module_entry	*module_list;
 
-static int tcl_binds STDVAR
-{
-  tcl_bind_list_t	*tl, *tl_kind;
-  tcl_bind_mask_t	*tm;
-  tcl_cmd_t		*tc;
-  char			*list[5], *g, flg[100], hits[11];
-  int			 matching = 0;
-
-  BADARGS(1, 2, " ?type/mask?");
-  if (argv[1])
-    tl_kind = find_bind_table(argv[1]);
-  else
-    tl_kind = NULL;
-  if (!tl_kind && argv[1])
-    matching = 1;
-  for (tl = tl_kind ? tl_kind : bind_table_list; tl;
-       tl = tl_kind ? 0 : tl->next) {
-    if (tl->flags & HT_DELETED)
-      continue;
-    for (tm = tl->first; tm; tm = tm->next) {
-      if (tm->flags & TBM_DELETED)
-	continue;
-      for (tc = tm->first; tc; tc = tc->next) {
-	if (tc->attributes & TC_DELETED)
-	  continue;
-        if (matching &&
-	    !wild_match(argv[1], tl->name) &&
-            !wild_match(argv[1], tm->mask) &&
-            !wild_match(argv[1], tc->func_name))
-          continue;
-	build_flags(flg, &(tc->flags), NULL);
-        snprintf(hits, sizeof hits, "%i", (int) tc->hits);
-        list[0] = tl->name;
-        list[1] = flg;
-        list[2] = tm->mask;
-        list[3] = hits;
-        list[4] = tc->func_name;
-        g = Tcl_Merge(5, list);
-        Tcl_AppendElement(irp, g);
-        Tcl_Free((char *) g);
-      }
-    }
-  }
-  return TCL_OK;
-}
-
 static int tcl_duration STDVAR
 {
   char s[70];
@@ -451,7 +404,6 @@
 #if (TCL_MAJOR_VERSION < 8)
   {"md5",		tcl_md5},
 #endif
-  {"binds",		tcl_binds},
   {"callevent",		tcl_callevent},
   {"myip6",		tcl_myip6},
   {NULL,		NULL}
----------------------- End of diff -----------------------



More information about the Changes mailing list