src/tclhash.c File Reference

#include "main.h"
#include "chan.h"
#include "users.h"
Include dependency graph for tclhash.c:

Go to the source code of this file.

Defines

#define nmalloc_null(size)   n_malloc_null(size, NULL, 0)

Functions

p_tcl_bind_list(*)(*) p_tcl_bind_list (global[181]))
p_tcl_bind_list(*)(*)(*) p_tcl_bind_list (global[182]))
p_tcl_bind_list(*)(*)(*)(*) p_tcl_bind_list (global[176]))
p_tcl_bind_list(*)(*)(*)(*)(*) p_tcl_bind_list (global[177]))
p_tcl_bind_list(*)(*)(*)(*)(*)(*) p_tcl_bind_list (global[178]))
p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*) p_tcl_bind_list (global[179]))
p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*)(*) p_tcl_bind_list (global[184]))
p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*)(*)(*) p_tcl_bind_list (global[185]))
p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*)(*)(*)(*) p_tcl_bind_list (global[174]))
p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*) p_tcl_bind_list (global[183]))
p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*) p_tcl_bind_list (global[187]))
p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*) p_tcl_bind_list (global[186]))
p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*) p_tcl_bind_list (global[175]))
p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*) p_tcl_bind_list (global[224]))
static int builtin_2char ()
static int builtin_3char ()
static int builtin_5int ()
static int builtin_cron ()
static int builtin_char ()
static int builtin_chpt ()
static int builtin_chjn ()
static int builtin_idxchar ()
static int builtin_charidx ()
static int builtin_chat ()
static int builtin_dcc ()
static int builtin_log ()
static void * n_malloc_null (int size, const char *file, int line)
static void tcl_cmd_delete (tcl_cmd_t *tc)
static void tcl_bind_mask_delete (tcl_bind_mask_t *tm)
static void tcl_bind_list_delete (tcl_bind_list_t *tl)
void garbage_collect_tclhash (void)
static int tcl_cmd_expmem (tcl_cmd_t *tc)
static int tcl_bind_mask_expmem (tcl_bind_mask_t *tm)
static int tcl_bind_list_expmem (tcl_bind_list_t *tl)
int expmem_tclhash (void)
static int tcl_bind ()
void init_bind (void)
void kill_bind (void)
tcl_bind_list_t
*p_tcl_bind_list char 
global (const char *nme, int flg, IntFunc func)
 void ((void(*)(p_tcl_bind_list)) global[9])(tcl_bind_list_t *tl_which)
tcl_bind_list_t
*p_tcl_bind_list char 
global (const char *nme)
static void dump_bind_tables (Tcl_Interp *irp)
static int unbind_bind_entry (tcl_bind_list_t *tl, const char *flags, const char *cmd, const char *proc)
static int bind_bind_entry (tcl_bind_list_t *tl, const char *flags, const char *cmd, const char *proc)
static int tcl_getbinds (tcl_bind_list_t *tl_kind, const char *name)
static int tcl_bind (ClientData cd, Tcl_Interp *irp, int argc, argv)
 int ((int(*)(char *, IntFunc)) global[72])(char *nme

Variables

Tcl_Interp *(* Tcl_Interp )(global[128]))
struct dcc_t *struct global [92]
p_tcl_bind_list bind_table_list
p_tcl_bind_list(* p_tcl_bind_list )(global[180]))
p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*)(*)(*)(*) H_chjn
p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*)(*)(*)(*) H_chpt
p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*) H_time
p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*) H_note
p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*) H_cron
p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*) H_log = 0
cmd_t C_dcc []
static cd_tcl_cmd cd_cmd_table []
Tcl_Interpirp
int argc
char * argv []

Define Documentation

#define nmalloc_null ( size   )     n_malloc_null(size, NULL, 0)

Referenced by bind_bind_entry(), and global().


Function Documentation

static int bind_bind_entry ( tcl_bind_list_t tl,
const char *  flags,
const char *  cmd,
const char *  proc 
) [static]

Definition at line 378 of file tclhash.c.

References tcl_cmd_b::attributes, break_down_flags, egg_strcasecmp, tcl_bind_mask_b::first, tcl_bind_list_b::first, tcl_bind_list_b::flags, tcl_cmd_b::flags, tcl_bind_mask_b::flags, FR_CHAN, FR_GLOBAL, tcl_cmd_b::func_name, HT_STACKABLE, tcl_bind_mask_b::mask, flag_record::match, tcl_cmd_b::next, tcl_bind_mask_b::next, nmalloc, nmalloc_null, NULL, TBM_DELETED, and TC_DELETED.

Referenced by tcl_bind().

00380 {
00381   tcl_cmd_t *tc;
00382   tcl_bind_mask_t *tm;
00383 
00384   /* Search for matching bind in bind list. */
00385   for (tm = tl->first; tm; tm = tm->next) {
00386     if (tm->flags & TBM_DELETED)
00387       continue;
00388     if (!strcmp(cmd, tm->mask))
00389       break;                    /* Found it! fall out! */
00390   }
00391 
00392   /* Create bind if it doesn't exist yet. */
00393   if (!tm) {
00394     tm = nmalloc_null(sizeof *tm);
00395     tm->mask = nmalloc(strlen(cmd) + 1);
00396     strcpy(tm->mask, cmd);
00397 
00398     /* Link into linked list of binds. */
00399     tm->next = tl->first;
00400     tl->first = tm;
00401   }
00402 
00403   /* Proc already defined? If so, replace. */
00404   for (tc = tm->first; tc; tc = tc->next) {
00405     if (tc->attributes & TC_DELETED)
00406       continue;
00407     if (!egg_strcasecmp(tc->func_name, proc)) {
00408       tc->flags.match = FR_GLOBAL | FR_CHAN;
00409       break_down_flags(flags, &(tc->flags), NULL);
00410       return 1;
00411     }
00412   }
00413 
00414   /* If this bind list is not stackable, remove the
00415    * old entry from this bind. */
00416   if (!(tl->flags & HT_STACKABLE)) {
00417     for (tc = tm->first; tc; tc = tc->next) {
00418       if (tc->attributes & TC_DELETED)
00419         continue;
00420       /* NOTE: We assume there's only one not-yet-deleted entry. */
00421       tc->attributes |= TC_DELETED;
00422       break;
00423     }
00424   }
00425 
00426   tc = nmalloc_null(sizeof *tc);
00427   tc->flags.match = FR_GLOBAL | FR_CHAN;
00428   break_down_flags(flags, &(tc->flags), NULL);
00429   tc->func_name = nmalloc(strlen(proc) + 1);
00430   strcpy(tc->func_name, proc);
00431 
00432   /* Link into linked list of the bind's command list. */
00433   tc->next = tm->first;
00434   tm->first = tc;
00435 
00436   return 1;
00437 }

Here is the caller graph for this function:

static int builtin_2char (  )  [static]

Referenced by init_bind().

Here is the caller graph for this function:

static int builtin_3char (  )  [static]

Referenced by init_bind().

Here is the caller graph for this function:

static int builtin_5int (  )  [static]

Referenced by init_bind().

Here is the caller graph for this function:

static int builtin_char (  )  [static]

Referenced by init_bind().

Here is the caller graph for this function:

static int builtin_charidx (  )  [static]

Referenced by init_bind().

Here is the caller graph for this function:

static int builtin_chat (  )  [static]

Referenced by init_bind().

Here is the caller graph for this function:

static int builtin_chjn (  )  [static]

Referenced by init_bind().

Here is the caller graph for this function:

static int builtin_chpt (  )  [static]

Referenced by init_bind().

Here is the caller graph for this function:

static int builtin_cron (  )  [static]

Referenced by init_bind().

Here is the caller graph for this function:

static int builtin_dcc (  )  [static]

Referenced by init_bind().

Here is the caller graph for this function:

static int builtin_idxchar (  )  [static]

Referenced by init_bind().

Here is the caller graph for this function:

static int builtin_log (  )  [static]

Referenced by init_bind().

Here is the caller graph for this function:

static void dump_bind_tables ( Tcl_Interp irp  )  [static]

Definition at line 330 of file tclhash.c.

References tcl_bind_list_b::flags, HT_DELETED, tcl_bind_list_b::name, tcl_bind_list_b::next, and NULL.

Referenced by tcl_bind().

00331 {
00332   tcl_bind_list_t *tl;
00333   u_8bit_t i;
00334 
00335   for (tl = bind_table_list, i = 0; tl; tl = tl->next) {
00336     if (tl->flags & HT_DELETED)
00337       continue;
00338     if (i)
00339       Tcl_AppendResult(irp, ", ", NULL);
00340     else
00341       i = 1;
00342     Tcl_AppendResult(irp, tl->name, NULL);
00343   }
00344 }

Here is the caller graph for this function:

int expmem_tclhash ( void   ) 

Definition at line 195 of file tclhash.c.

References tcl_bind_list_b::next, and tcl_bind_list_expmem().

Referenced by debug_mem_to_dcc(), and expected_memory().

00196 {
00197   int tot = 0;
00198   tcl_bind_list_t *tl;
00199 
00200   for (tl = bind_table_list; tl; tl = tl->next)
00201     tot += tcl_bind_list_expmem(tl);
00202   return tot;
00203 }

Here is the call graph for this function:

Here is the caller graph for this function:

void garbage_collect_tclhash ( void   )  [inline]

Definition at line 112 of file tclhash.c.

References tcl_cmd_b::attributes, tcl_bind_mask_b::first, tcl_bind_list_b::first, tcl_bind_mask_b::flags, tcl_bind_list_b::flags, HT_DELETED, tcl_cmd_b::next, tcl_bind_mask_b::next, tcl_bind_list_b::next, NULL, TBM_DELETED, TC_DELETED, tcl_bind_list_delete(), tcl_bind_mask_delete(), and tcl_cmd_delete().

Referenced by garbage_collect().

00113 {
00114   tcl_bind_list_t *tl, *tl_next, *tl_prev;
00115   tcl_bind_mask_t *tm, *tm_next, *tm_prev;
00116   tcl_cmd_t *tc, *tc_next, *tc_prev;
00117 
00118   for (tl = bind_table_list, tl_prev = NULL; tl; tl = tl_next) {
00119     tl_next = tl->next;
00120 
00121     if (tl->flags & HT_DELETED) {
00122       if (tl_prev)
00123         tl_prev->next = tl->next;
00124       else
00125         bind_table_list = tl->next;
00126       tcl_bind_list_delete(tl);
00127     } else {
00128       for (tm = tl->first, tm_prev = NULL; tm; tm = tm_next) {
00129         tm_next = tm->next;
00130 
00131         if (!(tm->flags & TBM_DELETED)) {
00132           for (tc = tm->first, tc_prev = NULL; tc; tc = tc_next) {
00133             tc_next = tc->next;
00134 
00135             if (tc->attributes & TC_DELETED) {
00136               if (tc_prev)
00137                 tc_prev->next = tc->next;
00138               else
00139                 tm->first = tc->next;
00140               tcl_cmd_delete(tc);
00141             } else
00142               tc_prev = tc;
00143           }
00144         }
00145 
00146         /* Delete the bind when it's marked as deleted or when it's empty. */
00147         if ((tm->flags & TBM_DELETED) || tm->first == NULL) {
00148           if (tm_prev)
00149             tm_prev->next = tm->next;
00150           else
00151             tl->first = tm_next;
00152           tcl_bind_mask_delete(tm);
00153         } else
00154           tm_prev = tm;
00155       }
00156       tl_prev = tl;
00157     }
00158   }
00159 }

Here is the call graph for this function:

Here is the caller graph for this function:

tcl_bind_list_t* p_tcl_bind_list char global ( const char *  nme  ) 

Definition at line 313 of file tclhash.c.

References egg_strcasecmp, tcl_bind_list_b::flags, HT_DELETED, tcl_bind_list_b::name, tcl_bind_list_b::next, and NULL.

00314 {
00315   tcl_bind_list_t *tl;
00316   int v;
00317 
00318   for (tl = bind_table_list; tl; tl = tl->next) {
00319     if (tl->flags & HT_DELETED)
00320       continue;
00321     v = egg_strcasecmp(tl->name, nme);
00322     if (!v)
00323       return tl;
00324     if (v > 0)
00325       return NULL;
00326   }
00327   return NULL;
00328 }

tcl_bind_list_t* p_tcl_bind_list char global ( const char *  nme,
int  flg,
IntFunc  func 
)

Definition at line 261 of file tclhash.c.

References Assert, egg_strcasecmp, HT_DELETED, LOG_DEBUG, tcl_bind_list_b::next, nmalloc_null, NULL, and putlog.

00262 {
00263   tcl_bind_list_t *tl, *tl_prev;
00264   int v;
00265 
00266   /* Do not allow coders to use bind table names longer than
00267    * 4 characters. */
00268   Assert(strlen(nme) <= 4);
00269 
00270   for (tl = bind_table_list, tl_prev = NULL; tl; tl_prev = tl, tl = tl->next) {
00271     if (tl->flags & HT_DELETED)
00272       continue;
00273     v = egg_strcasecmp(tl->name, nme);
00274     if (!v)
00275       return tl;                /* Duplicate, just return old value.    */
00276     if (v > 0)
00277       break;                    /* New. Insert at start of list.        */
00278   }
00279 
00280   tl = nmalloc_null(sizeof *tl);
00281   strcpy(tl->name, nme);
00282   tl->flags = flg;
00283   tl->func = func;
00284 
00285   if (tl_prev) {
00286     tl->next = tl_prev->next;
00287     tl_prev->next = tl;
00288   } else {
00289     tl->next = bind_table_list;
00290     bind_table_list = tl;
00291   }
00292 
00293   putlog(LOG_DEBUG, "*", "Allocated bind table %s (flags %d)", nme, flg);
00294   return tl;
00295 }

void init_bind ( void   ) 

Definition at line 215 of file tclhash.c.

References add_bind_table, add_builtins, add_cd_tcl_cmds(), builtin_2char(), builtin_3char(), builtin_5int(), builtin_char(), builtin_charidx(), builtin_chat(), builtin_chjn(), builtin_chpt(), builtin_cron(), builtin_dcc(), builtin_idxchar(), builtin_log(), Context, H_away, H_bot, H_chjn, H_chpt, H_cron, H_dcc, H_disc, H_event, H_filt, H_log, H_nkch, H_note, H_time, HT_STACKABLE, and NULL.

Referenced by init_tcl().

00216 {
00217   bind_table_list = NULL;
00218   Context;
00219   add_cd_tcl_cmds(cd_cmd_table);
00220   H_unld = add_bind_table("unld", HT_STACKABLE, builtin_char);
00221   H_time = add_bind_table("time", HT_STACKABLE, builtin_5int);
00222   H_cron = add_bind_table("cron", HT_STACKABLE, builtin_cron);
00223   H_note = add_bind_table("note", 0, builtin_3char);
00224   H_nkch = add_bind_table("nkch", HT_STACKABLE, builtin_2char);
00225   H_load = add_bind_table("load", HT_STACKABLE, builtin_char);
00226   H_link = add_bind_table("link", HT_STACKABLE, builtin_2char);
00227   H_filt = add_bind_table("filt", HT_STACKABLE, builtin_idxchar);
00228   H_disc = add_bind_table("disc", HT_STACKABLE, builtin_char);
00229   H_dcc = add_bind_table("dcc", 0, builtin_dcc);
00230   H_chpt = add_bind_table("chpt", HT_STACKABLE, builtin_chpt);
00231   H_chon = add_bind_table("chon", HT_STACKABLE, builtin_charidx);
00232   H_chof = add_bind_table("chof", HT_STACKABLE, builtin_charidx);
00233   H_chjn = add_bind_table("chjn", HT_STACKABLE, builtin_chjn);
00234   H_chat = add_bind_table("chat", HT_STACKABLE, builtin_chat);
00235   H_bot = add_bind_table("bot", 0, builtin_3char);
00236   H_bcst = add_bind_table("bcst", HT_STACKABLE, builtin_chat);
00237   H_away = add_bind_table("away", HT_STACKABLE, builtin_chat);
00238   H_act = add_bind_table("act", HT_STACKABLE, builtin_chat);
00239   H_event = add_bind_table("evnt", HT_STACKABLE, builtin_char);
00240   H_log = add_bind_table("log", HT_STACKABLE, builtin_log);
00241   add_builtins(H_dcc, C_dcc);
00242   Context;
00243 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ( (int(*)(char *, IntFunc))  global[72]  ) 
void kill_bind ( void   ) 

Definition at line 245 of file tclhash.c.

References tcl_bind_list_b::flags, H_dcc, H_log, HT_DELETED, LOG_DEBUG, tcl_bind_list_b::name, tcl_bind_list_b::next, NULL, putlog, rem_builtins, and tcl_bind_list_delete().

Referenced by kill_tcl().

00246 {
00247   tcl_bind_list_t *tl, *tl_next;
00248 
00249   rem_builtins(H_dcc, C_dcc);
00250   for (tl = bind_table_list; tl; tl = tl_next) {
00251     tl_next = tl->next;
00252 
00253     if (!(tl->flags |= HT_DELETED))
00254       putlog(LOG_DEBUG, "*", "De-Allocated bind table %s", tl->name);
00255     tcl_bind_list_delete(tl);
00256   }
00257   H_log = NULL;
00258   bind_table_list = NULL;
00259 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void* n_malloc_null ( int  size,
const char *  file,
int  line 
) [inline, static]

Definition at line 62 of file tclhash.c.

References egg_memset, n_malloc(), and nmalloc.

00063 {
00064 #ifdef DEBUG_MEM
00065 #  define nmalloc_null(size) n_malloc_null(size, __FILE__, __LINE__)
00066   void *ptr = n_malloc(size, file, line);
00067 #else
00068 #  define nmalloc_null(size) n_malloc_null(size, NULL, 0)
00069   void *ptr = nmalloc(size);
00070 #endif
00071 
00072   egg_memset(ptr, 0, size);
00073   return ptr;
00074 }

Here is the call graph for this function:

p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*) p_tcl_bind_list ( global  [224]  ) 
p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*) p_tcl_bind_list ( global  [175]  ) 
Type Constraints
p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*) p_tcl_bind_list ( global  [186]  ) 
p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*) p_tcl_bind_list ( global  [187]  ) 
Type Constraints
p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*) p_tcl_bind_list ( global  [183]  ) 
Type Constraints
p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*)(*)(*)(*) p_tcl_bind_list ( global  [174]  ) 
p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*)(*)(*) p_tcl_bind_list ( global  [185]  ) 
p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*)(*) p_tcl_bind_list ( global  [184]  ) 
p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*) p_tcl_bind_list ( global  [179]  ) 
p_tcl_bind_list(*)(*)(*)(*)(*)(*) p_tcl_bind_list ( global  [178]  ) 
p_tcl_bind_list(*)(*)(*)(*)(*) p_tcl_bind_list ( global  [177]  ) 
p_tcl_bind_list(*)(*)(*)(*) p_tcl_bind_list ( global  [176]  ) 
p_tcl_bind_list(*)(*)(*) p_tcl_bind_list ( global  [182]  ) 
p_tcl_bind_list(*)(*) p_tcl_bind_list ( global  [181]  ) 
static int tcl_bind ( ClientData  cd,
Tcl_Interp irp,
int  argc,
argv   
) [static]

Definition at line 460 of file tclhash.c.

References argc, argv, BADARGS, bind_bind_entry(), dump_bind_tables(), find_bind_table, irp, NULL, tcl_getbinds(), and unbind_bind_entry().

00461 {
00462   tcl_bind_list_t *tl;
00463 
00464   /* cd defines what tcl_bind is supposed do: 0 = bind, 1 = unbind. */
00465   if ((long int) cd == 1)
00466     BADARGS(5, 5, " type flags cmd/mask procname");
00467 
00468   else
00469     BADARGS(4, 5, " type flags cmd/mask ?procname?");
00470 
00471   tl = find_bind_table(argv[1]);
00472   if (!tl) {
00473     Tcl_AppendResult(irp, "bad type, should be one of: ", NULL);
00474     dump_bind_tables(irp);
00475     return TCL_ERROR;
00476   }
00477   if ((long int) cd == 1) {
00478     if (!unbind_bind_entry(tl, argv[2], argv[3], argv[4])) {
00479       /* Don't error if trying to re-unbind a builtin */
00480       if (argv[4][0] != '*' || argv[4][4] != ':' ||
00481           strcmp(argv[3], &argv[4][5]) || strncmp(argv[1], &argv[4][1], 3)) {
00482         Tcl_AppendResult(irp, "no such binding", NULL);
00483         return TCL_ERROR;
00484       }
00485     }
00486   } else {
00487     if (argc == 4)
00488       return tcl_getbinds(tl, argv[3]);
00489     bind_bind_entry(tl, argv[2], argv[3], argv[4]);
00490   }
00491   Tcl_AppendResult(irp, argv[3], NULL);
00492   return TCL_OK;
00493 }

Here is the call graph for this function:

static int tcl_bind (  )  [static]
static void tcl_bind_list_delete ( tcl_bind_list_t tl  )  [inline, static]

Definition at line 101 of file tclhash.c.

References tcl_bind_list_b::first, tcl_bind_mask_b::next, nfree, and tcl_bind_mask_delete().

Referenced by garbage_collect_tclhash(), and kill_bind().

00102 {
00103   tcl_bind_mask_t *tm, *tm_next;
00104 
00105   for (tm = tl->first; tm; tm = tm_next) {
00106     tm_next = tm->next;
00107     tcl_bind_mask_delete(tm);
00108   }
00109   nfree(tl);
00110 }

Here is the call graph for this function:

Here is the caller graph for this function:

static int tcl_bind_list_expmem ( tcl_bind_list_t tl  )  [inline, static]

Definition at line 184 of file tclhash.c.

References tcl_bind_list_b::first, tcl_bind_mask_b::next, and tcl_bind_mask_expmem().

Referenced by expmem_tclhash().

00185 {
00186   int tot = 0;
00187   tcl_bind_mask_t *tm;
00188 
00189   for (tm = tl->first; tm; tm = tm->next)
00190     tot += tcl_bind_mask_expmem(tm);
00191   tot += sizeof(*tl);
00192   return tot;
00193 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void tcl_bind_mask_delete ( tcl_bind_mask_t tm  )  [inline, static]

Definition at line 87 of file tclhash.c.

References tcl_bind_mask_b::first, tcl_bind_mask_b::mask, tcl_cmd_b::next, nfree, and tcl_cmd_delete().

Referenced by garbage_collect_tclhash(), and tcl_bind_list_delete().

00088 {
00089   tcl_cmd_t *tc, *tc_next;
00090 
00091   for (tc = tm->first; tc; tc = tc_next) {
00092     tc_next = tc->next;
00093     tcl_cmd_delete(tc);
00094   }
00095   nfree(tm->mask);
00096   nfree(tm);
00097 }

Here is the call graph for this function:

Here is the caller graph for this function:

static int tcl_bind_mask_expmem ( tcl_bind_mask_t tm  )  [inline, static]

Definition at line 171 of file tclhash.c.

References tcl_bind_mask_b::first, tcl_bind_mask_b::mask, tcl_cmd_b::next, and tcl_cmd_expmem().

Referenced by tcl_bind_list_expmem().

00172 {
00173   int tot = 0;
00174   tcl_cmd_t *tc;
00175 
00176   for (tc = tm->first; tc; tc = tc->next)
00177     tot += tcl_cmd_expmem(tc);
00178   if (tm->mask)
00179     tot += strlen(tm->mask) + 1;
00180   tot += sizeof(*tm);
00181   return tot;
00182 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void tcl_cmd_delete ( tcl_cmd_t tc  )  [inline, static]

Definition at line 79 of file tclhash.c.

References tcl_cmd_b::func_name, and nfree.

Referenced by garbage_collect_tclhash(), and tcl_bind_mask_delete().

00080 {
00081   nfree(tc->func_name);
00082   nfree(tc);
00083 }

Here is the caller graph for this function:

static int tcl_cmd_expmem ( tcl_cmd_t tc  )  [inline, static]

Definition at line 161 of file tclhash.c.

References tcl_cmd_b::func_name.

Referenced by tcl_bind_mask_expmem().

00162 {
00163   int tot;
00164 
00165   tot = sizeof(*tc);
00166   if (tc->func_name)
00167     tot += strlen(tc->func_name) + 1;
00168   return tot;
00169 }

Here is the caller graph for this function:

static int tcl_getbinds ( tcl_bind_list_t tl_kind,
const char *  name 
) [static]

Definition at line 439 of file tclhash.c.

References tcl_cmd_b::attributes, egg_strcasecmp, tcl_bind_mask_b::first, tcl_bind_list_b::first, tcl_bind_mask_b::flags, tcl_cmd_b::func_name, interp, tcl_bind_mask_b::mask, tcl_cmd_b::next, tcl_bind_mask_b::next, TBM_DELETED, and TC_DELETED.

Referenced by tcl_bind().

00440 {
00441   tcl_bind_mask_t *tm;
00442 
00443   for (tm = tl_kind->first; tm; tm = tm->next) {
00444     if (tm->flags & TBM_DELETED)
00445       continue;
00446     if (!egg_strcasecmp(tm->mask, name)) {
00447       tcl_cmd_t *tc;
00448 
00449       for (tc = tm->first; tc; tc = tc->next) {
00450         if (tc->attributes & TC_DELETED)
00451           continue;
00452         Tcl_AppendElement(interp, tc->func_name);
00453       }
00454       break;
00455     }
00456   }
00457   return TCL_OK;
00458 }

Here is the caller graph for this function:

static int unbind_bind_entry ( tcl_bind_list_t tl,
const char *  flags,
const char *  cmd,
const char *  proc 
) [static]

Definition at line 346 of file tclhash.c.

References tcl_cmd_b::attributes, egg_strcasecmp, tcl_bind_mask_b::first, tcl_bind_list_b::first, tcl_bind_mask_b::flags, tcl_cmd_b::func_name, tcl_bind_mask_b::mask, tcl_cmd_b::next, tcl_bind_mask_b::next, TBM_DELETED, and TC_DELETED.

Referenced by tcl_bind().

00348 {
00349   tcl_bind_mask_t *tm;
00350 
00351   /* Search for matching bind in bind list. */
00352   for (tm = tl->first; tm; tm = tm->next) {
00353     if (tm->flags & TBM_DELETED)
00354       continue;
00355     if (!strcmp(cmd, tm->mask))
00356       break;                    /* Found it! fall out! */
00357   }
00358 
00359   if (tm) {
00360     tcl_cmd_t *tc;
00361 
00362     /* Search for matching proc in bind. */
00363     for (tc = tm->first; tc; tc = tc->next) {
00364       if (tc->attributes & TC_DELETED)
00365         continue;
00366       if (!egg_strcasecmp(tc->func_name, proc)) {
00367         /* Erase proc regardless of flags. */
00368         tc->attributes |= TC_DELETED;
00369         return 1;               /* Match.       */
00370       }
00371     }
00372   }
00373   return 0;                     /* No match.    */
00374 }

Here is the caller graph for this function:

void ( (void(*)(p_tcl_bind_list))  global[9]  ) 

Definition at line 297 of file tclhash.c.

References tcl_bind_list_b::flags, HT_DELETED, LOG_DEBUG, tcl_bind_list_b::name, tcl_bind_list_b::next, and putlog.

00298 {
00299   tcl_bind_list_t *tl;
00300 
00301   for (tl = bind_table_list; tl; tl = tl->next) {
00302     if (tl->flags & HT_DELETED)
00303       continue;
00304     if (tl == tl_which) {
00305       tl->flags |= HT_DELETED;
00306       putlog(LOG_DEBUG, "*", "De-Allocated bind table %s", tl->name);
00307       return;
00308     }
00309   }
00310   putlog(LOG_DEBUG, "*", "??? Tried to delete not listed bind table ???");
00311 }


Variable Documentation

int argc
char * argv

Definition at line 41 of file tclhash.c.

Definition at line 2760 of file cmds.c.

Initial value:
 {
  {"bind",   tcl_bind, (void *) 0},
  {"unbind", tcl_bind, (void *) 1},
  {0}
}

Definition at line 209 of file tclhash.c.

time_t time_t global[129] [read]

Definition at line 37 of file tclhash.c.

p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*)(*)(*)(*) H_chjn

Definition at line 43 of file tclhash.c.

Referenced by init_bind().

p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*)(*)(*)(*) H_chpt

Definition at line 43 of file tclhash.c.

Referenced by init_bind().

p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*) H_cron

Definition at line 44 of file tclhash.c.

Referenced by init_bind().

p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*) H_log = 0

Definition at line 44 of file tclhash.c.

Referenced by init_bind(), kill_bind(), and putlog().

p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*) H_note

Definition at line 44 of file tclhash.c.

Referenced by init_bind().

p_tcl_bind_list(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*) H_time

Definition at line 43 of file tclhash.c.

Referenced by init_bind().

p_tcl_bind_list(* p_tcl_bind_list)(global[180]))
Tcl_Interp*(* Tcl_Interp)(global[128]))

Generated on 7 Sep 2016 for Eggdrop by  doxygen 1.6.1