/[cvs]/eggdrop1.8/src/tclhash.c
ViewVC logotype

Diff of /eggdrop1.8/src/tclhash.c

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

revision 1.3.2.2 by pseudo, Wed Jan 12 13:54:00 2011 UTC revision 1.6 by thommey, Sat Jun 16 16:04:02 2012 UTC
# Line 73  static inline void *n_malloc_null(int si Line 73  static inline void *n_malloc_null(int si
73    void *ptr = nmalloc(size);    void *ptr = nmalloc(size);
74  #endif  #endif
75    
76    memset(ptr, 0, size);    egg_memset(ptr, 0, size);
77    return ptr;    return ptr;
78  }  }
79    
# Line 259  void kill_bind(void) Line 259  void kill_bind(void)
259      tl_next = tl->next;      tl_next = tl->next;
260    
261      if (!(tl->flags |= HT_DELETED))      if (!(tl->flags |= HT_DELETED))
262        putlog(LOG_DEBUG, "*", _("De-Allocated bind table %s"), tl->name);        putlog(LOG_DEBUG, "*", "De-Allocated bind table %s", tl->name);
263      tcl_bind_list_delete(tl);      tcl_bind_list_delete(tl);
264    }    }
265    H_log = NULL;    H_log = NULL;
# Line 298  tcl_bind_list_t *add_bind_table(const ch Line 298  tcl_bind_list_t *add_bind_table(const ch
298      bind_table_list = tl;      bind_table_list = tl;
299    }    }
300    
301    putlog(LOG_DEBUG, "*", _("Allocated bind table %s (flags %d)"), nme, flg);    putlog(LOG_DEBUG, "*", "Allocated bind table %s (flags %d)", nme, flg);
302    return tl;    return tl;
303  }  }
304    
# Line 311  void del_bind_table(tcl_bind_list_t *tl_ Line 311  void del_bind_table(tcl_bind_list_t *tl_
311        continue;        continue;
312      if (tl == tl_which) {      if (tl == tl_which) {
313        tl->flags |= HT_DELETED;        tl->flags |= HT_DELETED;
314        putlog(LOG_DEBUG, "*", _("De-Allocated bind table %s"), tl->name);        putlog(LOG_DEBUG, "*", "De-Allocated bind table %s", tl->name);
315        return;        return;
316      }      }
317    }    }
318    putlog(LOG_DEBUG, "*", _("??? Tried to delete not listed bind table ???"));    putlog(LOG_DEBUG, "*", "??? Tried to delete not listed bind table ???");
319  }  }
320    
321  tcl_bind_list_t *find_bind_table(const char *nme)  tcl_bind_list_t *find_bind_table(const char *nme)
# Line 744  static inline int trigger_bind(const cha Line 744  static inline int trigger_bind(const cha
744    if (x == TCL_ERROR) {    if (x == TCL_ERROR) {
745      /* FIXME: we really should be able to log longer errors */      /* FIXME: we really should be able to log longer errors */
746      putlog(LOG_MISC, "*", "Tcl error [%s]: %.*s", proc, 400, tcl_resultstring());      putlog(LOG_MISC, "*", "Tcl error [%s]: %.*s", proc, 400, tcl_resultstring());
747        Tcl_BackgroundError(interp);
748    
749      return BIND_EXECUTED;      return BIND_EXECUTED;
750    }    }
# Line 942  int check_tcl_dcc(const char *cmd, int i Line 943  int check_tcl_dcc(const char *cmd, int i
943    x = check_tcl_bind(H_dcc, cmd, &fr, " $_dcc1 $_dcc2 $_dcc3",    x = check_tcl_bind(H_dcc, cmd, &fr, " $_dcc1 $_dcc2 $_dcc3",
944                       MATCH_PARTIAL | BIND_USE_ATTR | BIND_HAS_BUILTINS);                       MATCH_PARTIAL | BIND_USE_ATTR | BIND_HAS_BUILTINS);
945    if (x == BIND_AMBIGUOUS) {    if (x == BIND_AMBIGUOUS) {
946      dprintf(idx, _("Ambiguous command.\n"));      dprintf(idx, MISC_AMBIGUOUS);
947      return 0;      return 0;
948    }    }
949    if (x == BIND_NOMATCH) {    if (x == BIND_NOMATCH) {
950      dprintf(idx, _("What?  You need '.help'\n"));      dprintf(idx, MISC_NOSUCHCMD);
951      return 0;      return 0;
952    }    }
953    
# Line 1181  void check_tcl_cron(struct tm *tm) Line 1182  void check_tcl_cron(struct tm *tm)
1182                   MATCH_CRON | BIND_STACKABLE);                   MATCH_CRON | BIND_STACKABLE);
1183  }  }
1184    
1185  int check_tcl_event(const char *event)  void check_tcl_event(const char *event)
1186    {
1187      Tcl_SetVar(interp, "_event1", (char *) event, 0);
1188      check_tcl_bind(H_event, event, 0, " $_event1",
1189                     MATCH_EXACT | BIND_STACKABLE);
1190    }
1191    
1192    int check_tcl_signal(const char *event)
1193  {  {
1194    int x;    int x;
1195    
1196    Tcl_SetVar(interp, "_event1", (char *) event, 0);    Tcl_SetVar(interp, "_event1", (char *) event, 0);
1197    x = check_tcl_bind(H_event, event, 0, " $_event1",    x = check_tcl_bind(H_event, event, 0, " $_event1",
1198                   MATCH_EXACT | BIND_STACKABLE | BIND_WANTRET);                   MATCH_EXACT | BIND_STACKABLE | BIND_STACKRET);
1199    return (x == BIND_EXEC_LOG);    return (x == BIND_EXEC_LOG);
1200  }  }
1201    
# Line 1251  void tell_binds(int idx, char *par) Line 1259  void tell_binds(int idx, char *par)
1259    if (tl_kind == NULL && name && name[0] && egg_strcasecmp(name, "all"))    if (tl_kind == NULL && name && name[0] && egg_strcasecmp(name, "all"))
1260      patmatc = 1;      patmatc = 1;
1261    
1262    dprintf(idx, _("Command bindings:\n"));    dprintf(idx, MISC_CMDBINDS);
1263    dprintf(idx, _("  TYPE FLAGS    COMMAND              HITS BINDING (TCL)\n"));    dprintf(idx, "  TYPE FLAGS    COMMAND              HITS BINDING (TCL)\n");
1264    
1265    for (tl = tl_kind ? tl_kind : bind_table_list; tl;    for (tl = tl_kind ? tl_kind : bind_table_list; tl;
1266         tl = tl_kind ? 0 : tl->next) {         tl = tl_kind ? 0 : tl->next) {
# Line 1288  void tell_binds(int idx, char *par) Line 1296  void tell_binds(int idx, char *par)
1296    }    }
1297    if (!fnd) {    if (!fnd) {
1298      if (patmatc)      if (patmatc)
1299        dprintf(idx, _("No command bindings found that match %s\n"), name);        dprintf(idx, "No command bindings found that match %s\n", name);
1300      else if (tl_kind)      else if (tl_kind)
1301        dprintf(idx, _("No command bindings for type: %s.\n"), name);        dprintf(idx, "No command bindings for type: %s.\n", name);
1302      else      else
1303        dprintf(idx, _("No command bindings exist.\n"));        dprintf(idx, "No command bindings exist.\n");
1304    }    }
1305  }  }
1306    
# Line 1309  void add_builtins(tcl_bind_list_t *tl, c Line 1317  void add_builtins(tcl_bind_list_t *tl, c
1317    for (i = 0; cc[i].name; i++) {    for (i = 0; cc[i].name; i++) {
1318      egg_snprintf(p, sizeof p, "*%s:%s", tl->name,      egg_snprintf(p, sizeof p, "*%s:%s", tl->name,
1319                   cc[i].funcname ? cc[i].funcname : cc[i].name);                   cc[i].funcname ? cc[i].funcname : cc[i].name);
1320      l = nmalloc(Tcl_ScanElement(p, &k));      l = nmalloc(Tcl_ScanElement(p, &k) + 1);
1321      Tcl_ConvertElement(p, l, k | TCL_DONT_USE_BRACES);      Tcl_ConvertElement(p, l, k | TCL_DONT_USE_BRACES);
1322      table[0].cdata = (void *) cc[i].func;      table[0].cdata = (void *) cc[i].func;
1323      add_cd_tcl_cmds(table);      add_cd_tcl_cmds(table);
# Line 1327  void rem_builtins(tcl_bind_list_t *table Line 1335  void rem_builtins(tcl_bind_list_t *table
1335    for (i = 0; cc[i].name; i++) {    for (i = 0; cc[i].name; i++) {
1336      egg_snprintf(p, sizeof p, "*%s:%s", table->name,      egg_snprintf(p, sizeof p, "*%s:%s", table->name,
1337                   cc[i].funcname ? cc[i].funcname : cc[i].name);                   cc[i].funcname ? cc[i].funcname : cc[i].name);
1338      l = nmalloc(Tcl_ScanElement(p, &k));      l = nmalloc(Tcl_ScanElement(p, &k) + 1);
1339      Tcl_ConvertElement(p, l, k | TCL_DONT_USE_BRACES);      Tcl_ConvertElement(p, l, k | TCL_DONT_USE_BRACES);
1340      Tcl_DeleteCommand(interp, p);      Tcl_DeleteCommand(interp, p);
1341      unbind_bind_entry(table, cc[i].flags, cc[i].name, l);      unbind_bind_entry(table, cc[i].flags, cc[i].name, l);

Legend:
Removed from v.1.3.2.2  
changed lines
  Added in v.1.6

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23