diff options
25 files changed, 1786 insertions, 1570 deletions
@@ -1,12 +1,13 @@ WeeChat ChangeLog ================= Sébastien Helleu <flashcode@flashtux.org> -v0.3.7-dev, 2011-12-17 +v0.3.7-dev, 2011-12-19 Version 0.3.7 (under dev!) -------------------------- +* core: add type "hashtable" for hdata * core: add signal "buffer_line_added" * core: add default keys "meta2-1;5D" and "meta2-1;5C" (ctrl+left/right) for gnome-terminal @@ -37,7 +38,8 @@ Version 0.3.7 (under dev!) * core: enable background process under Cygwin to connect to servers, fix reconnection problem (bug #34626) * api: add new functions strcasecmp_range, strncasecmp_range, - hdata_check_pointer, hdata_char and nicklist_get_next_item + hashtable_map_string, hdata_check_pointer, hdata_char, hdata_hashtable and + nicklist_get_next_item * irc: reset read marker of current buffer on manual /join * irc: fix crash when signon time in message 317 (whois, idle) is invalid (too large) (bug #34905) diff --git a/doc/en/weechat_plugin_api.en.txt b/doc/en/weechat_plugin_api.en.txt index 07009507a..0bd057f3c 100644 --- a/doc/en/weechat_plugin_api.en.txt +++ b/doc/en/weechat_plugin_api.en.txt @@ -3292,6 +3292,54 @@ weechat_hashtable_map (hashtable, &map_cb, NULL); [NOTE] This function is not available in scripting API. +weechat_hashtable_map_string +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_New in version 0.3.7._ + +Call a function on all hashtable entries, sending keys and values as strings. + +Prototype: + +[source,C] +---------------------------------------- +void hashtable_map_string (struct t_hashlist *hashlist, + void (*callback_map)(void *data, + struct t_hashtable *hashtable, + const char *key, + const char *value), + void *callback_map_data); +---------------------------------------- + +Arguments: + +* 'hashtable': hashtable pointer +* 'callback_map': function called for each entry in hashtable +* 'callback_map_data': pointer given to map callback when it is called + +[NOTE] +The strings 'key' and 'value' sent to callback are temporary strings, they +are deleted after call to callback. + +C example: + +[source,C] +---------------------------------------- +void +map_cb (void *data, struct t_hashtable *hashtable, + const char *key, const char *value) +{ + /* display key and value */ + weechat_printf (NULL, "key: '%s', value: '%s'", + key, value); +} +/* ... */ +weechat_hashtable_map_string (hashtable, &map_cb, NULL); +---------------------------------------- + +[NOTE] +This function is not available in scripting API. + weechat_hashtable_get_integer ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13007,6 +13055,57 @@ if ptr: weechat.prnt("", "time of last line displayed = %s" % weechat.hdata_time(hdata, ptr, "date")) ---------------------------------------- +weechat_hdata_hashtable +^^^^^^^^^^^^^^^^^^^^^^^ + +_New in version 0.3.7._ + +Return value of hashtable variable in structure using hdata. + +Prototype: + +[source,C] +---------------------------------------- +struct t_hashtable *weechat_hdata_hashtable (struct t_hdata *hdata, void *pointer, const char *name); +---------------------------------------- + +Arguments: + +* 'hdata': hdata pointer +* 'pointer': pointer to WeeChat/plugin object +* 'name': variable name (must be type "hashtable") + +Return value: + +* hashtable value of variable (pointer to hashtable) + +C example: + +[source,C] +---------------------------------------- +struct t_hdata *hdata = weechat_hdata_get ("buffer"); +struct t_gui_buffer *buffer = weechat_buffer_search_main (); +struct t_hashtable *hashtable = weechat_hdata_hashtable (hdata, buffer, "local_variables"); +weechat_printf (NULL, "%d local variables in core buffer", + weechat_hashtable_get_integer (hashtable, "items_count")); +---------------------------------------- + +Script (Python): + +[source,python] +---------------------------------------- +# prototype +hashtable = weechat.hdata_hashtable(hdata, pointer, name) + +# example +hdata = weechat.hdata_get("buffer") +buffer = weechat.buffer_search_main() +hash = weechat.hdata_hashtable(hdata, buffer, "local_variables") +weechat.prnt("", "local variables in core buffer:") +for key in hash: + weechat.prnt("", " %s == %s" % (key, hash[key])) +---------------------------------------- + weechat_hdata_get_string ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/doc/fr/weechat_plugin_api.fr.txt b/doc/fr/weechat_plugin_api.fr.txt index 1d779820c..5d9f50a79 100644 --- a/doc/fr/weechat_plugin_api.fr.txt +++ b/doc/fr/weechat_plugin_api.fr.txt @@ -3326,6 +3326,55 @@ weechat_hashtable_map (hashtable, &map_cb, NULL); [NOTE] Cette fonction n'est pas disponible dans l'API script. +weechat_hashtable_map_string +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_Nouveau dans la version 0.3.7._ + +Appelle une fonction pour chaque entrée d'une hashtable, en envoyant les clés +et valeurs sous forme de chaînes. + +Prototype : + +[source,C] +---------------------------------------- +void hashtable_map_string (struct t_hashlist *hashlist, + void (*callback_map)(void *data, + struct t_hashtable *hashtable, + const char *key, + const char *value), + void *callback_map_data); +---------------------------------------- + +Paramètres : + +* 'hashtable' : pointeur vers la hashtable +* 'callback_map' : fonction appelée pour chaque entrée de la hashtable +* 'callback_map_data' : pointeur donné au "callback" lorsqu'il est appelé + +[NOTE] +Les chaînes 'key' et 'value' envoyées au "callback" sont des chaînes +temporaires, elles sont supprimées après l'appel au "callback". + +Exemple en C : + +[source,C] +---------------------------------------- +void +map_cb (void *data, struct t_hashtable *hashtable, + const char *key, const char *value) +{ + /* afficher la clé et la valeur */ + weechat_printf (NULL, "clé: '%s', valeur: '%s'", + key, value); +} +/* ... */ +weechat_hashtable_map_string (hashtable, &map_cb, NULL); +---------------------------------------- + +[NOTE] +Cette fonction n'est pas disponible dans l'API script. + weechat_hashtable_get_integer ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13222,6 +13271,58 @@ if ptr: weechat.prnt("", "heure de la première ligne affichée = %s" % weechat.hdata_time(hdata, ptr, "date")) ---------------------------------------- +weechat_hdata_hashtable +^^^^^^^^^^^^^^^^^^^^^^^ + +_Nouveau dans la version 0.3.7._ + +Retourne la valeur de la variable dans la structure en utilisant le hdata, sous +forme de hashtable. + +Prototype : + +[source,C] +---------------------------------------- +struct t_hashtable *weechat_hdata_hashtable (struct t_hdata *hdata, void *pointer, const char *name); +---------------------------------------- + +Paramètres : + +* 'hdata' : pointeur vers le hdata +* 'pointer' : pointeur vers un objet WeeChat ou d'une extension +* 'name' : nom de la variable (doit être de type "hashtable") + +Valeur de retour : + +* valeur de la variable, sous forme de pointeur vers la hashtable + +Exemple en C : + +[source,C] +---------------------------------------- +struct t_hdata *hdata = weechat_hdata_get ("buffer"); +struct t_gui_buffer *buffer = weechat_buffer_search_main (); +struct t_hashtable *hashtable = weechat_hdata_hashtable (hdata, buffer, "local_variables"); +weechat_printf (NULL, "%d variables locales dans le tampon principal", + weechat_hashtable_get_integer (hashtable, "items_count")); +---------------------------------------- + +Script (Python) : + +[source,python] +---------------------------------------- +# prototype +hashtable = weechat.hdata_hashtable(hdata, pointer, name) + +# example +hdata = weechat.hdata_get("buffer") +buffer = weechat.buffer_search_main() +hash = weechat.hdata_hashtable(hdata, buffer, "local_variables") +weechat.prnt("", "variables locales dans le tampon principal :") +for key in hash: + weechat.prnt("", " %s == %s" % (key, hash[key])) +---------------------------------------- + weechat_hdata_get_string ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/doc/it/weechat_plugin_api.it.txt b/doc/it/weechat_plugin_api.it.txt index 256eb259c..2a75d5ae1 100644 --- a/doc/it/weechat_plugin_api.it.txt +++ b/doc/it/weechat_plugin_api.it.txt @@ -3286,6 +3286,57 @@ weechat_hashtable_map (hashtable, &map_cb, NULL); [NOTE] Questa funzione non è disponibile nelle API per lo scripting. +weechat_hashtable_map_string +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_Novità nella versione 0.3.7._ + +// TRANSLATION MISSING +Chiama una funzione su tutte le voci della tabella hash, sending keys and values +as strings. + +Prototipo: + +[source,C] +---------------------------------------- +void hashtable_map_string (struct t_hashlist *hashlist, + void (*callback_map)(void *data, + struct t_hashtable *hashtable, + const char *key, + const char *value), + void *callback_map_data); +---------------------------------------- + +Argomenti: + +* 'hashtable': puntatore alla tabella hash +* 'callback_map': funzione chiamata per ogni voce nella tabella hash +* 'callback_map_data': puntatore fornito alla mappa di callback quando chiamata + +// TRANSLATION MISSING +[NOTE] +The strings 'key' and 'value' sent to callback are temporary strings, they +are deleted after call to callback. + +Esempio in C: + +[source,C] +---------------------------------------- +void +map_cb (void *data, struct t_hashtable *hashtable, + const char *key, const char *value) +{ + /* display key and value */ + weechat_printf (NULL, "key: '%s', value: '%s'", + key, value); +} +/* ... */ +weechat_hashtable_map_string (hashtable, &map_cb, NULL); +---------------------------------------- + +[NOTE] +Questa funzione non è disponibile nelle API per lo scripting. + weechat_hashtable_get_integer ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13131,6 +13182,59 @@ if ptr: weechat.prnt("", "time of last line displayed = %s" % weechat.hdata_time(hdata, ptr, "date")) ---------------------------------------- +weechat_hdata_hashtable +^^^^^^^^^^^^^^^^^^^^^^^ + +_Novità nella versione 0.3.7._ + +// TRANSLATION MISSING +Return value of hashtable variable in structure using hdata. + +Prototipo: + +[source,C] +---------------------------------------- +struct t_hashtable *weechat_hdata_hashtable (struct t_hdata *hdata, void *pointer, const char *name); +---------------------------------------- + +Argomenti: + +* 'hdata': puntatore hdata +* 'pointer': puntatore all'oggetto di WeeChat/plugin +* 'name': nome della variabile (deve essere di tipo "hashtable") + +Valore restituito: + +// TRANSLATION MISSING +* hashtable value of variable (pointer to hashtable) + +Esempio in C: + +[source,C] +---------------------------------------- +struct t_hdata *hdata = weechat_hdata_get ("buffer"); +struct t_gui_buffer *buffer = weechat_buffer_search_main (); +struct t_hashtable *hashtable = weechat_hdata_hashtable (hdata, buffer, "local_variables"); +weechat_printf (NULL, "%d local variables in core buffer", + weechat_hashtable_get_integer (hashtable, "items_count")); +---------------------------------------- + +Script (Python): + +[source,python] +---------------------------------------- +# prototipo +hashtable = weechat.hdata_hashtable(hdata, pointer, name) + +# esempio +hdata = weechat.hdata_get("buffer") +buffer = weechat.buffer_search_main() +hash = weechat.hdata_hashtable(hdata, buffer, "local_variables") +weechat.prnt("", "local variables in core buffer:") +for key in hash: + weechat.prnt("", " %s == %s" % (key, hash[key])) +---------------------------------------- + weechat_hdata_get_string ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/core/wee-hashtable.c b/src/core/wee-hashtable.c index 90eaa8a43..f712e5459 100644 --- a/src/core/wee-hashtable.c +++ b/src/core/wee-hashtable.c @@ -423,6 +423,46 @@ hashtable_has_key (struct t_hashtable *hashtable, const void *key) } /* + * hashtable_to_string: convert a value (from any type) to a string + * Value returned is a pointer to a static buffer (except + * if type is string, then pointer to string itself is + * returned) and must be used immediately, it is + * overwritten by subsequent calls to this function. + */ + +const char * +hashtable_to_string (enum t_hashtable_type type, const void *value) +{ + static char str_value[128]; + + switch (type) + { + case HASHTABLE_INTEGER: + snprintf (str_value, sizeof (str_value), "%d", *((int *)value)); + return str_value; + break; + case HASHTABLE_STRING: + return (const char *)value; + break; + case HASHTABLE_POINTER: + case HASHTABLE_BUFFER: + snprintf (str_value, sizeof (str_value), + "0x%lx", (long unsigned int)value); + return str_value; + break; + case HASHTABLE_TIME: + snprintf (str_value, sizeof (str_value), + "%ld", (long)(*((time_t *)value))); + return str_value; + break; + case HASHTABLE_NUM_TYPES: + break; + } + + return NULL; +} + +/* * hashtable_map: call a function on all hashtable entries */ @@ -455,6 +495,54 @@ hashtable_map (struct t_hashtable *hashtable, } /* + * hashtable_map_string: call a function on all hashtable entries, + * sending keys and values as strings + */ + +void +hashtable_map_string (struct t_hashtable *hashtable, + t_hashtable_map_string *callback_map, + void *callback_map_data) +{ + int i; + struct t_hashtable_item *ptr_item, *ptr_next_item; + const char *str_key, *str_value; + char *key, *value; + + if (!hashtable) + return; + + for (i = 0; i < hashtable->size; i++) + { + ptr_item = hashtable->htable[i]; + while (ptr_item) + { + ptr_next_item = ptr_item->next_item; + + str_key = hashtable_to_string (hashtable->type_keys, + ptr_item->key); + key = (str_key) ? strdup (str_key) : NULL; + + str_value = hashtable_to_string (hashtable->type_values, + ptr_item->value); + value = (str_value) ? strdup (str_value) : NULL; + + (void) (callback_map) (callback_map_data, + hashtable, + key, + value); + + if (key) + free (key); + if (value) + free (value); + + ptr_item = ptr_next_item; + } + } +} + +/* * hashtable_duplicate_map_cb: function called for each variable in hashtable * to duplicate all keys */ @@ -510,7 +598,6 @@ hashtable_get_list_keys_map_cb (void *data, const void *key, const void *value) { struct t_weelist *list; - char str_key[128]; /* make C compiler happy */ (void) hashtable; @@ -518,27 +605,8 @@ hashtable_get_list_keys_map_cb (void *data, list = (struct t_weelist *)data; - switch (hashtable->type_keys) - { - case HASHTABLE_INTEGER: - snprintf (str_key, sizeof (str_key), "%d", *((int *)key)); - weelist_add (list, str_key, WEECHAT_LIST_POS_SORT, NULL); - break; - case HASHTABLE_STRING: - weelist_add (list, (const char *)key, WEECHAT_LIST_POS_SORT, NULL); - break; - case HASHTABLE_POINTER: - case HASHTABLE_BUFFER: - snprintf (str_key, sizeof (str_key), "0x%lx", (long unsigned int)key); - weelist_add (list, str_key, WEECHAT_LIST_POS_SORT, NULL); - break; - case HASHTABLE_TIME: - snprintf (str_key, sizeof (str_key), "%ld", (long)(*((time_t *)key))); - weelist_add (list, str_key, WEECHAT_LIST_POS_SORT, NULL); - break; - case HASHTABLE_NUM_TYPES: - break; - } + weelist_add (list, hashtable_to_string (hashtable->type_keys, key), + WEECHAT_LIST_POS_SORT, NULL); } /* @@ -584,7 +652,7 @@ hashtable_compute_length_keys_cb (void *data, struct t_hashtable *hashtable, const void *key, const void *value) { - char str_value[128]; + const char *str_key; int *length; /* make C compiler happy */ @@ -592,27 +660,9 @@ hashtable_compute_length_keys_cb (void *data, length = (int *)data; - switch (hashtable->type_keys) - { - case HASHTABLE_INTEGER: - snprintf (str_value, sizeof (str_value), "%d", *((int *)key)); - *length += strlen (str_value) + 1; - break; - case HASHTABLE_STRING: - *length += strlen ((char *)key) + 1; - break; - case HASHTABLE_POINTER: - case HASHTABLE_BUFFER: - snprintf (str_value, sizeof (str_value), "0x%lx", (long unsigned int)key); - *length += strlen (str_value) + 1; - break; - case HASHTABLE_TIME: - snprintf (str_value, sizeof (str_value), "%ld", (long)(*((time_t *)key))); - *length += strlen (str_value) + 1; - break; - case HASHTABLE_NUM_TYPES: - break; - } + str_key = hashtable_to_string (hashtable->type_keys, key); + if (str_key) + *length += strlen (str_key) + 1; } /* @@ -624,7 +674,7 @@ hashtable_compute_length_values_cb (void *data, struct t_hashtable *hashtable, const void *key, const void *value) { - char str_value[128]; + const char *str_value; int *length; /* make C compiler happy */ @@ -634,27 +684,9 @@ hashtable_compute_length_values_cb (void *data, if (value) { - switch (hashtable->type_values) - { - case HASHTABLE_INTEGER: - snprintf (str_value, sizeof (str_value), "%d", *((int *)value)); - *length += strlen (str_value) + 1; - break; - case HASHTABLE_STRING: - *length += strlen ((char *)value) + 1; - break; - case HASHTABLE_POINTER: - case HASHTABLE_BUFFER: - snprintf (str_value, sizeof (str_value), "0x%lx", (long unsigned int)value); - *length += strlen (str_value) + 1; - break; - case HASHTABLE_TIME: - snprintf (str_value, sizeof (str_value), "%ld", (long)(*((time_t *)value))); - *length += strlen (str_value) + 1; - break; - case HASHTABLE_NUM_TYPES: - break; - } + str_value = hashtable_to_string (hashtable->type_values, value); + if (str_value) + *length += strlen (str_value) + 1; } else { @@ -684,7 +716,7 @@ hashtable_build_string_keys_cb (void *data, struct t_hashtable *hashtable, const void *key, const void *value) { - char str_value[128]; + const char *str_key; char *str; /* make C compiler happy */ @@ -695,27 +727,9 @@ hashtable_build_string_keys_cb (void *data, if (str[0]) strcat (str, ","); - switch (hashtable->type_keys) - { - case HASHTABLE_INTEGER: - snprintf (str_value, sizeof (str_value), "%d", *((int *)key)); - strcat (str, str_value); - break; - case HASHTABLE_STRING: - strcat (str, (char *)key); - break; - case HASHTABLE_POINTER: - case HASHTABLE_BUFFER: - snprintf (str_value, sizeof (str_value), "0x%lx", (long unsigned int)key); - strcat (str, str_value); - break; - case HASHTABLE_TIME: - snprintf (str_value, sizeof (str_value), "%ld", (long)(*((time_t *)key))); - strcat (str, str_value); - break; - case HASHTABLE_NUM_TYPES: - break; - } + str_key = hashtable_to_string (hashtable->type_keys, key); + if (str_key) + strcat (str, str_key); } /* @@ -727,7 +741,7 @@ hashtable_build_string_values_cb (void *data, struct t_hashtable *hashtable, const void *key, const void *value) { - char str_value[128]; + const char *str_value; char *str; /* make C compiler happy */ @@ -740,27 +754,9 @@ hashtable_build_string_values_cb (void *data, if (value) { - switch (hashtable->type_values) - { - case HASHTABLE_INTEGER: - snprintf (str_value, sizeof (str_value), "%d", *((int *)value)); - strcat (str, str_value); - break; - case HASHTABLE_STRING: - strcat (str, (char *)value); - break; - case HASHTABLE_POINTER: - case HASHTABLE_BUFFER: - snprintf (str_value, sizeof (str_value), "0x%lx", (long unsigned int)value); - strcat (str, str_value); - break; - case HASHTABLE_TIME: - snprintf (str_value, sizeof (str_value), "%ld", (long)(*((time_t *)value))); - strcat (str, str_value); - break; - case HASHTABLE_NUM_TYPES: - break; - } + str_value = hashtable_to_string (hashtable->type_values, value); + if (str_value) + strcat (str, str_value); } else { @@ -777,7 +773,7 @@ hashtable_build_string_keys_values_cb (void *data, struct t_hashtable *hashtable, const void *key, const void *value) { - char str_value[128]; + const char *str_key, *str_value; char *str; str = (char *)data; @@ -785,53 +781,17 @@ hashtable_build_string_keys_values_cb (void *data, if (str[0]) strcat (str, ","); - switch (hashtable->type_keys) - { - case HASHTABLE_INTEGER: - snprintf (str_value, sizeof (str_value), "%d", *((int *)key)); - strcat (str, str_value); - break; - case HASHTABLE_STRING: - strcat (str, (char *)key); - break; - case HASHTABLE_POINTER: - case HASHTABLE_BUFFER: - snprintf (str_value, sizeof (str_value), "0x%lx", (long unsigned int)key); - strcat (str, str_value); - break; - case HASHTABLE_TIME: - snprintf (str_value, sizeof (str_value), "%ld", (long)(*((time_t *)key))); - strcat (str, str_value); - break; - case HASHTABLE_NUM_TYPES: - break; - } + str_key = hashtable_to_string (hashtable->type_keys, key); + if (str_key) + strcat (str, str_key); strcat (str, ":"); if (value) { - switch (hashtable->type_values) - { - case HASHTABLE_INTEGER: - snprintf (str_value, sizeof (str_value), "%d", *((int *)value)); - strcat (str, str_value); - break; - case HASHTABLE_STRING: - strcat (str, (char *)value); - break; - case HASHTABLE_POINTER: - case HASHTABLE_BUFFER: - snprintf (str_value, sizeof (str_value), "0x%lx", (long unsigned int)value); - strcat (str, str_value); - break; - case HASHTABLE_TIME: - snprintf (str_value, sizeof (str_value), "%ld", (long)(*((time_t *)value))); - strcat (str, str_value); - break; - case HASHTABLE_NUM_TYPES: - break; - } + str_value = hashtable_to_string (hashtable->type_values, value); + if (str_value) + strcat (str, str_value); } else { diff --git a/src/core/wee-hashtable.h b/src/core/wee-hashtable.h index 4c8eecf2f..726e00077 100644 --- a/src/core/wee-hashtable.h +++ b/src/core/wee-hashtable.h @@ -32,6 +32,9 @@ typedef void (t_hashtable_free_value)(struct t_hashtable *hashtable, typedef void (t_hashtable_map)(void *data, struct t_hashtable *hashtable, const void *key, const void *value); +typedef void (t_hashtable_map_string)(void *data, + struct t_hashtable *hashtable, + const char *key, const char *value); /* * Hashtable is a structure with an array "htable", each entry is a pointer @@ -121,6 +124,9 @@ extern int hashtable_has_key (struct t_hashtable *hashtable, const void *key); extern void hashtable_map (struct t_hashtable *hashtable, t_hashtable_map *callback_map, void *callback_map_data); +extern void hashtable_map_string (struct t_hashtable *hashtable, + t_hashtable_map_string *callback_map, + void *callback_map_data); extern struct t_hashtable *hashtable_dup (struct t_hashtable *hashtable); struct t_weelist *hashtable_get_list_keys (struct t_hashtable *hashtable); extern int hashtable_get_integer (struct t_hashtable *hashtable, diff --git a/src/core/wee-hdata.c b/src/core/wee-hdata.c index 2204af014..9e92dd8cb 100644 --- a/src/core/wee-hdata.c +++ b/src/core/wee-hdata.c @@ -38,8 +38,9 @@ struct t_hashtable *weechat_hdata = NULL; -char *hdata_type_string[7] = -{ "other", "char", "integer", "long", "string", "pointer", "time" }; +char *hdata_type_string[8] = +{ "other", "char", "integer", "long", "string", "pointer", "time", + "hashtable" }; /* @@ -403,6 +404,25 @@ hdata_time (struct t_hdata *hdata, void *pointer, const char *name) } /* + * hdata_hashtable: get hashtable value of a variable in structure using hdata + */ + +struct t_hashtable * +hdata_hashtable (struct t_hdata *hdata, void *pointer, const char *name) +{ + int offset; + + if (hdata && pointer) + { + offset = hdata_get_var_offset (hdata, name); + if (offset >= 0) + return *((struct t_hashtable **)(pointer + offset)); + } + + return NULL; +} + +/* * hdata_get_string: get a hdata property as string */ diff --git a/src/core/wee-hdata.h b/src/core/wee-hdata.h index 66d82202b..49694ce30 100644 --- a/src/core/wee-hdata.h +++ b/src/core/wee-hdata.h @@ -76,6 +76,8 @@ extern void *hdata_pointer (struct t_hdata *hdata, void *pointer, const char *name); extern time_t hdata_time (struct t_hdata *hdata, void *pointer, const char *name); +extern struct t_hashtable *hdata_hashtable (struct t_hdata *hdata, + void *pointer, const char *name); extern const char *hdata_get_string (struct t_hdata *hdata, const char *property); extern void hdata_free_all_plugin (struct t_weechat_plugin *plugin); diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index 72c10c71b..023667b60 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -3140,11 +3140,11 @@ gui_buffer_hdata_buffer_cb (void *data, const char *hdata_name) HDATA_VAR(struct t_gui_buffer, highlight_tags, STRING, NULL); HDATA_VAR(struct t_gui_buffer, highlight_tags_count, INTEGER, NULL); HDATA_VAR(struct t_gui_buffer, highlight_tags_array, POINTER, NULL); - HDATA_VAR(struct t_gui_buffer, hotlist_max_level_nicks, POINTER, NULL); + HDATA_VAR(struct t_gui_buffer, hotlist_max_level_nicks, HASHTABLE, NULL); HDATA_VAR(struct t_gui_buffer, keys, POINTER, "key"); HDATA_VAR(struct t_gui_buffer, last_key, POINTER, "key"); HDATA_VAR(struct t_gui_buffer, keys_count, INTEGER, NULL); - HDATA_VAR(struct t_gui_buffer, local_variables, POINTER, NULL); + HDATA_VAR(struct t_gui_buffer, local_variables, HASHTABLE, NULL); HDATA_VAR(struct t_gui_buffer, prev_buffer, POINTER, hdata_name); HDATA_VAR(struct t_gui_buffer, next_buffer, POINTER, hdata_name); HDATA_LIST(gui_buffers); diff --git a/src/plugins/irc/irc-redirect.c b/src/plugins/irc/irc-redirect.c index 2b26dbcad..0da1ad42c 100644 --- a/src/plugins/irc/irc-redirect.c +++ b/src/plugins/irc/irc-redirect.c @@ -1014,12 +1014,12 @@ irc_redirect_hdata_redirect_cb (void *data, const char *hdata_name) WEECHAT_HDATA_VAR(struct t_irc_redirect, timeout, INTEGER, NULL); WEECHAT_HDATA_VAR(struct t_irc_redirect, command, STRING, NULL); WEECHAT_HDATA_VAR(struct t_irc_redirect, start_time, TIME, NULL); - WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_start, POINTER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_stop, POINTER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_extra, POINTER, NULL); + WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_start, HASHTABLE, NULL); + WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_stop, HASHTABLE, NULL); + WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_extra, HASHTABLE, NULL); WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_start_received, INTEGER, NULL); WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_stop_received, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_filter, POINTER, NULL); + WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_filter, HASHTABLE, NULL); WEECHAT_HDATA_VAR(struct t_irc_redirect, output, STRING, NULL); WEECHAT_HDATA_VAR(struct t_irc_redirect, output_size, INTEGER, NULL); WEECHAT_HDATA_VAR(struct t_irc_redirect, prev_redirect, POINTER, hdata_name); diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index 8f323bc1a..970fd5088 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -4191,7 +4191,7 @@ irc_server_hdata_server_cb (void *data, const char *hdata_name) WEECHAT_HDATA_VAR(struct t_irc_server, last_redirect, POINTER, "irc_redirect"); WEECHAT_HDATA_VAR(struct t_irc_server, notify_list, POINTER, "irc_notify"); WEECHAT_HDATA_VAR(struct t_irc_server, last_notify, POINTER, "irc_notify"); - WEECHAT_HDATA_VAR(struct t_irc_server, manual_joins, POINTER, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, manual_joins, HASHTABLE, NULL); WEECHAT_HDATA_VAR(struct t_irc_server, buffer, POINTER, "buffer"); WEECHAT_HDATA_VAR(struct t_irc_server, buffer_as_string, STRING, NULL); WEECHAT_HDATA_VAR(struct t_irc_server, channels, POINTER, "irc_channel"); diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index 8b0c85e06..2ba728a81 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -571,6 +571,7 @@ plugin_load (const char *filename, int argc, char **argv) new_plugin->hashtable_get = &hashtable_get; new_plugin->hashtable_has_key = &hashtable_has_key; new_plugin->hashtable_map = &hashtable_map; + new_plugin->hashtable_map_string = &hashtable_map_string; new_plugin->hashtable_get_integer = &hashtable_get_integer; new_plugin->hashtable_get_string = &hashtable_get_string; new_plugin->hashtable_set_pointer = &hashtable_set_pointer; @@ -747,6 +748,7 @@ plugin_load (const char *filename, int argc, char **argv) new_plugin->hdata_string = &hdata_string; new_plugin->hdata_pointer = &hdata_pointer; new_plugin->hdata_time = &hdata_time; + new_plugin->hdata_hashtable = &hdata_hashtable; new_plugin->hdata_get_string = &hdata_get_string; new_plugin->upgrade_new = &upgrade_file_new; diff --git a/src/plugins/scripts/guile/weechat-guile-api.c b/src/plugins/scripts/guile/weechat-guile-api.c index 3cc2683de..6b7e4763c 100644 --- a/src/plugins/scripts/guile/weechat-guile-api.c +++ b/src/plugins/scripts/guile/weechat-guile-api.c @@ -69,6 +69,11 @@ #define API_RETURN_LONG(__long) \ return scm_from_long (__long); +#define API_DEF_FUNC(__name, __argc) \ + scm_c_define_gsubr ("weechat:" #__name, __argc, 0, 0, \ + &weechat_guile_api_##__name); \ + scm_c_export ("weechat:" #__name, NULL); + /* * weechat_guile_api_register: startup function for all WeeChat Guile scripts @@ -4395,7 +4400,7 @@ SCM weechat_guile_api_info_get_hashtable (SCM info_name, SCM hash) { struct t_hashtable *c_hashtable, *result_hashtable; - SCM result_hash; + SCM result_alist; API_FUNC(1, "info_get_hashtable", API_RETURN_EMPTY); if (!scm_is_string (info_name) || !scm_list_p (hash)) @@ -4406,14 +4411,14 @@ weechat_guile_api_info_get_hashtable (SCM info_name, SCM hash) result_hashtable = weechat_info_get_hashtable (scm_i_string_chars (info_name), c_hashtable); - result_hash = weechat_guile_hashtable_to_alist (result_hashtable); + result_alist = weechat_guile_hashtable_to_alist (result_hashtable); if (c_hashtable) weechat_hashtable_free (c_hashtable); if (result_hashtable) weechat_hashtable_free (result_hashtable); - return result_hash; + return result_alist; } /* @@ -5021,6 +5026,29 @@ weechat_guile_api_hdata_time (SCM hdata, SCM pointer, SCM name) } /* + * weechat_guile_api_hdata_hashtable: get hashtable value of a variable in + * structure using hdata + */ + +SCM +weechat_guile_api_hdata_hashtable (SCM hdata, SCM pointer, SCM name) +{ + SCM result_alist; + + API_FUNC(1, "hdata_hashtable", API_RETURN_EMPTY); + if (!scm_is_string (hdata) || !scm_is_string (pointer) + || !scm_is_string (name)) + API_WRONG_ARGS(API_RETURN_EMPTY); + + result_alist = weechat_guile_hashtable_to_alist ( + weechat_hdata_hashtable (script_str2ptr (scm_i_string_chars (hdata)), + script_str2ptr (scm_i_string_chars (pointer)), + scm_i_string_chars (name))); + + return result_alist; +} + +/* * weechat_guile_api_hdata_get_string: get hdata property as string */ @@ -5196,294 +5224,186 @@ weechat_guile_api_module_init (void *data) scm_set_current_error_port (guile_port); /* interface functions */ - scm_c_define_gsubr ("weechat:register", 7, 0, 0, &weechat_guile_api_register); - scm_c_define_gsubr ("weechat:plugin_get_name", 1, 0, 0, &weechat_guile_api_plugin_get_name); - scm_c_define_gsubr ("weechat:charset_set", 1, 0, 0, &weechat_guile_api_charset_set); - scm_c_define_gsubr ("weechat:iconv_to_internal", 2, 0, 0, &weechat_guile_api_iconv_to_internal); - scm_c_define_gsubr ("weechat:iconv_from_internal", 2, 0, 0, &weechat_guile_api_iconv_from_internal); - scm_c_define_gsubr ("weechat:gettext", 1, 0, 0, &weechat_guile_api_gettext); - scm_c_define_gsubr ("weechat:ngettext", 3, 0, 0, &weechat_guile_api_ngettext); - scm_c_define_gsubr ("weechat:string_match", 3, 0, 0, &weechat_guile_api_string_match); - scm_c_define_gsubr ("weechat:string_has_highlight", 2, 0, 0, &weechat_guile_api_string_has_highlight); - scm_c_define_gsubr ("weechat:string_has_highlight_regex", 2, 0, 0, &weechat_guile_api_string_has_highlight_regex); - scm_c_define_gsubr ("weechat:string_mask_to_regex", 1, 0, 0, &weechat_guile_api_string_mask_to_regex); - scm_c_define_gsubr ("weechat:string_remove_color", 2, 0, 0, &weechat_guile_api_string_remove_color); - scm_c_define_gsubr ("weechat:string_is_command_char", 1, 0, 0, &weechat_guile_api_string_is_command_char); - scm_c_define_gsubr ("weechat:string_input_for_buffer", 1, 0, 0, &weechat_guile_api_string_input_for_buffer); - scm_c_define_gsubr ("weechat:mkdir_home", 2, 0, 0, &weechat_guile_api_mkdir_home); - scm_c_define_gsubr ("weechat:mkdir", 2, 0, 0, &weechat_guile_api_mkdir); - scm_c_define_gsubr ("weechat:mkdir_parents", 2, 0, 0, &weechat_guile_api_mkdir_parents); - scm_c_define_gsubr ("weechat:list_new", 0, 0, 0, &weechat_guile_api_list_new); - scm_c_define_gsubr ("weechat:list_add", 4, 0, 0, &weechat_guile_api_list_add); - scm_c_define_gsubr ("weechat:list_search", 2, 0, 0, &weechat_guile_api_list_search); - scm_c_define_gsubr ("weechat:list_search_pos", 2, 0, 0, &weechat_guile_api_list_search_pos); - scm_c_define_gsubr ("weechat:list_casesearch", 2, 0, 0, &weechat_guile_api_list_casesearch); - scm_c_define_gsubr ("weechat:list_casesearch_pos", 2, 0, 0, &weechat_guile_api_list_casesearch_pos); - scm_c_define_gsubr ("weechat:list_get", 2, 0, 0, &weechat_guile_api_list_get); - scm_c_define_gsubr ("weechat:list_set", 2, 0, 0, &weechat_guile_api_list_set); - scm_c_define_gsubr ("weechat:list_next", 1, 0, 0, &weechat_guile_api_list_next); - scm_c_define_gsubr ("weechat:list_prev", 1, 0, 0, &weechat_guile_api_list_prev); - scm_c_define_gsubr ("weechat:list_string", 1, 0, 0, &weechat_guile_api_list_string); - scm_c_define_gsubr ("weechat:list_size", 1, 0, 0, &weechat_guile_api_list_size); - scm_c_define_gsubr ("weechat:list_remove", 2, 0, 0, &weechat_guile_api_list_remove); - scm_c_define_gsubr ("weechat:list_remove_all", 1, 0, 0, &weechat_guile_api_list_remove_all); - scm_c_define_gsubr ("weechat:list_free", 1, 0, 0, &weechat_guile_api_list_free); - scm_c_define_gsubr ("weechat:config_new", 3, 0, 0, &weechat_guile_api_config_new); - scm_c_define_gsubr ("weechat:config_new_section", 1, 0, 0, &weechat_guile_api_config_new_section); - scm_c_define_gsubr ("weechat:config_search_section", 2, 0, 0, &weechat_guile_api_config_search_section); - scm_c_define_gsubr ("weechat:config_new_option", 1, 0, 0, &weechat_guile_api_config_new_option); - scm_c_define_gsubr ("weechat:config_search_option", 3, 0, 0, &weechat_guile_api_config_search_option); - scm_c_define_gsubr ("weechat:config_string_to_boolean", 1, 0, 0, &weechat_guile_api_config_string_to_boolean); - scm_c_define_gsubr ("weechat:config_option_reset", 2, 0, 0, &weechat_guile_api_config_option_reset); - scm_c_define_gsubr ("weechat:config_option_set", 3, 0, 0, &weechat_guile_api_config_option_set); - scm_c_define_gsubr ("weechat:config_option_set_null", 2, 0, 0, &weechat_guile_api_config_option_set_null); - scm_c_define_gsubr ("weechat:config_option_unset", 1, 0, 0, &weechat_guile_api_config_option_unset); - scm_c_define_gsubr ("weechat:config_option_rename", 2, 0, 0, &weechat_guile_api_config_option_rename); - scm_c_define_gsubr ("weechat:config_option_is_null", 1, 0, 0, &weechat_guile_api_config_option_is_null); - scm_c_define_gsubr ("weechat:config_option_default_is_null", 1, 0, 0, &weechat_guile_api_config_option_default_is_null); - scm_c_define_gsubr ("weechat:config_boolean", 1, 0, 0, &weechat_guile_api_config_boolean); - scm_c_define_gsubr ("weechat:config_boolean_default", 1, 0, 0, &weechat_guile_api_config_boolean_default); - scm_c_define_gsubr ("weechat:config_integer", 1, 0, 0, &weechat_guile_api_config_integer); - scm_c_define_gsubr ("weechat:config_integer_default", 1, 0, 0, &weechat_guile_api_config_integer_default); - scm_c_define_gsubr ("weechat:config_string", 1, 0, 0, &weechat_guile_api_config_string); - scm_c_define_gsubr ("weechat:config_string_default", 1, 0, 0, &weechat_guile_api_config_string_default); - scm_c_define_gsubr ("weechat:config_color", 1, 0, 0, &weechat_guile_api_config_color); - scm_c_define_gsubr ("weechat:config_color_default", 1, 0, 0, &weechat_guile_api_config_color_default); - scm_c_define_gsubr ("weechat:config_write_option", 2, 0, 0, &weechat_guile_api_config_write_option); - scm_c_define_gsubr ("weechat:config_write_line", 3, 0, 0, &weechat_guile_api_config_write_line); - scm_c_define_gsubr ("weechat:config_write", 1, 0, 0, &weechat_guile_api_config_write); - scm_c_define_gsubr ("weechat:config_read", 1, 0, 0, &weechat_guile_api_config_read); - scm_c_define_gsubr ("weechat:config_reload", 1, 0, 0, &weechat_guile_api_config_reload); - scm_c_define_gsubr ("weechat:config_option_free", 1, 0, 0, &weechat_guile_api_config_option_free); - scm_c_define_gsubr ("weechat:config_section_free_options", 1, 0, 0, &weechat_guile_api_config_section_free_options); - scm_c_define_gsubr ("weechat:config_section_free", 1, 0, 0, &weechat_guile_api_config_section_free); - scm_c_define_gsubr ("weechat:config_free", 1, 0, 0, &weechat_guile_api_config_free); - scm_c_define_gsubr ("weechat:config_get", 1, 0, 0, &weechat_guile_api_config_get); - scm_c_define_gsubr ("weechat:config_get_plugin", 1, 0, 0, &weechat_guile_api_config_get_plugin); - scm_c_define_gsubr ("weechat:config_is_set_plugin", 1, 0, 0, &weechat_guile_api_config_is_set_plugin); - scm_c_define_gsubr ("weechat:config_set_plugin", 2, 0, 0, &weechat_guile_api_config_set_plugin); - scm_c_define_gsubr ("weechat:config_set_desc_plugin", 2, 0, 0, &weechat_guile_api_config_set_desc_plugin); - scm_c_define_gsubr ("weechat:config_unset_plugin", 1, 0, 0, &weechat_guile_api_config_unset_plugin); - scm_c_define_gsubr ("weechat:key_bind", 2, 0, 0, &weechat_guile_api_key_bind); - scm_c_define_gsubr ("weechat:key_unbind", 2, 0, 0, &weechat_guile_api_key_unbind); - scm_c_define_gsubr ("weechat:prefix", 1, 0, 0, &weechat_guile_api_prefix); - scm_c_define_gsubr ("weechat:color", 1, 0, 0, &weechat_guile_api_color); - scm_c_define_gsubr ("weechat:print", 2, 0, 0, &weechat_guile_api_print); - scm_c_define_gsubr ("weechat:print_date_tags", 4, 0, 0, &weechat_guile_api_print_date_tags); - scm_c_define_gsubr ("weechat:print_y", 3, 0, 0, &weechat_guile_api_print_y); - scm_c_define_gsubr ("weechat:log_print", 1, 0, 0, &weechat_guile_api_log_print); - scm_c_define_gsubr ("weechat:hook_command", 7, 0, 0, &weechat_guile_api_hook_command); - scm_c_define_gsubr ("weechat:hook_command_run", 3, 0, 0, &weechat_guile_api_hook_command_run); - scm_c_define_gsubr ("weechat:hook_timer", 5, 0, 0, &weechat_guile_api_hook_timer); - scm_c_define_gsubr ("weechat:hook_fd", 6, 0, 0, &weechat_guile_api_hook_fd); - scm_c_define_gsubr ("weechat:hook_process", 4, 0, 0, &weechat_guile_api_hook_process); - scm_c_define_gsubr ("weechat:hook_connect", 8, 0, 0, &weechat_guile_api_hook_connect); - scm_c_define_gsubr ("weechat:hook_print", 6, 0, 0, &weechat_guile_api_hook_print); - scm_c_define_gsubr ("weechat:hook_signal", 3, 0, 0, &weechat_guile_api_hook_signal); - scm_c_define_gsubr ("weechat:hook_signal_send", 3, 0, 0, &weechat_guile_api_hook_signal_send); - scm_c_define_gsubr ("weechat:hook_hsignal", 3, 0, 0, &weechat_guile_api_hook_hsignal); - scm_c_define_gsubr ("weechat:hook_hsignal_send", 2, 0, 0, &weechat_guile_api_hook_hsignal_send); - scm_c_define_gsubr ("weechat:hook_config", 3, 0, 0, &weechat_guile_api_hook_config); - scm_c_define_gsubr ("weechat:hook_completion", 4, 0, 0, &weechat_guile_api_hook_completion); - scm_c_define_gsubr ("weechat:hook_completion_list_add", 4, 0, 0, &weechat_guile_api_hook_completion_list_add); - scm_c_define_gsubr ("weechat:hook_modifier", 3, 0, 0, &weechat_guile_api_hook_modifier); - scm_c_define_gsubr ("weechat:hook_modifier_exec", 3, 0, 0, &weechat_guile_api_hook_modifier_exec); - scm_c_define_gsubr ("weechat:hook_info", 5, 0, 0, &weechat_guile_api_hook_info); - scm_c_define_gsubr ("weechat:hook_info_hashtable", 6, 0, 0, &weechat_guile_api_hook_info_hashtable); - scm_c_define_gsubr ("weechat:hook_infolist", 6, 0, 0, &weechat_guile_api_hook_infolist); - scm_c_define_gsubr ("weechat:hook_focus", 3, 0, 0, &weechat_guile_api_hook_focus); - scm_c_define_gsubr ("weechat:unhook", 1, 0, 0, &weechat_guile_api_unhook); - scm_c_define_gsubr ("weechat:unhook_all", 0, 0, 0, &weechat_guile_api_unhook_all); - scm_c_define_gsubr ("weechat:buffer_new", 5, 0, 0, &weechat_guile_api_buffer_new); - scm_c_define_gsubr ("weechat:buffer_search", 2, 0, 0, &weechat_guile_api_buffer_search); - scm_c_define_gsubr ("weechat:buffer_search_main", 0, 0, 0, &weechat_guile_api_buffer_search_main); - scm_c_define_gsubr ("weechat:current_buffer", 0, 0, 0, &weechat_guile_api_current_buffer); - scm_c_define_gsubr ("weechat:buffer_clear", 1, 0, 0, &weechat_guile_api_buffer_clear); - scm_c_define_gsubr ("weechat:buffer_close", 1, 0, 0, &weechat_guile_api_buffer_close); - scm_c_define_gsubr ("weechat:buffer_merge", 2, 0, 0, &weechat_guile_api_buffer_merge); - scm_c_define_gsubr ("weechat:buffer_unmerge", 2, 0, 0, &weechat_guile_api_buffer_unmerge); - scm_c_define_gsubr ("weechat:buffer_get_integer", 2, 0, 0, &weechat_guile_api_buffer_get_integer); - scm_c_define_gsubr ("weechat:buffer_get_string", 2, 0, 0, &weechat_guile_api_buffer_get_string); - scm_c_define_gsubr ("weechat:buffer_get_pointer", 2, 0, 0, &weechat_guile_api_buffer_get_pointer); - scm_c_define_gsubr ("weechat:buffer_set", 3, 0, 0, &weechat_guile_api_buffer_set); - scm_c_define_gsubr ("weechat:buffer_string_replace_local_var", 2, 0, 0, &weechat_guile_api_buffer_string_replace_local_var); - scm_c_define_gsubr ("weechat:buffer_match_list", 2, 0, 0, &weechat_guile_api_buffer_match_list); - scm_c_define_gsubr ("weechat:current_window", 0, 0, 0, &weechat_guile_api_current_window); - scm_c_define_gsubr ("weechat:window_search_with_buffer", 1, 0, 0, &weechat_guile_api_window_search_with_buffer); - scm_c_define_gsubr ("weechat:window_get_integer", 2, 0, 0, &weechat_guile_api_window_get_integer); - scm_c_define_gsubr ("weechat:window_get_string", 2, 0, 0, &weechat_guile_api_window_get_string); - scm_c_define_gsubr ("weechat:window_get_pointer", 2, 0, 0, &weechat_guile_api_window_get_pointer); - scm_c_define_gsubr ("weechat:window_set_title", 1, 0, 0, &weechat_guile_api_window_set_title); - scm_c_define_gsubr ("weechat:nicklist_add_group", 5, 0, 0, &weechat_guile_api_nicklist_add_group); - scm_c_define_gsubr ("weechat:nicklist_search_group", 3, 0, 0, &weechat_guile_api_nicklist_search_group); - scm_c_define_gsubr ("weechat:nicklist_add_nick", 7, 0, 0, &weechat_guile_api_nicklist_add_nick); - scm_c_define_gsubr ("weechat:nicklist_search_nick", 3, 0, 0, &weechat_guile_api_nicklist_search_nick); - scm_c_define_gsubr ("weechat:nicklist_remove_group", 2, 0, 0, &weechat_guile_api_nicklist_remove_group); - scm_c_define_gsubr ("weechat:nicklist_remove_nick", 2, 0, 0, &weechat_guile_api_nicklist_remove_nick); - scm_c_define_gsubr ("weechat:nicklist_remove_all", 1, 0, 0, &weechat_guile_api_nicklist_remove_all); - scm_c_define_gsubr ("weechat:nicklist_group_get_integer", 3, 0, 0, &weechat_guile_api_nicklist_group_get_integer); - scm_c_define_gsubr ("weechat:nicklist_group_get_string", 3, 0, 0, &weechat_guile_api_nicklist_group_get_string); - scm_c_define_gsubr ("weechat:nicklist_group_get_pointer", 3, 0, 0, &weechat_guile_api_nicklist_group_get_pointer); - scm_c_define_gsubr ("weechat:nicklist_group_set", 4, 0, 0, &weechat_guile_api_nicklist_group_set); - scm_c_define_gsubr ("weechat:nicklist_nick_get_integer", 3, 0, 0, &weechat_guile_api_nicklist_nick_get_integer); - scm_c_define_gsubr ("weechat:nicklist_nick_get_string", 3, 0, 0, &weechat_guile_api_nicklist_nick_get_string); - scm_c_define_gsubr ("weechat:nicklist_nick_get_pointer", 3, 0, 0, &weechat_guile_api_nicklist_nick_get_pointer); - scm_c_define_gsubr ("weechat:nicklist_nick_set", 4, 0, 0, &weechat_guile_api_nicklist_nick_set); - scm_c_define_gsubr ("weechat:bar_item_search", 1, 0, 0, &weechat_guile_api_bar_item_search); - scm_c_define_gsubr ("weechat:bar_item_new", 3, 0, 0, &weechat_guile_api_bar_item_new); - scm_c_define_gsubr ("weechat:bar_item_update", 1, 0, 0, &weechat_guile_api_bar_item_update); - scm_c_define_gsubr ("weechat:bar_item_remove", 1, 0, 0, &weechat_guile_api_bar_item_remove); - scm_c_define_gsubr ("weechat:bar_search", 1, 0, 0, &weechat_guile_api_bar_search); - scm_c_define_gsubr ("weechat:bar_new", 1, 0, 0, &weechat_guile_api_bar_new); - scm_c_define_gsubr ("weechat:bar_set", 3, 0, 0, &weechat_guile_api_bar_set); - scm_c_define_gsubr ("weechat:bar_update", 1, 0, 0, &weechat_guile_api_bar_update); - scm_c_define_gsubr ("weechat:bar_remove", 1, 0, 0, &weechat_guile_api_bar_remove); - scm_c_define_gsubr ("weechat:command", 2, 0, 0, &weechat_guile_api_command); - scm_c_define_gsubr ("weechat:info_get", 2, 0, 0, &weechat_guile_api_info_get); - scm_c_define_gsubr ("weechat:info_get_hashtable", 2, 0, 0, &weechat_guile_api_info_get_hashtable); - scm_c_define_gsubr ("weechat:infolist_new", 0, 0, 0, &weechat_guile_api_infolist_new); - scm_c_define_gsubr ("weechat:infolist_new_item", 1, 0, 0, &weechat_guile_api_infolist_new_item); - scm_c_define_gsubr ("weechat:infolist_new_var_integer", 3, 0, 0, &weechat_guile_api_infolist_new_var_integer); - scm_c_define_gsubr ("weechat:infolist_new_var_string", 3, 0, 0, &weechat_guile_api_infolist_new_var_string); - scm_c_define_gsubr ("weechat:infolist_new_var_pointer", 3, 0, 0, &weechat_guile_api_infolist_new_var_pointer); - scm_c_define_gsubr ("weechat:infolist_new_var_time", 3, 0, 0, &weechat_guile_api_infolist_new_var_time); - scm_c_define_gsubr ("weechat:infolist_get", 3, 0, 0, &weechat_guile_api_infolist_get); - scm_c_define_gsubr ("weechat:infolist_next", 1, 0, 0, &weechat_guile_api_infolist_next); - scm_c_define_gsubr ("weechat:infolist_prev", 1, 0, 0, &weechat_guile_api_infolist_prev); - scm_c_define_gsubr ("weechat:infolist_reset_item_cursor", 1, 0, 0, &weechat_guile_api_infolist_reset_item_cursor); - scm_c_define_gsubr ("weechat:infolist_fields", 1, 0, 0, &weechat_guile_api_infolist_fields); - scm_c_define_gsubr ("weechat:infolist_integer", 2, 0, 0, &weechat_guile_api_infolist_integer); - scm_c_define_gsubr ("weechat:infolist_string", 2, 0, 0, &weechat_guile_api_infolist_string); - scm_c_define_gsubr ("weechat:infolist_pointer", 2, 0, 0, &weechat_guile_api_infolist_pointer); - scm_c_define_gsubr ("weechat:infolist_time", 2, 0, 0, &weechat_guile_api_infolist_time); - scm_c_define_gsubr ("weechat:infolist_free", 1, 0, 0, &weechat_guile_api_infolist_free); - scm_c_define_gsubr ("weechat:hdata_get", 1, 0, 0, &weechat_guile_api_hdata_get); - scm_c_define_gsubr ("weechat:hdata_get_var_offset", 2, 0, 0, &weechat_guile_api_hdata_get_var_offset); - scm_c_define_gsubr ("weechat:hdata_get_var_type_string", 2, 0, 0, &weechat_guile_api_hdata_get_var_type_string); - scm_c_define_gsubr ("weechat:hdata_get_var_hdata", 2, 0, 0, &weechat_guile_api_hdata_get_var_hdata); - scm_c_define_gsubr ("weechat:hdata_get_list", 2, 0, 0, &weechat_guile_api_hdata_get_list); - scm_c_define_gsubr ("weechat:hdata_check_pointer", 3, 0, 0, &weechat_guile_api_hdata_check_pointer); - scm_c_define_gsubr ("weechat:hdata_move", 3, 0, 0, &weechat_guile_api_hdata_move); - scm_c_define_gsubr ("weechat:hdata_char", 3, 0, 0, &weechat_guile_api_hdata_char); - scm_c_define_gsubr ("weechat:hdata_integer", 3, 0, 0, &weechat_guile_api_hdata_integer); - scm_c_define_gsubr ("weechat:hdata_long", 3, 0, 0, &weechat_guile_api_hdata_long); - scm_c_define_gsubr ("weechat:hdata_string", 3, 0, 0, &weechat_guile_api_hdata_string); - scm_c_define_gsubr ("weechat:hdata_pointer", 3, 0, 0, &weechat_guile_api_hdata_pointer); - scm_c_define_gsubr ("weechat:hdata_time", 3, 0, 0, &weechat_guile_api_hdata_time); - scm_c_define_gsubr ("weechat:hdata_get_string", 2, 0, 0, &weechat_guile_api_hdata_get_string); - scm_c_define_gsubr ("weechat:upgrade_new", 2, 0, 0, &weechat_guile_api_upgrade_new); - scm_c_define_gsubr ("weechat:upgrade_write_object", 3, 0, 0, &weechat_guile_api_upgrade_write_object); - scm_c_define_gsubr ("weechat:upgrade_read", 3, 0, 0, &weechat_guile_api_upgrade_read); - scm_c_define_gsubr ("weechat:upgrade_close", 1, 0, 0, &weechat_guile_api_upgrade_close); - - scm_c_export ("weechat:register", "weechat:plugin_get_name", - "weechat:charset_set", "weechat:iconv_to_internal", - "weechat:iconv_from_internal", "weechat:gettext", - "weechat:ngettext", "weechat:string_match", - "weechat:string_has_highlight", "weechat:string_has_highlight_regex", - "weechat:string_mask_to_regex", "weechat:string_remove_color", - "weechat:string_is_command_char", "weechat:string_input_for_buffer", - NULL); - scm_c_export ("weechat:mkdir_home", "weechat:mkdir", - "weechat:mkdir_parents", - NULL); - scm_c_export ("weechat:list_new", "weechat:list_add", - "weechat:list_search", "weechat:list_search_pos", - "weechat:list_casesearch", "weechat:list_casesearch_pos", - "weechat:list_get", "weechat:list_set", - "weechat:list_next", "weechat:list_prev", - "weechat:list_string", "weechat:list_size", - "weechat:list_remove", "weechat:list_remove_all", - "weechat:list_free", - NULL); - scm_c_export ("weechat:config_new", "weechat:config_new_section", - "weechat:config_search_section", "weechat:config_new_option", - "weechat:config_search_option", "weechat:config_string_to_boolean", - "weechat:config_option_reset", "weechat:config_option_set", - "weechat:config_option_set_null", "weechat:config_option_unset", - "weechat:config_option_rename", "weechat:config_option_is_null", - "weechat:config_option_default_is_null", "weechat:config_boolean", - "weechat:config_boolean_default", "weechat:config_integer", - "weechat:config_integer_default", "weechat:config_string", - "weechat:config_string_default", "weechat:config_color", - "weechat:config_color_default", "weechat:config_write_option", - "weechat:config_write_line", "weechat:config_write", - "weechat:config_read", "weechat:config_reload", - "weechat:config_option_free", "weechat:config_section_free_options", - "weechat:config_section_free", "weechat:config_free", - "weechat:config_get", "weechat:config_get_plugin", - "weechat:config_is_set_plugin", "weechat:config_set_plugin", - "weechat:config_set_desc_plugin", "weechat:config_unset_plugin", - NULL); - scm_c_export ("weechat:key_bind", "weechat:key_unbind", - NULL); - scm_c_export ("weechat:prefix", "weechat:color", - "weechat:print", "weechat:print_date_tags", - "weechat:print_y", "weechat:log_print", - NULL); - scm_c_export ("weechat:hook_command", "weechat:hook_command_run", - "weechat:hook_timer", "weechat:hook_fd", - "weechat:hook_process", "weechat:hook_connect", - "weechat:hook_print", "weechat:hook_signal", - "weechat:hook_signal_send", "weechat:hook_hsignal", - "weechat:hook_hsignal_send", "weechat:hook_config", - "weechat:hook_completion", "weechat:hook_completion_list_add", - "weechat:hook_modifier", "weechat:hook_modifier_exec", - "weechat:hook_info", "weechat:hook_info_hashtable", - "weechat:hook_infolist", "weechat:hook_focus", - "weechat:unhook", "weechat:unhook_all", - NULL); - scm_c_export ("weechat:buffer_new", "weechat:buffer_search", - "weechat:buffer_search_main", "weechat:current_buffer", - "weechat:buffer_clear", "weechat:buffer_close", - "weechat:buffer_merge", "weechat:buffer_unmerge", - "weechat:buffer_get_integer", "weechat:buffer_get_string", - "weechat:buffer_get_pointer", "weechat:buffer_set", - "weechat:buffer_string_replace_local_var", "weechat:buffer_match_list", - NULL); - scm_c_export ("weechat:current_window", "weechat:window_search_with_buffer", - "weechat:window_get_integer", "weechat:window_get_string", - "weechat:window_get_pointer", "weechat:window_set_title", - NULL); - scm_c_export ("weechat:nicklist_add_group", "weechat:nicklist_search_group", - "weechat:nicklist_add_nick", "weechat:nicklist_search_nick", - "weechat:nicklist_remove_group", "weechat:nicklist_remove_nick", - "weechat:nicklist_remove_all", "weechat:nicklist_group_get_integer", - "weechat:nicklist_group_get_string", "weechat:nicklist_group_get_pointer", - "weechat:nicklist_group_set", "weechat:nicklist_nick_get_integer", - "weechat:nicklist_nick_get_string", "weechat:nicklist_nick_get_pointer", - "weechat:nicklist_nick_set", - NULL); - scm_c_export ("weechat:bar_item_search", "weechat:bar_item_new", - "weechat:bar_item_update", "weechat:bar_item_remove", - "weechat:bar_search", "weechat:bar_new", - "weechat:bar_set", "weechat:bar_update", - "weechat:bar_remove", - NULL); - scm_c_export ("weechat:command", - NULL); - scm_c_export ("weechat:info_get", "weechat:info_get_hashtable", - NULL); - scm_c_export ("weechat:infolist_new", "weechat:infolist_new_item", - "weechat:infolist_new_var_integer", "weechat:infolist_new_var_string", - "weechat:infolist_new_var_pointer", "weechat:infolist_new_var_time", - "weechat:infolist_get", "weechat:infolist_next", - "weechat:infolist_prev", "weechat:infolist_reset_item_cursor", - "weechat:infolist_fields", "weechat:infolist_integer", - "weechat:infolist_string", "weechat:infolist_pointer", - "weechat:infolist_time", "weechat:infolist_free", - NULL); - scm_c_export ("weechat:hdata_get", "weechat:hdata_get_var_offset", - "weechat:hdata_get_var_type_string", "weechat:hdata_get_var_hdata", - "weechat:hdata_get_list", "weechat:hdata_check_pointer", - "weechat:hdata_move", "weechat:hdata_char", - "weechat:hdata_integer", "weechat:hdata_long", - "weechat:hdata_string", "weechat:hdata_pointer", - "weechat:hdata_time", "weechat:hdata_get_string", - NULL); - scm_c_export ("weechat:upgrade_new", "weechat:upgrade_write_object", - "weechat:upgrade_read", "weechat:upgrade_close", - NULL); + API_DEF_FUNC(register, 7); + API_DEF_FUNC(plugin_get_name, 1); + API_DEF_FUNC(charset_set, 1); + API_DEF_FUNC(iconv_to_internal, 2); + API_DEF_FUNC(iconv_from_internal, 2); + API_DEF_FUNC(gettext, 1); + API_DEF_FUNC(ngettext, 3); + API_DEF_FUNC(string_match, 3); + API_DEF_FUNC(string_has_highlight, 2); + API_DEF_FUNC(string_has_highlight_regex, 2); + API_DEF_FUNC(string_mask_to_regex, 1); + API_DEF_FUNC(string_remove_color, 2); + API_DEF_FUNC(string_is_command_char, 1); + API_DEF_FUNC(string_input_for_buffer, 1); + API_DEF_FUNC(mkdir_home, 2); + API_DEF_FUNC(mkdir, 2); + API_DEF_FUNC(mkdir_parents, 2); + API_DEF_FUNC(list_new, 0); + API_DEF_FUNC(list_add, 4); + API_DEF_FUNC(list_search, 2); + API_DEF_FUNC(list_search_pos, 2); + API_DEF_FUNC(list_casesearch, 2); + API_DEF_FUNC(list_casesearch_pos, 2); + API_DEF_FUNC(list_get, 2); + API_DEF_FUNC(list_set, 2); + API_DEF_FUNC(list_next, 1); + API_DEF_FUNC(list_prev, 1); + API_DEF_FUNC(list_string, 1); + API_DEF_FUNC(list_size, 1); + API_DEF_FUNC(list_remove, 2); + API_DEF_FUNC(list_remove_all, 1); + API_DEF_FUNC(list_free, 1); + API_DEF_FUNC(config_new, 3); + API_DEF_FUNC(config_new_section, 1); + API_DEF_FUNC(config_search_section, 2); + API_DEF_FUNC(config_new_option, 1); + API_DEF_FUNC(config_search_option, 3); + API_DEF_FUNC(config_string_to_boolean, 1); + API_DEF_FUNC(config_option_reset, 2); + API_DEF_FUNC(config_option_set, 3); + API_DEF_FUNC(config_option_set_null, 2); + API_DEF_FUNC(config_option_unset, 1); + API_DEF_FUNC(config_option_rename, 2); + API_DEF_FUNC(config_option_is_null, 1); + API_DEF_FUNC(config_option_default_is_null, 1); + API_DEF_FUNC(config_boolean, 1); + API_DEF_FUNC(config_boolean_default, 1); + API_DEF_FUNC(config_integer, 1); + API_DEF_FUNC(config_integer_default, 1); + API_DEF_FUNC(config_string, 1); + API_DEF_FUNC(config_string_default, 1); + API_DEF_FUNC(config_color, 1); + API_DEF_FUNC(config_color_default, 1); + API_DEF_FUNC(config_write_option, 2); + API_DEF_FUNC(config_write_line, 3); + API_DEF_FUNC(config_write, 1); + API_DEF_FUNC(config_read, 1); + API_DEF_FUNC(config_reload, 1); + API_DEF_FUNC(config_option_free, 1); + API_DEF_FUNC(config_section_free_options, 1); + API_DEF_FUNC(config_section_free, 1); + API_DEF_FUNC(config_free, 1); + API_DEF_FUNC(config_get, 1); + API_DEF_FUNC(config_get_plugin, 1); + API_DEF_FUNC(config_is_set_plugin, 1); + API_DEF_FUNC(config_set_plugin, 2); + API_DEF_FUNC(config_set_desc_plugin, 2); + API_DEF_FUNC(config_unset_plugin, 1); + API_DEF_FUNC(key_bind, 2); + API_DEF_FUNC(key_unbind, 2); + API_DEF_FUNC(prefix, 1); + API_DEF_FUNC(color, 1); + API_DEF_FUNC(print, 2); + API_DEF_FUNC(print_date_tags, 4); + API_DEF_FUNC(print_y, 3); + API_DEF_FUNC(log_print, 1); + API_DEF_FUNC(hook_command, 7); + API_DEF_FUNC(hook_command_run, 3); + API_DEF_FUNC(hook_timer, 5); + API_DEF_FUNC(hook_fd, 6); + API_DEF_FUNC(hook_process, 4); + API_DEF_FUNC(hook_connect, 8); + API_DEF_FUNC(hook_print, 6); + API_DEF_FUNC(hook_signal, 3); + API_DEF_FUNC(hook_signal_send, 3); + API_DEF_FUNC(hook_hsignal, 3); + API_DEF_FUNC(hook_hsignal_send, 2); + API_DEF_FUNC(hook_config, 3); + API_DEF_FUNC(hook_completion, 4); + API_DEF_FUNC(hook_completion_list_add, 4); + API_DEF_FUNC(hook_modifier, 3); + API_DEF_FUNC(hook_modifier_exec, 3); + API_DEF_FUNC(hook_info, 5); + API_DEF_FUNC(hook_info_hashtable, 6); + API_DEF_FUNC(hook_infolist, 6); + API_DEF_FUNC(hook_focus, 3); + API_DEF_FUNC(unhook, 1); + API_DEF_FUNC(unhook_all, 0); + API_DEF_FUNC(buffer_new, 5); + API_DEF_FUNC(buffer_search, 2); + API_DEF_FUNC(buffer_search_main, 0); + API_DEF_FUNC(current_buffer, 0); + API_DEF_FUNC(buffer_clear, 1); + API_DEF_FUNC(buffer_close, 1); + API_DEF_FUNC(buffer_merge, 2); + API_DEF_FUNC(buffer_unmerge, 2); + API_DEF_FUNC(buffer_get_integer, 2); + API_DEF_FUNC(buffer_get_string, 2); + API_DEF_FUNC(buffer_get_pointer, 2); + API_DEF_FUNC(buffer_set, 3); + API_DEF_FUNC(buffer_string_replace_local_var, 2); + API_DEF_FUNC(buffer_match_list, 2); + API_DEF_FUNC(current_window, 0); + API_DEF_FUNC(window_search_with_buffer, 1); + API_DEF_FUNC(window_get_integer, 2); + API_DEF_FUNC(window_get_string, 2); + API_DEF_FUNC(window_get_pointer, 2); + API_DEF_FUNC(window_set_title, 1); + API_DEF_FUNC(nicklist_add_group, 5); + API_DEF_FUNC(nicklist_search_group, 3); + API_DEF_FUNC(nicklist_add_nick, 7); + API_DEF_FUNC(nicklist_search_nick, 3); + API_DEF_FUNC(nicklist_remove_group, 2); + API_DEF_FUNC(nicklist_remove_nick, 2); + API_DEF_FUNC(nicklist_remove_all, 1); + API_DEF_FUNC(nicklist_group_get_integer, 3); + API_DEF_FUNC(nicklist_group_get_string, 3); + API_DEF_FUNC(nicklist_group_get_pointer, 3); + API_DEF_FUNC(nicklist_group_set, 4); + API_DEF_FUNC(nicklist_nick_get_integer, 3); + API_DEF_FUNC(nicklist_nick_get_string, 3); + API_DEF_FUNC(nicklist_nick_get_pointer, 3); + API_DEF_FUNC(nicklist_nick_set, 4); + API_DEF_FUNC(bar_item_search, 1); + API_DEF_FUNC(bar_item_new, 3); + API_DEF_FUNC(bar_item_update, 1); + API_DEF_FUNC(bar_item_remove, 1); + API_DEF_FUNC(bar_search, 1); + API_DEF_FUNC(bar_new, 1); + API_DEF_FUNC(bar_set, 3); + API_DEF_FUNC(bar_update, 1); + API_DEF_FUNC(bar_remove, 1); + API_DEF_FUNC(command, 2); + API_DEF_FUNC(info_get, 2); + API_DEF_FUNC(info_get_hashtable, 2); + API_DEF_FUNC(infolist_new, 0); + API_DEF_FUNC(infolist_new_item, 1); + API_DEF_FUNC(infolist_new_var_integer, 3); + API_DEF_FUNC(infolist_new_var_string, 3); + API_DEF_FUNC(infolist_new_var_pointer, 3); + API_DEF_FUNC(infolist_new_var_time, 3); + API_DEF_FUNC(infolist_get, 3); + API_DEF_FUNC(infolist_next, 1); + API_DEF_FUNC(infolist_prev, 1); + API_DEF_FUNC(infolist_reset_item_cursor, 1); + API_DEF_FUNC(infolist_fields, 1); + API_DEF_FUNC(infolist_integer, 2); + API_DEF_FUNC(infolist_string, 2); + API_DEF_FUNC(infolist_pointer, 2); + API_DEF_FUNC(infolist_time, 2); + API_DEF_FUNC(infolist_free, 1); + API_DEF_FUNC(hdata_get, 1); + API_DEF_FUNC(hdata_get_var_offset, 2); + API_DEF_FUNC(hdata_get_var_type_string, 2); + API_DEF_FUNC(hdata_get_var_hdata, 2); + API_DEF_FUNC(hdata_get_list, 2); + API_DEF_FUNC(hdata_check_pointer, 3); + API_DEF_FUNC(hdata_move, 3); + API_DEF_FUNC(hdata_char, 3); + API_DEF_FUNC(hdata_integer, 3); + API_DEF_FUNC(hdata_long, 3); + API_DEF_FUNC(hdata_string, 3); + API_DEF_FUNC(hdata_pointer, 3); + API_DEF_FUNC(hdata_time, 3); + API_DEF_FUNC(hdata_hashtable, 3); + API_DEF_FUNC(hdata_get_string, 2); + API_DEF_FUNC(upgrade_new, 2); + API_DEF_FUNC(upgrade_write_object, 3); + API_DEF_FUNC(upgrade_read, 3); + API_DEF_FUNC(upgrade_close, 1); /* interface constants */ scm_c_define ("weechat:WEECHAT_RC_OK", scm_from_int (WEECHAT_RC_OK)); diff --git a/src/plugins/scripts/guile/weechat-guile.c b/src/plugins/scripts/guile/weechat-guile.c index 0e80cb2fd..9323c0919 100644 --- a/src/plugins/scripts/guile/weechat-guile.c +++ b/src/plugins/scripts/guile/weechat-guile.c @@ -161,8 +161,8 @@ weechat_guile_exec_function (const char *function, SCM args) void weechat_guile_hashtable_map_cb (void *data, struct t_hashtable *hashtable, - const void *key, - const void *value) + const char *key, + const char *value) { SCM *alist, pair, list; @@ -171,8 +171,8 @@ weechat_guile_hashtable_map_cb (void *data, alist = (SCM *)data; - pair = scm_cons (scm_from_locale_string ((const char *)key), - scm_from_locale_string ((const char *)value)); + pair = scm_cons (scm_from_locale_string (key), + scm_from_locale_string (value)); list = scm_list_1 (pair); *alist = scm_append (scm_list_2 (*alist, list)); @@ -189,9 +189,9 @@ weechat_guile_hashtable_to_alist (struct t_hashtable *hashtable) alist = scm_list_n (SCM_UNDEFINED); - weechat_hashtable_map (hashtable, - &weechat_guile_hashtable_map_cb, - &alist); + weechat_hashtable_map_string (hashtable, + &weechat_guile_hashtable_map_cb, + &alist); return alist; } diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c index 1f59ba5b0..e9a3523e1 100644 --- a/src/plugins/scripts/lua/weechat-lua-api.c +++ b/src/plugins/scripts/lua/weechat-lua-api.c @@ -76,6 +76,9 @@ lua_pushnumber (lua_current_interpreter, __long); \ return 1; +#define API_DEF_FUNC(__name) \ + { #__name, &weechat_lua_api_##__name } + /* * weechat_lua_api_register: startup function for all WeeChat Lua scripts @@ -5543,6 +5546,32 @@ weechat_lua_api_hdata_time (lua_State *L) } /* + * weechat_lua_api_hdata_hashtable: get hashtable value of a variable in + * structure using hdata + */ + +static int +weechat_lua_api_hdata_hashtable (lua_State *L) +{ + const char *hdata, *pointer, *name; + + API_FUNC(1, "hdata_hashtable", API_RETURN_EMPTY); + if (lua_gettop (lua_current_interpreter) < 3) + API_WRONG_ARGS(API_RETURN_EMPTY); + + hdata = lua_tostring (lua_current_interpreter, -3); + pointer = lua_tostring (lua_current_interpreter, -2); + name = lua_tostring (lua_current_interpreter, -1); + + weechat_lua_pushhashtable (lua_current_interpreter, + weechat_hdata_hashtable (script_str2ptr (hdata), + script_str2ptr (pointer), + name)); + + return 1; +} + +/* * weechat_lua_api_hdata_get_string: get hdata property as string */ @@ -6097,185 +6126,186 @@ weechat_lua_api_constant_weechat_hook_signal_pointer (lua_State *L) */ const struct luaL_reg weechat_lua_api_funcs[] = { - { "register", &weechat_lua_api_register }, - { "plugin_get_name", &weechat_lua_api_plugin_get_name }, - { "charset_set", &weechat_lua_api_charset_set }, - { "iconv_to_internal", &weechat_lua_api_iconv_to_internal }, - { "iconv_from_internal", &weechat_lua_api_iconv_from_internal }, - { "gettext", &weechat_lua_api_gettext }, - { "ngettext", &weechat_lua_api_ngettext }, - { "string_match", &weechat_lua_api_string_match }, - { "string_has_highlight", &weechat_lua_api_string_has_highlight }, - { "string_has_highlight_regex", &weechat_lua_api_string_has_highlight_regex }, - { "string_mask_to_regex", &weechat_lua_api_string_mask_to_regex }, - { "string_remove_color", &weechat_lua_api_string_remove_color }, - { "string_is_command_char", &weechat_lua_api_string_is_command_char }, - { "string_input_for_buffer", &weechat_lua_api_string_input_for_buffer }, - { "mkdir_home", &weechat_lua_api_mkdir_home }, - { "mkdir", &weechat_lua_api_mkdir }, - { "mkdir_parents", &weechat_lua_api_mkdir_parents }, - { "list_new", &weechat_lua_api_list_new }, - { "list_add", &weechat_lua_api_list_add }, - { "list_search", &weechat_lua_api_list_search }, - { "list_search_pos", &weechat_lua_api_list_search_pos }, - { "list_casesearch", &weechat_lua_api_list_casesearch }, - { "list_casesearch_pos", &weechat_lua_api_list_casesearch_pos }, - { "list_get", &weechat_lua_api_list_get }, - { "list_set", &weechat_lua_api_list_set }, - { "list_next", &weechat_lua_api_list_next }, - { "list_prev", &weechat_lua_api_list_prev }, - { "list_string", &weechat_lua_api_list_string }, - { "list_size", &weechat_lua_api_list_size }, - { "list_remove", &weechat_lua_api_list_remove }, - { "list_remove_all", &weechat_lua_api_list_remove_all }, - { "list_free", &weechat_lua_api_list_free }, - { "config_new", &weechat_lua_api_config_new }, - { "config_new_section", &weechat_lua_api_config_new_section }, - { "config_search_section", &weechat_lua_api_config_search_section }, - { "config_new_option", &weechat_lua_api_config_new_option }, - { "config_search_option", &weechat_lua_api_config_search_option }, - { "config_string_to_boolean", &weechat_lua_api_config_string_to_boolean }, - { "config_option_reset", &weechat_lua_api_config_option_reset }, - { "config_option_set", &weechat_lua_api_config_option_set }, - { "config_option_set_null", &weechat_lua_api_config_option_set_null }, - { "config_option_unset", &weechat_lua_api_config_option_unset }, - { "config_option_rename", &weechat_lua_api_config_option_rename }, - { "config_option_is_null", &weechat_lua_api_config_option_is_null }, - { "config_option_default_is_null", &weechat_lua_api_config_option_default_is_null }, - { "config_boolean", &weechat_lua_api_config_boolean }, - { "config_boolean_default", &weechat_lua_api_config_boolean_default }, - { "config_integer", &weechat_lua_api_config_integer }, - { "config_integer_default", &weechat_lua_api_config_integer_default }, - { "config_string", &weechat_lua_api_config_string }, - { "config_string_default", &weechat_lua_api_config_string_default }, - { "config_color", &weechat_lua_api_config_color }, - { "config_color_default", &weechat_lua_api_config_color_default }, - { "config_write_option", &weechat_lua_api_config_write_option }, - { "config_write_line", &weechat_lua_api_config_write_line }, - { "config_write", &weechat_lua_api_config_write }, - { "config_read", &weechat_lua_api_config_read }, - { "config_reload", &weechat_lua_api_config_reload }, - { "config_option_free", &weechat_lua_api_config_option_free }, - { "config_section_free_options", &weechat_lua_api_config_section_free_options }, - { "config_section_free", &weechat_lua_api_config_section_free }, - { "config_free", &weechat_lua_api_config_free }, - { "config_get", &weechat_lua_api_config_get }, - { "config_get_plugin", &weechat_lua_api_config_get_plugin }, - { "config_is_set_plugin", &weechat_lua_api_config_is_set_plugin }, - { "config_set_plugin", &weechat_lua_api_config_set_plugin }, - { "config_set_desc_plugin", &weechat_lua_api_config_set_desc_plugin }, - { "config_unset_plugin", &weechat_lua_api_config_unset_plugin }, - { "key_bind", &weechat_lua_api_key_bind }, - { "key_unbind", &weechat_lua_api_key_unbind }, - { "prefix", &weechat_lua_api_prefix }, - { "color", &weechat_lua_api_color }, - { "print", &weechat_lua_api_print }, - { "print_date_tags", &weechat_lua_api_print_date_tags }, - { "print_y", &weechat_lua_api_print_y }, - { "log_print", &weechat_lua_api_log_print }, - { "hook_command", &weechat_lua_api_hook_command }, - { "hook_command_run", &weechat_lua_api_hook_command_run }, - { "hook_timer", &weechat_lua_api_hook_timer }, - { "hook_fd", &weechat_lua_api_hook_fd }, - { "hook_process", &weechat_lua_api_hook_process }, - { "hook_connect", &weechat_lua_api_hook_connect }, - { "hook_print", &weechat_lua_api_hook_print }, - { "hook_signal", &weechat_lua_api_hook_signal }, - { "hook_signal_send", &weechat_lua_api_hook_signal_send }, - { "hook_hsignal", &weechat_lua_api_hook_hsignal }, - { "hook_hsignal_send", &weechat_lua_api_hook_hsignal_send }, - { "hook_config", &weechat_lua_api_hook_config }, - { "hook_completion", &weechat_lua_api_hook_completion }, - { "hook_completion_list_add", &weechat_lua_api_hook_completion_list_add }, - { "hook_modifier", &weechat_lua_api_hook_modifier }, - { "hook_modifier_exec", &weechat_lua_api_hook_modifier_exec }, - { "hook_info", &weechat_lua_api_hook_info }, - { "hook_info_hashtable", &weechat_lua_api_hook_info_hashtable }, - { "hook_infolist", &weechat_lua_api_hook_infolist }, - { "hook_focus", &weechat_lua_api_hook_focus }, - { "unhook", &weechat_lua_api_unhook }, - { "unhook_all", &weechat_lua_api_unhook_all }, - { "buffer_new", &weechat_lua_api_buffer_new }, - { "buffer_search", &weechat_lua_api_buffer_search }, - { "buffer_search_main", &weechat_lua_api_buffer_search_main }, - { "current_buffer", &weechat_lua_api_current_buffer }, - { "buffer_clear", &weechat_lua_api_buffer_clear }, - { "buffer_close", &weechat_lua_api_buffer_close }, - { "buffer_merge", &weechat_lua_api_buffer_merge }, - { "buffer_unmerge", &weechat_lua_api_buffer_unmerge }, - { "buffer_get_integer", &weechat_lua_api_buffer_get_integer }, - { "buffer_get_string", &weechat_lua_api_buffer_get_string }, - { "buffer_get_pointer", &weechat_lua_api_buffer_get_pointer }, - { "buffer_set", &weechat_lua_api_buffer_set }, - { "buffer_string_replace_local_var", &weechat_lua_api_buffer_string_replace_local_var }, - { "buffer_match_list", &weechat_lua_api_buffer_match_list }, - { "current_window", &weechat_lua_api_current_window }, - { "window_search_with_buffer", &weechat_lua_api_window_search_with_buffer }, - { "window_get_integer", &weechat_lua_api_window_get_integer }, - { "window_get_string", &weechat_lua_api_window_get_string }, - { "window_get_pointer", &weechat_lua_api_window_get_pointer }, - { "window_set_title", &weechat_lua_api_window_set_title }, - { "nicklist_add_group", &weechat_lua_api_nicklist_add_group }, - { "nicklist_search_group", &weechat_lua_api_nicklist_search_group }, - { "nicklist_add_nick", &weechat_lua_api_nicklist_add_nick }, - { "nicklist_search_nick", &weechat_lua_api_nicklist_search_nick }, - { "nicklist_remove_group", &weechat_lua_api_nicklist_remove_group }, - { "nicklist_remove_nick", &weechat_lua_api_nicklist_remove_nick }, - { "nicklist_remove_all", &weechat_lua_api_nicklist_remove_all }, - { "nicklist_group_get_integer", &weechat_lua_api_nicklist_group_get_integer }, - { "nicklist_group_get_string", &weechat_lua_api_nicklist_group_get_string }, - { "nicklist_group_get_pointer", &weechat_lua_api_nicklist_group_get_pointer }, - { "nicklist_group_set", &weechat_lua_api_nicklist_group_set }, - { "nicklist_nick_get_integer", &weechat_lua_api_nicklist_nick_get_integer }, - { "nicklist_nick_get_string", &weechat_lua_api_nicklist_nick_get_string }, - { "nicklist_nick_get_pointer", &weechat_lua_api_nicklist_nick_get_pointer }, - { "nicklist_nick_set", &weechat_lua_api_nicklist_nick_set }, - { "bar_item_search", &weechat_lua_api_bar_item_search }, - { "bar_item_new", &weechat_lua_api_bar_item_new }, - { "bar_item_update", &weechat_lua_api_bar_item_update }, - { "bar_item_remove", &weechat_lua_api_bar_item_remove }, - { "bar_search", &weechat_lua_api_bar_search }, - { "bar_new", &weechat_lua_api_bar_new }, - { "bar_set", &weechat_lua_api_bar_set }, - { "bar_update", &weechat_lua_api_bar_update }, - { "bar_remove", &weechat_lua_api_bar_remove }, - { "command", &weechat_lua_api_command }, - { "info_get", &weechat_lua_api_info_get }, - { "info_get_hashtable", &weechat_lua_api_info_get_hashtable }, - { "infolist_new", &weechat_lua_api_infolist_new }, - { "infolist_new_item", &weechat_lua_api_infolist_new_item }, - { "infolist_new_var_integer", &weechat_lua_api_infolist_new_var_integer }, - { "infolist_new_var_string", &weechat_lua_api_infolist_new_var_string }, - { "infolist_new_var_pointer", &weechat_lua_api_infolist_new_var_pointer }, - { "infolist_new_var_time", &weechat_lua_api_infolist_new_var_time }, - { "infolist_get", &weechat_lua_api_infolist_get }, - { "infolist_next", &weechat_lua_api_infolist_next }, - { "infolist_prev", &weechat_lua_api_infolist_prev }, - { "infolist_reset_item_cursor", &weechat_lua_api_infolist_reset_item_cursor }, - { "infolist_fields", &weechat_lua_api_infolist_fields }, - { "infolist_integer", &weechat_lua_api_infolist_integer }, - { "infolist_string", &weechat_lua_api_infolist_string }, - { "infolist_pointer", &weechat_lua_api_infolist_pointer }, - { "infolist_time", &weechat_lua_api_infolist_time }, - { "infolist_free", &weechat_lua_api_infolist_free }, - { "hdata_get", &weechat_lua_api_hdata_get }, - { "hdata_get_var_offset", &weechat_lua_api_hdata_get_var_offset }, - { "hdata_get_var_type_string", &weechat_lua_api_hdata_get_var_type_string }, - { "hdata_get_var_hdata", &weechat_lua_api_hdata_get_var_hdata }, - { "hdata_get_list", &weechat_lua_api_hdata_get_list }, - { "hdata_check_pointer", &weechat_lua_api_hdata_check_pointer }, - { "hdata_move", &weechat_lua_api_hdata_move }, - { "hdata_char", &weechat_lua_api_hdata_char }, - { "hdata_integer", &weechat_lua_api_hdata_integer }, - { "hdata_long", &weechat_lua_api_hdata_long }, - { "hdata_string", &weechat_lua_api_hdata_string }, - { "hdata_pointer", &weechat_lua_api_hdata_pointer }, - { "hdata_time", &weechat_lua_api_hdata_time }, - { "hdata_get_string", &weechat_lua_api_hdata_get_string }, - { "upgrade_new", &weechat_lua_api_upgrade_new }, - { "upgrade_write_object", &weechat_lua_api_upgrade_write_object }, - { "upgrade_read", &weechat_lua_api_upgrade_read }, - { "upgrade_close", &weechat_lua_api_upgrade_close }, + API_DEF_FUNC(register), + API_DEF_FUNC(plugin_get_name), + API_DEF_FUNC(charset_set), + API_DEF_FUNC(iconv_to_internal), + API_DEF_FUNC(iconv_from_internal), + API_DEF_FUNC(gettext), + API_DEF_FUNC(ngettext), + API_DEF_FUNC(string_match), + API_DEF_FUNC(string_has_highlight), + API_DEF_FUNC(string_has_highlight_regex), + API_DEF_FUNC(string_mask_to_regex), + API_DEF_FUNC(string_remove_color), + API_DEF_FUNC(string_is_command_char), + API_DEF_FUNC(string_input_for_buffer), + API_DEF_FUNC(mkdir_home), + API_DEF_FUNC(mkdir), + API_DEF_FUNC(mkdir_parents), + API_DEF_FUNC(list_new), + API_DEF_FUNC(list_add), + API_DEF_FUNC(list_search), + API_DEF_FUNC(list_search_pos), + API_DEF_FUNC(list_casesearch), + API_DEF_FUNC(list_casesearch_pos), + API_DEF_FUNC(list_get), + API_DEF_FUNC(list_set), + API_DEF_FUNC(list_next), + API_DEF_FUNC(list_prev), + API_DEF_FUNC(list_string), + API_DEF_FUNC(list_size), + API_DEF_FUNC(list_remove), + API_DEF_FUNC(list_remove_all), + API_DEF_FUNC(list_free), + API_DEF_FUNC(config_new), + API_DEF_FUNC(config_new_section), + API_DEF_FUNC(config_search_section), + API_DEF_FUNC(config_new_option), + API_DEF_FUNC(config_search_option), + API_DEF_FUNC(config_string_to_boolean), + API_DEF_FUNC(config_option_reset), + API_DEF_FUNC(config_option_set), + API_DEF_FUNC(config_option_set_null), + API_DEF_FUNC(config_option_unset), + API_DEF_FUNC(config_option_rename), + API_DEF_FUNC(config_option_is_null), + API_DEF_FUNC(config_option_default_is_null), + API_DEF_FUNC(config_boolean), + API_DEF_FUNC(config_boolean_default), + API_DEF_FUNC(config_integer), + API_DEF_FUNC(config_integer_default), + API_DEF_FUNC(config_string), + API_DEF_FUNC(config_string_default), + API_DEF_FUNC(config_color), + API_DEF_FUNC(config_color_default), + API_DEF_FUNC(config_write_option), + API_DEF_FUNC(config_write_line), + API_DEF_FUNC(config_write), + API_DEF_FUNC(config_read), + API_DEF_FUNC(config_reload), + API_DEF_FUNC(config_option_free), + API_DEF_FUNC(config_section_free_options), + API_DEF_FUNC(config_section_free), + API_DEF_FUNC(config_free), + API_DEF_FUNC(config_get), + API_DEF_FUNC(config_get_plugin), + API_DEF_FUNC(config_is_set_plugin), + API_DEF_FUNC(config_set_plugin), + API_DEF_FUNC(config_set_desc_plugin), + API_DEF_FUNC(config_unset_plugin), + API_DEF_FUNC(key_bind), + API_DEF_FUNC(key_unbind), + API_DEF_FUNC(prefix), + API_DEF_FUNC(color), + API_DEF_FUNC(print), + API_DEF_FUNC(print_date_tags), + API_DEF_FUNC(print_y), + API_DEF_FUNC(log_print), + API_DEF_FUNC(hook_command), + API_DEF_FUNC(hook_command_run), + API_DEF_FUNC(hook_timer), + API_DEF_FUNC(hook_fd), + API_DEF_FUNC(hook_process), + API_DEF_FUNC(hook_connect), + API_DEF_FUNC(hook_print), + API_DEF_FUNC(hook_signal), + API_DEF_FUNC(hook_signal_send), + API_DEF_FUNC(hook_hsignal), + API_DEF_FUNC(hook_hsignal_send), + API_DEF_FUNC(hook_config), + API_DEF_FUNC(hook_completion), + API_DEF_FUNC(hook_completion_list_add), + API_DEF_FUNC(hook_modifier), + API_DEF_FUNC(hook_modifier_exec), + API_DEF_FUNC(hook_info), + API_DEF_FUNC(hook_info_hashtable), + API_DEF_FUNC(hook_infolist), + API_DEF_FUNC(hook_focus), + API_DEF_FUNC(unhook), + API_DEF_FUNC(unhook_all), + API_DEF_FUNC(buffer_new), + API_DEF_FUNC(buffer_search), + API_DEF_FUNC(buffer_search_main), + API_DEF_FUNC(current_buffer), + API_DEF_FUNC(buffer_clear), + API_DEF_FUNC(buffer_close), + API_DEF_FUNC(buffer_merge), + API_DEF_FUNC(buffer_unmerge), + API_DEF_FUNC(buffer_get_integer), + API_DEF_FUNC(buffer_get_string), + API_DEF_FUNC(buffer_get_pointer), + API_DEF_FUNC(buffer_set), + API_DEF_FUNC(buffer_string_replace_local_var), + API_DEF_FUNC(buffer_match_list), + API_DEF_FUNC(current_window), + API_DEF_FUNC(window_search_with_buffer), + API_DEF_FUNC(window_get_integer), + API_DEF_FUNC(window_get_string), + API_DEF_FUNC(window_get_pointer), + API_DEF_FUNC(window_set_title), + API_DEF_FUNC(nicklist_add_group), + API_DEF_FUNC(nicklist_search_group), + API_DEF_FUNC(nicklist_add_nick), + API_DEF_FUNC(nicklist_search_nick), + API_DEF_FUNC(nicklist_remove_group), + API_DEF_FUNC(nicklist_remove_nick), + API_DEF_FUNC(nicklist_remove_all), + API_DEF_FUNC(nicklist_group_get_integer), + API_DEF_FUNC(nicklist_group_get_string), + API_DEF_FUNC(nicklist_group_get_pointer), + API_DEF_FUNC(nicklist_group_set), + API_DEF_FUNC(nicklist_nick_get_integer), + API_DEF_FUNC(nicklist_nick_get_string), + API_DEF_FUNC(nicklist_nick_get_pointer), + API_DEF_FUNC(nicklist_nick_set), + API_DEF_FUNC(bar_item_search), + API_DEF_FUNC(bar_item_new), + API_DEF_FUNC(bar_item_update), + API_DEF_FUNC(bar_item_remove), + API_DEF_FUNC(bar_search), + API_DEF_FUNC(bar_new), + API_DEF_FUNC(bar_set), + API_DEF_FUNC(bar_update), + API_DEF_FUNC(bar_remove), + API_DEF_FUNC(command), + API_DEF_FUNC(info_get), + API_DEF_FUNC(info_get_hashtable), + API_DEF_FUNC(infolist_new), + API_DEF_FUNC(infolist_new_item), + API_DEF_FUNC(infolist_new_var_integer), + API_DEF_FUNC(infolist_new_var_string), + API_DEF_FUNC(infolist_new_var_pointer), + API_DEF_FUNC(infolist_new_var_time), + API_DEF_FUNC(infolist_get), + API_DEF_FUNC(infolist_next), + API_DEF_FUNC(infolist_prev), + API_DEF_FUNC(infolist_reset_item_cursor), + API_DEF_FUNC(infolist_fields), + API_DEF_FUNC(infolist_integer), + API_DEF_FUNC(infolist_string), + API_DEF_FUNC(infolist_pointer), + API_DEF_FUNC(infolist_time), + API_DEF_FUNC(infolist_free), + API_DEF_FUNC(hdata_get), + API_DEF_FUNC(hdata_get_var_offset), + API_DEF_FUNC(hdata_get_var_type_string), + API_DEF_FUNC(hdata_get_var_hdata), + API_DEF_FUNC(hdata_get_list), + API_DEF_FUNC(hdata_check_pointer), + API_DEF_FUNC(hdata_move), + API_DEF_FUNC(hdata_char), + API_DEF_FUNC(hdata_integer), + API_DEF_FUNC(hdata_long), + API_DEF_FUNC(hdata_string), + API_DEF_FUNC(hdata_pointer), + API_DEF_FUNC(hdata_time), + API_DEF_FUNC(hdata_hashtable), + API_DEF_FUNC(hdata_get_string), + API_DEF_FUNC(upgrade_new), + API_DEF_FUNC(upgrade_write_object), + API_DEF_FUNC(upgrade_read), + API_DEF_FUNC(upgrade_close), /* define constants as function which returns values */ diff --git a/src/plugins/scripts/lua/weechat-lua.c b/src/plugins/scripts/lua/weechat-lua.c index 1179783f7..d7d8dec36 100644 --- a/src/plugins/scripts/lua/weechat-lua.c +++ b/src/plugins/scripts/lua/weechat-lua.c @@ -77,8 +77,8 @@ char *lua_action_remove_list = NULL; void weechat_lua_hashtable_map_cb (void *data, struct t_hashtable *hashtable, - const void *key, - const void *value) + const char *key, + const char *value) { lua_State *interpreter; @@ -87,8 +87,8 @@ weechat_lua_hashtable_map_cb (void *data, interpreter = (lua_State *)data; - lua_pushstring (interpreter, (char *)key); - lua_pushstring (interpreter, (char *)value); + lua_pushstring (interpreter, key); + lua_pushstring (interpreter, value); lua_rawset (interpreter, -3); } @@ -101,9 +101,9 @@ weechat_lua_pushhashtable (lua_State *interpreter, struct t_hashtable *hashtable { lua_newtable (interpreter); - weechat_hashtable_map (hashtable, - &weechat_lua_hashtable_map_cb, - interpreter); + weechat_hashtable_map_string (hashtable, + &weechat_lua_hashtable_map_cb, + interpreter); } /* diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c index ea9491389..24e80f541 100644 --- a/src/plugins/scripts/perl/weechat-perl-api.c +++ b/src/plugins/scripts/perl/weechat-perl-api.c @@ -83,6 +83,9 @@ if (SvREFCNT(ST(0))) sv_2mortal(ST(0)); \ XSRETURN (1); +#define API_DEF_FUNC(__name) \ + newXS ("weechat::" #__name, XS_weechat_api_##__name, "weechat"); + extern void boot_DynaLoader (pTHX_ CV* cv); @@ -5279,6 +5282,33 @@ XS (XS_weechat_api_hdata_time) } /* + * weechat::hdata_hashtable: get hashtable value of a variable in structure + * using hdata + */ + +XS (XS_weechat_api_hdata_hashtable) +{ + char *hdata, *pointer, *name; + HV *result_hash; + dXSARGS; + + API_FUNC(1, "hdata_hashtable", API_RETURN_EMPTY); + if (items < 3) + API_WRONG_ARGS(API_RETURN_EMPTY); + + hdata = SvPV_nolen (ST (0)); + pointer = SvPV_nolen (ST (1)); + name = SvPV_nolen (ST (2)); + + result_hash = weechat_perl_hashtable_to_hash ( + weechat_hdata_hashtable (script_str2ptr (hdata), + script_str2ptr (pointer), + name)); + + API_RETURN_OBJ(result_hash); +} + +/* * weechat::hdata_get_string: get hdata property as string */ @@ -5454,185 +5484,186 @@ weechat_perl_api_init (pTHX) newXS ("DynaLoader::boot_DynaLoader", boot_DynaLoader, __FILE__); /* interface functions */ - newXS ("weechat::register", XS_weechat_api_register, "weechat"); - newXS ("weechat::plugin_get_name", XS_weechat_api_plugin_get_name, "weechat"); - newXS ("weechat::charset_set", XS_weechat_api_charset_set, "weechat"); - newXS ("weechat::iconv_to_internal", XS_weechat_api_iconv_to_internal, "weechat"); - newXS ("weechat::iconv_from_internal", XS_weechat_api_iconv_from_internal, "weechat"); - newXS ("weechat::gettext", XS_weechat_api_gettext, "weechat"); - newXS ("weechat::ngettext", XS_weechat_api_ngettext, "weechat"); - newXS ("weechat::string_match", XS_weechat_api_string_match, "weechat"); - newXS ("weechat::string_has_highlight", XS_weechat_api_string_has_highlight, "weechat"); - newXS ("weechat::string_has_highlight_regex", XS_weechat_api_string_has_highlight_regex, "weechat"); - newXS ("weechat::string_mask_to_regex", XS_weechat_api_string_mask_to_regex, "weechat"); - newXS ("weechat::string_remove_color", XS_weechat_api_string_remove_color, "weechat"); - newXS ("weechat::string_is_command_char", XS_weechat_api_string_is_command_char, "weechat"); - newXS ("weechat::string_input_for_buffer", XS_weechat_api_string_input_for_buffer, "weechat"); - newXS ("weechat::mkdir_home", XS_weechat_api_mkdir_home, "weechat"); - newXS ("weechat::mkdir", XS_weechat_api_mkdir, "weechat"); - newXS ("weechat::mkdir_parents", XS_weechat_api_mkdir_parents, "weechat"); - newXS ("weechat::list_new", XS_weechat_api_list_new, "weechat"); - newXS ("weechat::list_add", XS_weechat_api_list_add, "weechat"); - newXS ("weechat::list_search", XS_weechat_api_list_search, "weechat"); - newXS ("weechat::list_search_pos", XS_weechat_api_list_search_pos, "weechat"); - newXS ("weechat::list_casesearch", XS_weechat_api_list_casesearch, "weechat"); - newXS ("weechat::list_casesearch_pos", XS_weechat_api_list_casesearch_pos, "weechat"); - newXS ("weechat::list_get", XS_weechat_api_list_get, "weechat"); - newXS ("weechat::list_set", XS_weechat_api_list_set, "weechat"); - newXS ("weechat::list_next", XS_weechat_api_list_next, "weechat"); - newXS ("weechat::list_prev", XS_weechat_api_list_prev, "weechat"); - newXS ("weechat::list_string", XS_weechat_api_list_string, "weechat"); - newXS ("weechat::list_size", XS_weechat_api_list_size, "weechat"); - newXS ("weechat::list_remove", XS_weechat_api_list_remove, "weechat"); - newXS ("weechat::list_remove_all", XS_weechat_api_list_remove_all, "weechat"); - newXS ("weechat::list_free", XS_weechat_api_list_free, "weechat"); - newXS ("weechat::config_new", XS_weechat_api_config_new, "weechat"); - newXS ("weechat::config_new_section", XS_weechat_api_config_new_section, "weechat"); - newXS ("weechat::config_search_section", XS_weechat_api_config_search_section, "weechat"); - newXS ("weechat::config_new_option", XS_weechat_api_config_new_option, "weechat"); - newXS ("weechat::config_search_option", XS_weechat_api_config_search_option, "weechat"); - newXS ("weechat::config_string_to_boolean", XS_weechat_api_config_string_to_boolean, "weechat"); - newXS ("weechat::config_option_reset", XS_weechat_api_config_option_reset, "weechat"); - newXS ("weechat::config_option_set", XS_weechat_api_config_option_set, "weechat"); - newXS ("weechat::config_option_set_null", XS_weechat_api_config_option_set_null, "weechat"); - newXS ("weechat::config_option_unset", XS_weechat_api_config_option_unset, "weechat"); - newXS ("weechat::config_option_rename", XS_weechat_api_config_option_rename, "weechat"); - newXS ("weechat::config_option_is_null", XS_weechat_api_config_option_is_null, "weechat"); - newXS ("weechat::config_option_default_is_null", XS_weechat_api_config_option_default_is_null, "weechat"); - newXS ("weechat::config_boolean", XS_weechat_api_config_boolean, "weechat"); - newXS ("weechat::config_boolean_default", XS_weechat_api_config_boolean_default, "weechat"); - newXS ("weechat::config_integer", XS_weechat_api_config_integer, "weechat"); - newXS ("weechat::config_integer_default", XS_weechat_api_config_integer_default, "weechat"); - newXS ("weechat::config_string", XS_weechat_api_config_string, "weechat"); - newXS ("weechat::config_string_default", XS_weechat_api_config_string_default, "weechat"); - newXS ("weechat::config_color", XS_weechat_api_config_color, "weechat"); - newXS ("weechat::config_color_default", XS_weechat_api_config_color_default, "weechat"); - newXS ("weechat::config_write_option", XS_weechat_api_config_write_option, "weechat"); - newXS ("weechat::config_write_line", XS_weechat_api_config_write_line, "weechat"); - newXS ("weechat::config_write", XS_weechat_api_config_write, "weechat"); - newXS ("weechat::config_read", XS_weechat_api_config_read, "weechat"); - newXS ("weechat::config_reload", XS_weechat_api_config_reload, "weechat"); - newXS ("weechat::config_option_free", XS_weechat_api_config_option_free, "weechat"); - newXS ("weechat::config_section_free_options", XS_weechat_api_config_section_free_options, "weechat"); - newXS ("weechat::config_section_free", XS_weechat_api_config_section_free, "weechat"); - newXS ("weechat::config_free", XS_weechat_api_config_free, "weechat"); - newXS ("weechat::config_get", XS_weechat_api_config_get, "weechat"); - newXS ("weechat::config_get_plugin", XS_weechat_api_config_get_plugin, "weechat"); - newXS ("weechat::config_is_set_plugin", XS_weechat_api_config_is_set_plugin, "weechat"); - newXS ("weechat::config_set_plugin", XS_weechat_api_config_set_plugin, "weechat"); - newXS ("weechat::config_set_desc_plugin", XS_weechat_api_config_set_desc_plugin, "weechat"); - newXS ("weechat::config_unset_plugin", XS_weechat_api_config_unset_plugin, "weechat"); - newXS ("weechat::key_bind", XS_weechat_api_key_bind, "weechat"); - newXS ("weechat::key_unbind", XS_weechat_api_key_unbind, "weechat"); - newXS ("weechat::prefix", XS_weechat_api_prefix, "weechat"); - newXS ("weechat::color", XS_weechat_api_color, "weechat"); - newXS ("weechat::print", XS_weechat_api_print, "weechat"); - newXS ("weechat::print_date_tags", XS_weechat_api_print_date_tags, "weechat"); - newXS ("weechat::print_y", XS_weechat_api_print_y, "weechat"); - newXS ("weechat::log_print", XS_weechat_api_log_print, "weechat"); - newXS ("weechat::hook_command", XS_weechat_api_hook_command, "weechat"); - newXS ("weechat::hook_command_run", XS_weechat_api_hook_command_run, "weechat"); - newXS ("weechat::hook_timer", XS_weechat_api_hook_timer, "weechat"); - newXS ("weechat::hook_fd", XS_weechat_api_hook_fd, "weechat"); - newXS ("weechat::hook_process", XS_weechat_api_hook_process, "weechat"); - newXS ("weechat::hook_connect", XS_weechat_api_hook_connect, "weechat"); - newXS ("weechat::hook_print", XS_weechat_api_hook_print, "weechat"); - newXS ("weechat::hook_signal", XS_weechat_api_hook_signal, "weechat"); - newXS ("weechat::hook_signal_send", XS_weechat_api_hook_signal_send, "weechat"); - newXS ("weechat::hook_hsignal", XS_weechat_api_hook_hsignal, "weechat"); - newXS ("weechat::hook_hsignal_send", XS_weechat_api_hook_hsignal_send, "weechat"); - newXS ("weechat::hook_config", XS_weechat_api_hook_config, "weechat"); - newXS ("weechat::hook_completion", XS_weechat_api_hook_completion, "weechat"); - newXS ("weechat::hook_completion_list_add", XS_weechat_api_hook_completion_list_add, "weechat"); - newXS ("weechat::hook_modifier", XS_weechat_api_hook_modifier, "weechat"); - newXS ("weechat::hook_modifier_exec", XS_weechat_api_hook_modifier_exec, "weechat"); - newXS ("weechat::hook_info", XS_weechat_api_hook_info, "weechat"); - newXS ("weechat::hook_info_hashtable", XS_weechat_api_hook_info_hashtable, "weechat"); - newXS ("weechat::hook_infolist", XS_weechat_api_hook_infolist, "weechat"); - newXS ("weechat::hook_focus", XS_weechat_api_hook_focus, "weechat"); - newXS ("weechat::unhook", XS_weechat_api_unhook, "weechat"); - newXS ("weechat::unhook_all", XS_weechat_api_unhook_all, "weechat"); - newXS ("weechat::buffer_new", XS_weechat_api_buffer_new, "weechat"); - newXS ("weechat::buffer_search", XS_weechat_api_buffer_search, "weechat"); - newXS ("weechat::buffer_search_main", XS_weechat_api_buffer_search_main, "weechat"); - newXS ("weechat::current_buffer", XS_weechat_api_current_buffer, "weechat"); - newXS ("weechat::buffer_clear", XS_weechat_api_buffer_clear, "weechat"); - newXS ("weechat::buffer_close", XS_weechat_api_buffer_close, "weechat"); - newXS ("weechat::buffer_merge", XS_weechat_api_buffer_merge, "weechat"); - newXS ("weechat::buffer_unmerge", XS_weechat_api_buffer_unmerge, "weechat"); - newXS ("weechat::buffer_get_integer", XS_weechat_api_buffer_get_integer, "weechat"); - newXS ("weechat::buffer_get_string", XS_weechat_api_buffer_get_string, "weechat"); - newXS ("weechat::buffer_get_pointer", XS_weechat_api_buffer_get_pointer, "weechat"); - newXS ("weechat::buffer_set", XS_weechat_api_buffer_set, "weechat"); - newXS ("weechat::buffer_string_replace_local_var", XS_weechat_api_buffer_string_replace_local_var, "weechat"); - newXS ("weechat::buffer_match_list", XS_weechat_api_buffer_match_list, "weechat"); - newXS ("weechat::current_window", XS_weechat_api_current_window, "weechat"); - newXS ("weechat::window_search_with_buffer", XS_weechat_api_window_search_with_buffer, "weechat"); - newXS ("weechat::window_get_integer", XS_weechat_api_window_get_integer, "weechat"); - newXS ("weechat::window_get_string", XS_weechat_api_window_get_string, "weechat"); - newXS ("weechat::window_get_pointer", XS_weechat_api_window_get_pointer, "weechat"); - newXS ("weechat::window_set_title", XS_weechat_api_window_set_title, "weechat"); - newXS ("weechat::nicklist_add_group", XS_weechat_api_nicklist_add_group, "weechat"); - newXS ("weechat::nicklist_search_group", XS_weechat_api_nicklist_search_group, "weechat"); - newXS ("weechat::nicklist_add_nick", XS_weechat_api_nicklist_add_nick, "weechat"); - newXS ("weechat::nicklist_search_nick", XS_weechat_api_nicklist_search_nick, "weechat"); - newXS ("weechat::nicklist_remove_group", XS_weechat_api_nicklist_remove_group, "weechat"); - newXS ("weechat::nicklist_remove_nick", XS_weechat_api_nicklist_remove_nick, "weechat"); - newXS ("weechat::nicklist_remove_all", XS_weechat_api_nicklist_remove_all, "weechat"); - newXS ("weechat::nicklist_group_get_integer", XS_weechat_api_nicklist_group_get_integer, "weechat"); - newXS ("weechat::nicklist_group_get_string", XS_weechat_api_nicklist_group_get_string, "weechat"); - newXS ("weechat::nicklist_group_get_pointer", XS_weechat_api_nicklist_group_get_pointer, "weechat"); - newXS ("weechat::nicklist_group_set", XS_weechat_api_nicklist_group_set, "weechat"); - newXS ("weechat::nicklist_nick_get_integer", XS_weechat_api_nicklist_nick_get_integer, "weechat"); - newXS ("weechat::nicklist_nick_get_string", XS_weechat_api_nicklist_nick_get_string, "weechat"); - newXS ("weechat::nicklist_nick_get_pointer", XS_weechat_api_nicklist_nick_get_pointer, "weechat"); - newXS ("weechat::nicklist_nick_set", XS_weechat_api_nicklist_nick_set, "weechat"); - newXS ("weechat::bar_item_search", XS_weechat_api_bar_item_search, "weechat"); - newXS ("weechat::bar_item_new", XS_weechat_api_bar_item_new, "weechat"); - newXS ("weechat::bar_item_update", XS_weechat_api_bar_item_update, "weechat"); - newXS ("weechat::bar_item_remove", XS_weechat_api_bar_item_remove, "weechat"); - newXS ("weechat::bar_search", XS_weechat_api_bar_search, "weechat"); - newXS ("weechat::bar_new", XS_weechat_api_bar_new, "weechat"); - newXS ("weechat::bar_set", XS_weechat_api_bar_set, "weechat"); - newXS ("weechat::bar_update", XS_weechat_api_bar_update, "weechat"); - newXS ("weechat::bar_remove", XS_weechat_api_bar_remove, "weechat"); - newXS ("weechat::command", XS_weechat_api_command, "weechat"); - newXS ("weechat::info_get", XS_weechat_api_info_get, "weechat"); - newXS ("weechat::info_get_hashtable", XS_weechat_api_info_get_hashtable, "weechat"); - newXS ("weechat::infolist_new", XS_weechat_api_infolist_new, "weechat"); - newXS ("weechat::infolist_new_item", XS_weechat_api_infolist_new_item, "weechat"); - newXS ("weechat::infolist_new_var_integer", XS_weechat_api_infolist_new_var_integer, "weechat"); - newXS ("weechat::infolist_new_var_string", XS_weechat_api_infolist_new_var_string, "weechat"); - newXS ("weechat::infolist_new_var_pointer", XS_weechat_api_infolist_new_var_pointer, "weechat"); - newXS ("weechat::infolist_new_var_time", XS_weechat_api_infolist_new_var_time, "weechat"); - newXS ("weechat::infolist_get", XS_weechat_api_infolist_get, "weechat"); - newXS ("weechat::infolist_next", XS_weechat_api_infolist_next, "weechat"); - newXS ("weechat::infolist_prev", XS_weechat_api_infolist_prev, "weechat"); - newXS ("weechat::infolist_reset_item_cursor", XS_weechat_api_infolist_reset_item_cursor, "weechat"); - newXS ("weechat::infolist_fields", XS_weechat_api_infolist_fields, "weechat"); - newXS ("weechat::infolist_integer", XS_weechat_api_infolist_integer, "weechat"); - newXS ("weechat::infolist_string", XS_weechat_api_infolist_string, "weechat"); - newXS ("weechat::infolist_pointer", XS_weechat_api_infolist_pointer, "weechat"); - newXS ("weechat::infolist_time", XS_weechat_api_infolist_time, "weechat"); - newXS ("weechat::infolist_free", XS_weechat_api_infolist_free, "weechat"); - newXS ("weechat::hdata_get", XS_weechat_api_hdata_get, "weechat"); - newXS ("weechat::hdata_get_var_offset", XS_weechat_api_hdata_get_var_offset, "weechat"); - newXS ("weechat::hdata_get_var_type_string", XS_weechat_api_hdata_get_var_type_string, "weechat"); - newXS ("weechat::hdata_get_var_hdata", XS_weechat_api_hdata_get_var_hdata, "weechat"); - newXS ("weechat::hdata_get_list", XS_weechat_api_hdata_get_list, "weechat"); - newXS ("weechat::hdata_check_pointer", XS_weechat_api_hdata_check_pointer, "weechat"); - newXS ("weechat::hdata_move", XS_weechat_api_hdata_move, "weechat"); - newXS ("weechat::hdata_char", XS_weechat_api_hdata_char, "weechat"); - newXS ("weechat::hdata_integer", XS_weechat_api_hdata_integer, "weechat"); - newXS ("weechat::hdata_long", XS_weechat_api_hdata_long, "weechat"); - newXS ("weechat::hdata_string", XS_weechat_api_hdata_string, "weechat"); - newXS ("weechat::hdata_pointer", XS_weechat_api_hdata_pointer, "weechat"); - newXS ("weechat::hdata_time", XS_weechat_api_hdata_time, "weechat"); - newXS ("weechat::hdata_get_string", XS_weechat_api_hdata_get_string, "weechat"); - newXS ("weechat::upgrade_new", XS_weechat_api_upgrade_new, "weechat"); - newXS ("weechat::upgrade_write_object", XS_weechat_api_upgrade_write_object, "weechat"); - newXS ("weechat::upgrade_read", XS_weechat_api_upgrade_read, "weechat"); - newXS ("weechat::upgrade_close", XS_weechat_api_upgrade_close, "weechat"); + API_DEF_FUNC(register); + API_DEF_FUNC(plugin_get_name); + API_DEF_FUNC(charset_set); + API_DEF_FUNC(iconv_to_internal); + API_DEF_FUNC(iconv_from_internal); + API_DEF_FUNC(gettext); + API_DEF_FUNC(ngettext); + API_DEF_FUNC(string_match); + API_DEF_FUNC(string_has_highlight); + API_DEF_FUNC(string_has_highlight_regex); + API_DEF_FUNC(string_mask_to_regex); + API_DEF_FUNC(string_remove_color); + API_DEF_FUNC(string_is_command_char); + API_DEF_FUNC(string_input_for_buffer); + API_DEF_FUNC(mkdir_home); + API_DEF_FUNC(mkdir); + API_DEF_FUNC(mkdir_parents); + API_DEF_FUNC(list_new); + API_DEF_FUNC(list_add); + API_DEF_FUNC(list_search); + API_DEF_FUNC(list_search_pos); + API_DEF_FUNC(list_casesearch); + API_DEF_FUNC(list_casesearch_pos); + API_DEF_FUNC(list_get); + API_DEF_FUNC(list_set); + API_DEF_FUNC(list_next); + API_DEF_FUNC(list_prev); + API_DEF_FUNC(list_string); + API_DEF_FUNC(list_size); + API_DEF_FUNC(list_remove); + API_DEF_FUNC(list_remove_all); + API_DEF_FUNC(list_free); + API_DEF_FUNC(config_new); + API_DEF_FUNC(config_new_section); + API_DEF_FUNC(config_search_section); + API_DEF_FUNC(config_new_option); + API_DEF_FUNC(config_search_option); + API_DEF_FUNC(config_string_to_boolean); + API_DEF_FUNC(config_option_reset); + API_DEF_FUNC(config_option_set); + API_DEF_FUNC(config_option_set_null); + API_DEF_FUNC(config_option_unset); + API_DEF_FUNC(config_option_rename); + API_DEF_FUNC(config_option_is_null); + API_DEF_FUNC(config_option_default_is_null); + API_DEF_FUNC(config_boolean); + API_DEF_FUNC(config_boolean_default); + API_DEF_FUNC(config_integer); + API_DEF_FUNC(config_integer_default); + API_DEF_FUNC(config_string); + API_DEF_FUNC(config_string_default); + API_DEF_FUNC(config_color); + API_DEF_FUNC(config_color_default); + API_DEF_FUNC(config_write_option); + API_DEF_FUNC(config_write_line); + API_DEF_FUNC(config_write); + API_DEF_FUNC(config_read); + API_DEF_FUNC(config_reload); + API_DEF_FUNC(config_option_free); + API_DEF_FUNC(config_section_free_options); + API_DEF_FUNC(config_section_free); + API_DEF_FUNC(config_free); + API_DEF_FUNC(config_get); + API_DEF_FUNC(config_get_plugin); + API_DEF_FUNC(config_is_set_plugin); + API_DEF_FUNC(config_set_plugin); + API_DEF_FUNC(config_set_desc_plugin); + API_DEF_FUNC(config_unset_plugin); + API_DEF_FUNC(key_bind); + API_DEF_FUNC(key_unbind); + API_DEF_FUNC(prefix); + API_DEF_FUNC(color); + API_DEF_FUNC(print); + API_DEF_FUNC(print_date_tags); + API_DEF_FUNC(print_y); + API_DEF_FUNC(log_print); + API_DEF_FUNC(hook_command); + API_DEF_FUNC(hook_command_run); + API_DEF_FUNC(hook_timer); + API_DEF_FUNC(hook_fd); + API_DEF_FUNC(hook_process); + API_DEF_FUNC(hook_connect); + API_DEF_FUNC(hook_print); + API_DEF_FUNC(hook_signal); + API_DEF_FUNC(hook_signal_send); + API_DEF_FUNC(hook_hsignal); + API_DEF_FUNC(hook_hsignal_send); + API_DEF_FUNC(hook_config); + API_DEF_FUNC(hook_completion); + API_DEF_FUNC(hook_completion_list_add); + API_DEF_FUNC(hook_modifier); + API_DEF_FUNC(hook_modifier_exec); + API_DEF_FUNC(hook_info); + API_DEF_FUNC(hook_info_hashtable); + API_DEF_FUNC(hook_infolist); + API_DEF_FUNC(hook_focus); + API_DEF_FUNC(unhook); + API_DEF_FUNC(unhook_all); + API_DEF_FUNC(buffer_new); + API_DEF_FUNC(buffer_search); + API_DEF_FUNC(buffer_search_main); + API_DEF_FUNC(current_buffer); + API_DEF_FUNC(buffer_clear); + API_DEF_FUNC(buffer_close); + API_DEF_FUNC(buffer_merge); + API_DEF_FUNC(buffer_unmerge); + API_DEF_FUNC(buffer_get_integer); + API_DEF_FUNC(buffer_get_string); + API_DEF_FUNC(buffer_get_pointer); + API_DEF_FUNC(buffer_set); + API_DEF_FUNC(buffer_string_replace_local_var); + API_DEF_FUNC(buffer_match_list); + API_DEF_FUNC(current_window); + API_DEF_FUNC(window_search_with_buffer); + API_DEF_FUNC(window_get_integer); + API_DEF_FUNC(window_get_string); + API_DEF_FUNC(window_get_pointer); + API_DEF_FUNC(window_set_title); + API_DEF_FUNC(nicklist_add_group); + API_DEF_FUNC(nicklist_search_group); + API_DEF_FUNC(nicklist_add_nick); + API_DEF_FUNC(nicklist_search_nick); + API_DEF_FUNC(nicklist_remove_group); + API_DEF_FUNC(nicklist_remove_nick); + API_DEF_FUNC(nicklist_remove_all); + API_DEF_FUNC(nicklist_group_get_integer); + API_DEF_FUNC(nicklist_group_get_string); + API_DEF_FUNC(nicklist_group_get_pointer); + API_DEF_FUNC(nicklist_group_set); + API_DEF_FUNC(nicklist_nick_get_integer); + API_DEF_FUNC(nicklist_nick_get_string); + API_DEF_FUNC(nicklist_nick_get_pointer); + API_DEF_FUNC(nicklist_nick_set); + API_DEF_FUNC(bar_item_search); + API_DEF_FUNC(bar_item_new); + API_DEF_FUNC(bar_item_update); + API_DEF_FUNC(bar_item_remove); + API_DEF_FUNC(bar_search); + API_DEF_FUNC(bar_new); + API_DEF_FUNC(bar_set); + API_DEF_FUNC(bar_update); + API_DEF_FUNC(bar_remove); + API_DEF_FUNC(command); + API_DEF_FUNC(info_get); + API_DEF_FUNC(info_get_hashtable); + API_DEF_FUNC(infolist_new); + API_DEF_FUNC(infolist_new_item); + API_DEF_FUNC(infolist_new_var_integer); + API_DEF_FUNC(infolist_new_var_string); + API_DEF_FUNC(infolist_new_var_pointer); + API_DEF_FUNC(infolist_new_var_time); + API_DEF_FUNC(infolist_get); + API_DEF_FUNC(infolist_next); + API_DEF_FUNC(infolist_prev); + API_DEF_FUNC(infolist_reset_item_cursor); + API_DEF_FUNC(infolist_fields); + API_DEF_FUNC(infolist_integer); + API_DEF_FUNC(infolist_string); + API_DEF_FUNC(infolist_pointer); + API_DEF_FUNC(infolist_time); + API_DEF_FUNC(infolist_free); + API_DEF_FUNC(hdata_get); + API_DEF_FUNC(hdata_get_var_offset); + API_DEF_FUNC(hdata_get_var_type_string); + API_DEF_FUNC(hdata_get_var_hdata); + API_DEF_FUNC(hdata_get_list); + API_DEF_FUNC(hdata_check_pointer); + API_DEF_FUNC(hdata_move); + API_DEF_FUNC(hdata_char); + API_DEF_FUNC(hdata_integer); + API_DEF_FUNC(hdata_long); + API_DEF_FUNC(hdata_string); + API_DEF_FUNC(hdata_pointer); + API_DEF_FUNC(hdata_time); + API_DEF_FUNC(hdata_hashtable); + API_DEF_FUNC(hdata_get_string); + API_DEF_FUNC(upgrade_new); + API_DEF_FUNC(upgrade_write_object); + API_DEF_FUNC(upgrade_read); + API_DEF_FUNC(upgrade_close); /* interface constants */ stash = gv_stashpv ("weechat", TRUE); diff --git a/src/plugins/scripts/perl/weechat-perl.c b/src/plugins/scripts/perl/weechat-perl.c index 82669b948..e7462e825 100644 --- a/src/plugins/scripts/perl/weechat-perl.c +++ b/src/plugins/scripts/perl/weechat-perl.c @@ -134,8 +134,8 @@ char *perl_weechat_code = void weechat_perl_hashtable_map_cb (void *data, struct t_hashtable *hashtable, - const void *key, - const void *value) + const char *key, + const char *value) { HV *hash; @@ -144,8 +144,7 @@ weechat_perl_hashtable_map_cb (void *data, hash = (HV *)data; - (void) hv_store (hash, (char *)key, strlen ((char *)key), - newSVpv ((char *)value, 0), 0); + (void) hv_store (hash, key, strlen (key), newSVpv (value, 0), 0); } /* @@ -161,9 +160,9 @@ weechat_perl_hashtable_to_hash (struct t_hashtable *hashtable) if (!hash) return NULL; - weechat_hashtable_map (hashtable, - &weechat_perl_hashtable_map_cb, - hash); + weechat_hashtable_map_string (hashtable, + &weechat_perl_hashtable_map_cb, + hash); return hash; } diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c index 0048ee518..dc3ece4ae 100644 --- a/src/plugins/scripts/python/weechat-python-api.c +++ b/src/plugins/scripts/python/weechat-python-api.c @@ -72,6 +72,9 @@ #define API_RETURN_LONG(__long) \ return Py_BuildValue ("l", __long); +#define API_DEF_FUNC(__name) \ + { #__name, &weechat_python_api_##__name, METH_VARARGS, "" } + /* * weechat_python_api_register: startup function for all WeeChat Python scripts @@ -5456,6 +5459,32 @@ weechat_python_api_hdata_time (PyObject *self, PyObject *args) } /* + * weechat_python_api_hdata_hashtable: get hashtable value of a variable in + * structure using hdata + */ + +static PyObject * +weechat_python_api_hdata_hashtable (PyObject *self, PyObject *args) +{ + char *hdata, *pointer, *name; + PyObject *result_dict; + + API_FUNC(1, "hdata_hashtable", API_RETURN_EMPTY); + hdata = NULL; + pointer = NULL; + name = NULL; + if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name)) + API_WRONG_ARGS(API_RETURN_EMPTY); + + result_dict = weechat_python_hashtable_to_dict ( + weechat_hdata_hashtable (script_str2ptr (hdata), + script_str2ptr (pointer), + name)); + + return result_dict; +} + +/* * weechat_python_api_hdata_get_string: get hdata property as string */ @@ -5623,184 +5652,185 @@ weechat_python_api_upgrade_close (PyObject *self, PyObject *args) PyMethodDef weechat_python_funcs[] = { - { "register", &weechat_python_api_register, METH_VARARGS, "" }, - { "plugin_get_name", &weechat_python_api_plugin_get_name, METH_VARARGS, "" }, - { "charset_set", &weechat_python_api_charset_set, METH_VARARGS, "" }, - { "iconv_to_internal", &weechat_python_api_iconv_to_internal, METH_VARARGS, "" }, - { "iconv_from_internal", &weechat_python_api_iconv_from_internal, METH_VARARGS, "" }, - { "gettext", &weechat_python_api_gettext, METH_VARARGS, "" }, - { "ngettext", &weechat_python_api_ngettext, METH_VARARGS, "" }, - { "string_match", &weechat_python_api_string_match, METH_VARARGS, "" }, - { "string_has_highlight", &weechat_python_api_string_has_highlight, METH_VARARGS, "" }, - { "string_has_highlight_regex", &weechat_python_api_string_has_highlight_regex, METH_VARARGS, "" }, - { "string_mask_to_regex", &weechat_python_api_string_mask_to_regex, METH_VARARGS, "" }, - { "string_remove_color", &weechat_python_api_string_remove_color, METH_VARARGS, "" }, - { "string_is_command_char", &weechat_python_api_string_is_command_char, METH_VARARGS, "" }, - { "string_input_for_buffer", &weechat_python_api_string_input_for_buffer, METH_VARARGS, "" }, - { "mkdir_home", &weechat_python_api_mkdir_home, METH_VARARGS, "" }, - { "mkdir", &weechat_python_api_mkdir, METH_VARARGS, "" }, - { "mkdir_parents", &weechat_python_api_mkdir_parents, METH_VARARGS, "" }, - { "list_new", &weechat_python_api_list_new, METH_VARARGS, "" }, - { "list_add", &weechat_python_api_list_add, METH_VARARGS, "" }, - { "list_search", &weechat_python_api_list_search, METH_VARARGS, "" }, - { "list_search_pos", &weechat_python_api_list_search_pos, METH_VARARGS, "" }, - { "list_casesearch", &weechat_python_api_list_casesearch, METH_VARARGS, "" }, - { "list_casesearch_pos", &weechat_python_api_list_casesearch_pos, METH_VARARGS, "" }, - { "list_get", &weechat_python_api_list_get, METH_VARARGS, "" }, - { "list_set", &weechat_python_api_list_set, METH_VARARGS, "" }, - { "list_next", &weechat_python_api_list_next, METH_VARARGS, "" }, - { "list_prev", &weechat_python_api_list_prev, METH_VARARGS, "" }, - { "list_string", &weechat_python_api_list_string, METH_VARARGS, "" }, - { "list_size", &weechat_python_api_list_size, METH_VARARGS, "" }, - { "list_remove", &weechat_python_api_list_remove, METH_VARARGS, "" }, - { "list_remove_all", &weechat_python_api_list_remove_all, METH_VARARGS, "" }, - { "list_free", &weechat_python_api_list_free, METH_VARARGS, "" }, - { "config_new", &weechat_python_api_config_new, METH_VARARGS, "" }, - { "config_new_section", &weechat_python_api_config_new_section, METH_VARARGS, "" }, - { "config_search_section", &weechat_python_api_config_search_section, METH_VARARGS, "" }, - { "config_new_option", &weechat_python_api_config_new_option, METH_VARARGS, "" }, - { "config_search_option", &weechat_python_api_config_search_option, METH_VARARGS, "" }, - { "config_string_to_boolean", &weechat_python_api_config_string_to_boolean, METH_VARARGS, "" }, - { "config_option_reset", &weechat_python_api_config_option_reset, METH_VARARGS, "" }, - { "config_option_set", &weechat_python_api_config_option_set, METH_VARARGS, "" }, - { "config_option_set_null", &weechat_python_api_config_option_set_null, METH_VARARGS, "" }, - { "config_option_unset", &weechat_python_api_config_option_unset, METH_VARARGS, "" }, - { "config_option_rename", &weechat_python_api_config_option_rename, METH_VARARGS, "" }, - { "config_option_is_null", &weechat_python_api_config_option_is_null, METH_VARARGS, "" }, - { "config_option_default_is_null", &weechat_python_api_config_option_default_is_null, METH_VARARGS, "" }, - { "config_boolean", &weechat_python_api_config_boolean, METH_VARARGS, "" }, - { "config_boolean_default", &weechat_python_api_config_boolean_default, METH_VARARGS, "" }, - { "config_integer", &weechat_python_api_config_integer, METH_VARARGS, "" }, - { "config_integer_default", &weechat_python_api_config_integer_default, METH_VARARGS, "" }, - { "config_string", &weechat_python_api_config_string, METH_VARARGS, "" }, - { "config_string_default", &weechat_python_api_config_string_default, METH_VARARGS, "" }, - { "config_color", &weechat_python_api_config_color, METH_VARARGS, "" }, - { "config_color_default", &weechat_python_api_config_color_default, METH_VARARGS, "" }, - { "config_write_option", &weechat_python_api_config_write_option, METH_VARARGS, "" }, - { "config_write_line", &weechat_python_api_config_write_line, METH_VARARGS, "" }, - { "config_write", &weechat_python_api_config_write, METH_VARARGS, "" }, - { "config_read", &weechat_python_api_config_read, METH_VARARGS, "" }, - { "config_reload", &weechat_python_api_config_reload, METH_VARARGS, "" }, - { "config_option_free", &weechat_python_api_config_option_free, METH_VARARGS, "" }, - { "config_section_free_options", &weechat_python_api_config_section_free_options, METH_VARARGS, "" }, - { "config_section_free", &weechat_python_api_config_section_free, METH_VARARGS, "" }, - { "config_free", &weechat_python_api_config_free, METH_VARARGS, "" }, - { "config_get", &weechat_python_api_config_get, METH_VARARGS, "" }, - { "config_get_plugin", &weechat_python_api_config_get_plugin, METH_VARARGS, "" }, - { "config_is_set_plugin", &weechat_python_api_config_is_set_plugin, METH_VARARGS, "" }, - { "config_set_plugin", &weechat_python_api_config_set_plugin, METH_VARARGS, "" }, - { "config_set_desc_plugin", &weechat_python_api_config_set_desc_plugin, METH_VARARGS, "" }, - { "config_unset_plugin", &weechat_python_api_config_unset_plugin, METH_VARARGS, "" }, - { "key_bind", &weechat_python_api_key_bind, METH_VARARGS, "" }, - { "key_unbind", &weechat_python_api_key_unbind, METH_VARARGS, "" }, - { "prefix", &weechat_python_api_prefix, METH_VARARGS, "" }, - { "color", &weechat_python_api_color, METH_VARARGS, "" }, - { "prnt", &weechat_python_api_prnt, METH_VARARGS, "" }, - { "prnt_date_tags", &weechat_python_api_prnt_date_tags, METH_VARARGS, "" }, - { "prnt_y", &weechat_python_api_prnt_y, METH_VARARGS, "" }, - { "log_print", &weechat_python_api_log_print, METH_VARARGS, "" }, - { "hook_command", &weechat_python_api_hook_command, METH_VARARGS, "" }, - { "hook_command_run", &weechat_python_api_hook_command_run, METH_VARARGS, "" }, - { "hook_timer", &weechat_python_api_hook_timer, METH_VARARGS, "" }, - { "hook_fd", &weechat_python_api_hook_fd, METH_VARARGS, "" }, - { "hook_process", &weechat_python_api_hook_process, METH_VARARGS, "" }, - { "hook_connect", &weechat_python_api_hook_connect, METH_VARARGS, "" }, - { "hook_print", &weechat_python_api_hook_print, METH_VARARGS, "" }, - { "hook_signal", &weechat_python_api_hook_signal, METH_VARARGS, "" }, - { "hook_signal_send", &weechat_python_api_hook_signal_send, METH_VARARGS, "" }, - { "hook_hsignal", &weechat_python_api_hook_hsignal, METH_VARARGS, "" }, - { "hook_hsignal_send", &weechat_python_api_hook_hsignal_send, METH_VARARGS, "" }, - { "hook_config", &weechat_python_api_hook_config, METH_VARARGS, "" }, - { "hook_completion", &weechat_python_api_hook_completion, METH_VARARGS, "" }, - { "hook_completion_list_add", &weechat_python_api_hook_completion_list_add, METH_VARARGS, "" }, - { "hook_modifier", &weechat_python_api_hook_modifier, METH_VARARGS, "" }, - { "hook_modifier_exec", &weechat_python_api_hook_modifier_exec, METH_VARARGS, "" }, - { "hook_info", &weechat_python_api_hook_info, METH_VARARGS, "" }, - { "hook_info_hashtable", &weechat_python_api_hook_info_hashtable, METH_VARARGS, "" }, - { "hook_infolist", &weechat_python_api_hook_infolist, METH_VARARGS, "" }, - { "hook_focus", &weechat_python_api_hook_focus, METH_VARARGS, "" }, - { "unhook", &weechat_python_api_unhook, METH_VARARGS, "" }, - { "unhook_all", &weechat_python_api_unhook_all, METH_VARARGS, "" }, - { "buffer_new", &weechat_python_api_buffer_new, METH_VARARGS, "" }, - { "buffer_search", &weechat_python_api_buffer_search, METH_VARARGS, "" }, - { "buffer_search_main", &weechat_python_api_buffer_search_main, METH_VARARGS, "" }, - { "current_buffer", &weechat_python_api_current_buffer, METH_VARARGS, "" }, - { "buffer_clear", &weechat_python_api_buffer_clear, METH_VARARGS, "" }, - { "buffer_close", &weechat_python_api_buffer_close, METH_VARARGS, "" }, - { "buffer_merge", &weechat_python_api_buffer_merge, METH_VARARGS, "" }, - { "buffer_unmerge", &weechat_python_api_buffer_unmerge, METH_VARARGS, "" }, - { "buffer_get_integer", &weechat_python_api_buffer_get_integer, METH_VARARGS, "" }, - { "buffer_get_string", &weechat_python_api_buffer_get_string, METH_VARARGS, "" }, - { "buffer_get_pointer", &weechat_python_api_buffer_get_pointer, METH_VARARGS, "" }, - { "buffer_set", &weechat_python_api_buffer_set, METH_VARARGS, "" }, - { "buffer_string_replace_local_var", &weechat_python_api_buffer_string_replace_local_var, METH_VARARGS, "" }, - { "buffer_match_list", &weechat_python_api_buffer_match_list, METH_VARARGS, "" }, - { "current_window", &weechat_python_api_current_window, METH_VARARGS, "" }, - { "window_search_with_buffer", &weechat_python_api_window_search_with_buffer, METH_VARARGS, "" }, - { "window_get_integer", &weechat_python_api_window_get_integer, METH_VARARGS, "" }, - { "window_get_string", &weechat_python_api_window_get_string, METH_VARARGS, "" }, - { "window_get_pointer", &weechat_python_api_window_get_pointer, METH_VARARGS, "" }, - { "window_set_title", &weechat_python_api_window_set_title, METH_VARARGS, "" }, - { "nicklist_add_group", &weechat_python_api_nicklist_add_group, METH_VARARGS, "" }, - { "nicklist_search_group", &weechat_python_api_nicklist_search_group, METH_VARARGS, "" }, - { "nicklist_add_nick", &weechat_python_api_nicklist_add_nick, METH_VARARGS, "" }, - { "nicklist_search_nick", &weechat_python_api_nicklist_search_nick, METH_VARARGS, "" }, - { "nicklist_remove_group", &weechat_python_api_nicklist_remove_group, METH_VARARGS, "" }, - { "nicklist_remove_nick", &weechat_python_api_nicklist_remove_nick, METH_VARARGS, "" }, - { "nicklist_remove_all", &weechat_python_api_nicklist_remove_all, METH_VARARGS, "" }, - { "nicklist_group_get_integer", &weechat_python_api_nicklist_group_get_integer, METH_VARARGS, "" }, - { "nicklist_group_get_string", &weechat_python_api_nicklist_group_get_string, METH_VARARGS, "" }, - { "nicklist_group_get_pointer", &weechat_python_api_nicklist_group_get_pointer, METH_VARARGS, "" }, - { "nicklist_group_set", &weechat_python_api_nicklist_group_set, METH_VARARGS, "" }, - { "nicklist_nick_get_integer", &weechat_python_api_nicklist_nick_get_integer, METH_VARARGS, "" }, - { "nicklist_nick_get_string", &weechat_python_api_nicklist_nick_get_string, METH_VARARGS, "" }, - { "nicklist_nick_get_pointer", &weechat_python_api_nicklist_nick_get_pointer, METH_VARARGS, "" }, - { "nicklist_nick_set", &weechat_python_api_nicklist_nick_set, METH_VARARGS, "" }, - { "bar_item_search", &weechat_python_api_bar_item_search, METH_VARARGS, "" }, - { "bar_item_new", &weechat_python_api_bar_item_new, METH_VARARGS, "" }, - { "bar_item_update", &weechat_python_api_bar_item_update, METH_VARARGS, "" }, - { "bar_item_remove", &weechat_python_api_bar_item_remove, METH_VARARGS, "" }, - { "bar_search", &weechat_python_api_bar_search, METH_VARARGS, "" }, - { "bar_new", &weechat_python_api_bar_new, METH_VARARGS, "" }, - { "bar_set", &weechat_python_api_bar_set, METH_VARARGS, "" }, - { "bar_update", &weechat_python_api_bar_update, METH_VARARGS, "" }, - { "bar_remove", &weechat_python_api_bar_remove, METH_VARARGS, "" }, - { "command", &weechat_python_api_command, METH_VARARGS, "" }, - { "info_get", &weechat_python_api_info_get, METH_VARARGS, "" }, - { "info_get_hashtable", &weechat_python_api_info_get_hashtable, METH_VARARGS, "" }, - { "infolist_new", &weechat_python_api_infolist_new, METH_VARARGS, "" }, - { "infolist_new_item", &weechat_python_api_infolist_new_item, METH_VARARGS, "" }, - { "infolist_new_var_integer", &weechat_python_api_infolist_new_var_integer, METH_VARARGS, "" }, - { "infolist_new_var_string", &weechat_python_api_infolist_new_var_string, METH_VARARGS, "" }, - { "infolist_new_var_pointer", &weechat_python_api_infolist_new_var_pointer, METH_VARARGS, "" }, - { "infolist_new_var_time", &weechat_python_api_infolist_new_var_time, METH_VARARGS, "" }, - { "infolist_get", &weechat_python_api_infolist_get, METH_VARARGS, "" }, - { "infolist_next", &weechat_python_api_infolist_next, METH_VARARGS, "" }, - { "infolist_prev", &weechat_python_api_infolist_prev, METH_VARARGS, "" }, - { "infolist_reset_item_cursor", &weechat_python_api_infolist_reset_item_cursor, METH_VARARGS, "" }, - { "infolist_fields", &weechat_python_api_infolist_fields, METH_VARARGS, "" }, - { "infolist_integer", &weechat_python_api_infolist_integer, METH_VARARGS, "" }, - { "infolist_string", &weechat_python_api_infolist_string, METH_VARARGS, "" }, - { "infolist_pointer", &weechat_python_api_infolist_pointer, METH_VARARGS, "" }, - { "infolist_time", &weechat_python_api_infolist_time, METH_VARARGS, "" }, - { "infolist_free", &weechat_python_api_infolist_free, METH_VARARGS, "" }, - { "hdata_get", &weechat_python_api_hdata_get, METH_VARARGS, "" }, - { "hdata_get_var_offset", &weechat_python_api_hdata_get_var_offset, METH_VARARGS, "" }, - { "hdata_get_var_type_string", &weechat_python_api_hdata_get_var_type_string, METH_VARARGS, "" }, - { "hdata_get_var_hdata", &weechat_python_api_hdata_get_var_hdata, METH_VARARGS, "" }, - { "hdata_get_list", &weechat_python_api_hdata_get_list, METH_VARARGS, "" }, - { "hdata_check_pointer", &weechat_python_api_hdata_check_pointer, METH_VARARGS, "" }, - { "hdata_move", &weechat_python_api_hdata_move, METH_VARARGS, "" }, - { "hdata_char", &weechat_python_api_hdata_char, METH_VARARGS, "" }, - { "hdata_integer", &weechat_python_api_hdata_integer, METH_VARARGS, "" }, - { "hdata_long", &weechat_python_api_hdata_long, METH_VARARGS, "" }, - { "hdata_string", &weechat_python_api_hdata_string, METH_VARARGS, "" }, - { "hdata_pointer", &weechat_python_api_hdata_pointer, METH_VARARGS, "" }, - { "hdata_time", &weechat_python_api_hdata_time, METH_VARARGS, "" }, - { "hdata_get_string", &weechat_python_api_hdata_get_string, METH_VARARGS, "" }, - { "upgrade_new", &weechat_python_api_upgrade_new, METH_VARARGS, "" }, - { "upgrade_write_object", &weechat_python_api_upgrade_write_object, METH_VARARGS, "" }, - { "upgrade_read", &weechat_python_api_upgrade_read, METH_VARARGS, "" }, - { "upgrade_close", &weechat_python_api_upgrade_close, METH_VARARGS, "" }, + API_DEF_FUNC(register), + API_DEF_FUNC(plugin_get_name), + API_DEF_FUNC(charset_set), + API_DEF_FUNC(iconv_to_internal), + API_DEF_FUNC(iconv_from_internal), + API_DEF_FUNC(gettext), + API_DEF_FUNC(ngettext), + API_DEF_FUNC(string_match), + API_DEF_FUNC(string_has_highlight), + API_DEF_FUNC(string_has_highlight_regex), + API_DEF_FUNC(string_mask_to_regex), + API_DEF_FUNC(string_remove_color), + API_DEF_FUNC(string_is_command_char), + API_DEF_FUNC(string_input_for_buffer), + API_DEF_FUNC(mkdir_home), + API_DEF_FUNC(mkdir), + API_DEF_FUNC(mkdir_parents), + API_DEF_FUNC(list_new), + API_DEF_FUNC(list_add), + API_DEF_FUNC(list_search), + API_DEF_FUNC(list_search_pos), + API_DEF_FUNC(list_casesearch), + API_DEF_FUNC(list_casesearch_pos), + API_DEF_FUNC(list_get), + API_DEF_FUNC(list_set), + API_DEF_FUNC(list_next), + API_DEF_FUNC(list_prev), + API_DEF_FUNC(list_string), + API_DEF_FUNC(list_size), + API_DEF_FUNC(list_remove), + API_DEF_FUNC(list_remove_all), + API_DEF_FUNC(list_free), + API_DEF_FUNC(config_new), + API_DEF_FUNC(config_new_section), + API_DEF_FUNC(config_search_section), + API_DEF_FUNC(config_new_option), + API_DEF_FUNC(config_search_option), + API_DEF_FUNC(config_string_to_boolean), + API_DEF_FUNC(config_option_reset), + API_DEF_FUNC(config_option_set), + API_DEF_FUNC(config_option_set_null), + API_DEF_FUNC(config_option_unset), + API_DEF_FUNC(config_option_rename), + API_DEF_FUNC(config_option_is_null), + API_DEF_FUNC(config_option_default_is_null), + API_DEF_FUNC(config_boolean), + API_DEF_FUNC(config_boolean_default), + API_DEF_FUNC(config_integer), + API_DEF_FUNC(config_integer_default), + API_DEF_FUNC(config_string), + API_DEF_FUNC(config_string_default), + API_DEF_FUNC(config_color), + API_DEF_FUNC(config_color_default), + API_DEF_FUNC(config_write_option), + API_DEF_FUNC(config_write_line), + API_DEF_FUNC(config_write), + API_DEF_FUNC(config_read), + API_DEF_FUNC(config_reload), + API_DEF_FUNC(config_option_free), + API_DEF_FUNC(config_section_free_options), + API_DEF_FUNC(config_section_free), + API_DEF_FUNC(config_free), + API_DEF_FUNC(config_get), + API_DEF_FUNC(config_get_plugin), + API_DEF_FUNC(config_is_set_plugin), + API_DEF_FUNC(config_set_plugin), + API_DEF_FUNC(config_set_desc_plugin), + API_DEF_FUNC(config_unset_plugin), + API_DEF_FUNC(key_bind), + API_DEF_FUNC(key_unbind), + API_DEF_FUNC(prefix), + API_DEF_FUNC(color), + API_DEF_FUNC(prnt), + API_DEF_FUNC(prnt_date_tags), + API_DEF_FUNC(prnt_y), + API_DEF_FUNC(log_print), + API_DEF_FUNC(hook_command), + API_DEF_FUNC(hook_command_run), + API_DEF_FUNC(hook_timer), + API_DEF_FUNC(hook_fd), + API_DEF_FUNC(hook_process), + API_DEF_FUNC(hook_connect), + API_DEF_FUNC(hook_print), + API_DEF_FUNC(hook_signal), + API_DEF_FUNC(hook_signal_send), + API_DEF_FUNC(hook_hsignal), + API_DEF_FUNC(hook_hsignal_send), + API_DEF_FUNC(hook_config), + API_DEF_FUNC(hook_completion), + API_DEF_FUNC(hook_completion_list_add), + API_DEF_FUNC(hook_modifier), + API_DEF_FUNC(hook_modifier_exec), + API_DEF_FUNC(hook_info), + API_DEF_FUNC(hook_info_hashtable), + API_DEF_FUNC(hook_infolist), + API_DEF_FUNC(hook_focus), + API_DEF_FUNC(unhook), + API_DEF_FUNC(unhook_all), + API_DEF_FUNC(buffer_new), + API_DEF_FUNC(buffer_search), + API_DEF_FUNC(buffer_search_main), + API_DEF_FUNC(current_buffer), + API_DEF_FUNC(buffer_clear), + API_DEF_FUNC(buffer_close), + API_DEF_FUNC(buffer_merge), + API_DEF_FUNC(buffer_unmerge), + API_DEF_FUNC(buffer_get_integer), + API_DEF_FUNC(buffer_get_string), + API_DEF_FUNC(buffer_get_pointer), + API_DEF_FUNC(buffer_set), + API_DEF_FUNC(buffer_string_replace_local_var), + API_DEF_FUNC(buffer_match_list), + API_DEF_FUNC(current_window), + API_DEF_FUNC(window_search_with_buffer), + API_DEF_FUNC(window_get_integer), + API_DEF_FUNC(window_get_string), + API_DEF_FUNC(window_get_pointer), + API_DEF_FUNC(window_set_title), + API_DEF_FUNC(nicklist_add_group), + API_DEF_FUNC(nicklist_search_group), + API_DEF_FUNC(nicklist_add_nick), + API_DEF_FUNC(nicklist_search_nick), + API_DEF_FUNC(nicklist_remove_group), + API_DEF_FUNC(nicklist_remove_nick), + API_DEF_FUNC(nicklist_remove_all), + API_DEF_FUNC(nicklist_group_get_integer), + API_DEF_FUNC(nicklist_group_get_string), + API_DEF_FUNC(nicklist_group_get_pointer), + API_DEF_FUNC(nicklist_group_set), + API_DEF_FUNC(nicklist_nick_get_integer), + API_DEF_FUNC(nicklist_nick_get_string), + API_DEF_FUNC(nicklist_nick_get_pointer), + API_DEF_FUNC(nicklist_nick_set), + API_DEF_FUNC(bar_item_search), + API_DEF_FUNC(bar_item_new), + API_DEF_FUNC(bar_item_update), + API_DEF_FUNC(bar_item_remove), + API_DEF_FUNC(bar_search), + API_DEF_FUNC(bar_new), + API_DEF_FUNC(bar_set), + API_DEF_FUNC(bar_update), + API_DEF_FUNC(bar_remove), + API_DEF_FUNC(command), + API_DEF_FUNC(info_get), + API_DEF_FUNC(info_get_hashtable), + API_DEF_FUNC(infolist_new), + API_DEF_FUNC(infolist_new_item), + API_DEF_FUNC(infolist_new_var_integer), + API_DEF_FUNC(infolist_new_var_string), + API_DEF_FUNC(infolist_new_var_pointer), + API_DEF_FUNC(infolist_new_var_time), + API_DEF_FUNC(infolist_get), + API_DEF_FUNC(infolist_next), + API_DEF_FUNC(infolist_prev), + API_DEF_FUNC(infolist_reset_item_cursor), + API_DEF_FUNC(infolist_fields), + API_DEF_FUNC(infolist_integer), + API_DEF_FUNC(infolist_string), + API_DEF_FUNC(infolist_pointer), + API_DEF_FUNC(infolist_time), + API_DEF_FUNC(infolist_free), + API_DEF_FUNC(hdata_get), + API_DEF_FUNC(hdata_get_var_offset), + API_DEF_FUNC(hdata_get_var_type_string), + API_DEF_FUNC(hdata_get_var_hdata), + API_DEF_FUNC(hdata_get_list), + API_DEF_FUNC(hdata_check_pointer), + API_DEF_FUNC(hdata_move), + API_DEF_FUNC(hdata_char), + API_DEF_FUNC(hdata_integer), + API_DEF_FUNC(hdata_long), + API_DEF_FUNC(hdata_string), + API_DEF_FUNC(hdata_pointer), + API_DEF_FUNC(hdata_time), + API_DEF_FUNC(hdata_hashtable), + API_DEF_FUNC(hdata_get_string), + API_DEF_FUNC(upgrade_new), + API_DEF_FUNC(upgrade_write_object), + API_DEF_FUNC(upgrade_read), + API_DEF_FUNC(upgrade_close), { NULL, NULL, 0, NULL } }; diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c index f9f134417..db09cc371 100644 --- a/src/plugins/scripts/python/weechat-python.c +++ b/src/plugins/scripts/python/weechat-python.c @@ -127,8 +127,8 @@ weechat_python_set_python2_bin () void weechat_python_hashtable_map_cb (void *data, struct t_hashtable *hashtable, - const void *key, - const void *value) + const char *key, + const char *value) { PyObject *dict, *dict_key, *dict_value; @@ -137,8 +137,8 @@ weechat_python_hashtable_map_cb (void *data, dict = (PyObject *)data; - dict_key = Py_BuildValue ("s", (const char *)key); - dict_value = Py_BuildValue ("s", (const char *)value); + dict_key = Py_BuildValue ("s", key); + dict_value = Py_BuildValue ("s", value); PyDict_SetItem (dict, dict_key, dict_value); @@ -163,9 +163,9 @@ weechat_python_hashtable_to_dict (struct t_hashtable *hashtable) return Py_None; } - weechat_hashtable_map (hashtable, - &weechat_python_hashtable_map_cb, - dict); + weechat_hashtable_map_string (hashtable, + &weechat_python_hashtable_map_cb, + dict); return dict; } diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c index 21c52923b..f47bcfb56 100644 --- a/src/plugins/scripts/ruby/weechat-ruby-api.c +++ b/src/plugins/scripts/ruby/weechat-ruby-api.c @@ -70,6 +70,10 @@ #define API_RETURN_LONG(__long) \ return LONG2FIX (__long); +#define API_DEF_FUNC(__name, __argc) \ + rb_define_module_function (ruby_mWeechat, #__name, \ + &weechat_ruby_api_##__name, __argc); + /* * weechat_ruby_api_register: startup function for all WeeChat Ruby scripts @@ -6283,6 +6287,38 @@ weechat_ruby_api_hdata_time (VALUE class, VALUE hdata, VALUE pointer, } /* + * weechat_ruby_api_hdata_hashtable: get hashtable value of a variable in + * structure using hdata + */ + +static VALUE +weechat_ruby_api_hdata_hashtable (VALUE class, VALUE hdata, VALUE pointer, + VALUE name) +{ + char *c_hdata, *c_pointer, *c_name; + VALUE result_hash; + + API_FUNC(1, "hdata_hashtable", API_RETURN_EMPTY); + if (NIL_P (hdata) || NIL_P (pointer) || NIL_P (name)) + API_WRONG_ARGS(API_RETURN_EMPTY); + + Check_Type (hdata, T_STRING); + Check_Type (pointer, T_STRING); + Check_Type (name, T_STRING); + + c_hdata = StringValuePtr (hdata); + c_pointer = StringValuePtr (pointer); + c_name = StringValuePtr (name); + + result_hash = weechat_ruby_hashtable_to_hash ( + weechat_hdata_hashtable (script_str2ptr (c_hdata), + script_str2ptr (c_pointer), + c_name)); + + return result_hash; +} + +/* * weechat_ruby_api_hdata_get_string: get hdata property as string */ @@ -6521,183 +6557,184 @@ weechat_ruby_api_init (VALUE ruby_mWeechat) rb_define_const(ruby_mWeechat, "WEECHAT_HOOK_SIGNAL_INT", rb_str_new2(WEECHAT_HOOK_SIGNAL_INT)); rb_define_const(ruby_mWeechat, "WEECHAT_HOOK_SIGNAL_POINTER", rb_str_new2(WEECHAT_HOOK_SIGNAL_POINTER)); - rb_define_module_function (ruby_mWeechat, "register", &weechat_ruby_api_register, 7); - rb_define_module_function (ruby_mWeechat, "plugin_get_name", &weechat_ruby_api_plugin_get_name, 1); - rb_define_module_function (ruby_mWeechat, "charset_set", &weechat_ruby_api_charset_set, 1); - rb_define_module_function (ruby_mWeechat, "iconv_to_internal", &weechat_ruby_api_iconv_to_internal, 2); - rb_define_module_function (ruby_mWeechat, "iconv_from_internal", &weechat_ruby_api_iconv_from_internal, 2); - rb_define_module_function (ruby_mWeechat, "gettext", &weechat_ruby_api_gettext, 1); - rb_define_module_function (ruby_mWeechat, "ngettext", &weechat_ruby_api_ngettext, 3); - rb_define_module_function (ruby_mWeechat, "string_match", &weechat_ruby_api_string_match, 3); - rb_define_module_function (ruby_mWeechat, "string_has_highlight", &weechat_ruby_api_string_has_highlight, 2); - rb_define_module_function (ruby_mWeechat, "string_has_highlight_regex", &weechat_ruby_api_string_has_highlight_regex, 2); - rb_define_module_function (ruby_mWeechat, "string_mask_to_regex", &weechat_ruby_api_string_mask_to_regex, 1); - rb_define_module_function (ruby_mWeechat, "string_remove_color", &weechat_ruby_api_string_remove_color, 2); - rb_define_module_function (ruby_mWeechat, "string_is_command_char", &weechat_ruby_api_string_is_command_char, 1); - rb_define_module_function (ruby_mWeechat, "string_input_for_buffer", &weechat_ruby_api_string_input_for_buffer, 1); - rb_define_module_function (ruby_mWeechat, "mkdir_home", &weechat_ruby_api_mkdir_home, 2); - rb_define_module_function (ruby_mWeechat, "mkdir", &weechat_ruby_api_mkdir, 2); - rb_define_module_function (ruby_mWeechat, "mkdir_parents", &weechat_ruby_api_mkdir_parents, 2); - rb_define_module_function (ruby_mWeechat, "list_new", &weechat_ruby_api_list_new, 0); - rb_define_module_function (ruby_mWeechat, "list_add", &weechat_ruby_api_list_add, 4); - rb_define_module_function (ruby_mWeechat, "list_search", &weechat_ruby_api_list_search, 2); - rb_define_module_function (ruby_mWeechat, "list_search_pos", &weechat_ruby_api_list_search_pos, 2); - rb_define_module_function (ruby_mWeechat, "list_casesearch", &weechat_ruby_api_list_casesearch, 2); - rb_define_module_function (ruby_mWeechat, "list_casesearch_pos", &weechat_ruby_api_list_casesearch_pos, 2); - rb_define_module_function (ruby_mWeechat, "list_get", &weechat_ruby_api_list_get, 2); - rb_define_module_function (ruby_mWeechat, "list_set", &weechat_ruby_api_list_set, 2); - rb_define_module_function (ruby_mWeechat, "list_next", &weechat_ruby_api_list_next, 1); - rb_define_module_function (ruby_mWeechat, "list_prev", &weechat_ruby_api_list_prev, 1); - rb_define_module_function (ruby_mWeechat, "list_string", &weechat_ruby_api_list_string, 1); - rb_define_module_function (ruby_mWeechat, "list_size", &weechat_ruby_api_list_size, 1); - rb_define_module_function (ruby_mWeechat, "list_remove", &weechat_ruby_api_list_remove, 2); - rb_define_module_function (ruby_mWeechat, "list_remove_all", &weechat_ruby_api_list_remove_all, 1); - rb_define_module_function (ruby_mWeechat, "list_free", &weechat_ruby_api_list_free, 1); - rb_define_module_function (ruby_mWeechat, "config_new", &weechat_ruby_api_config_new, 3); - rb_define_module_function (ruby_mWeechat, "config_new_section", &weechat_ruby_api_config_new_section, 14); - rb_define_module_function (ruby_mWeechat, "config_search_section", &weechat_ruby_api_config_search_section, 2); - rb_define_module_function (ruby_mWeechat, "config_new_option", &weechat_ruby_api_config_new_option, 17); - rb_define_module_function (ruby_mWeechat, "config_search_option", &weechat_ruby_api_config_search_option, 3); - rb_define_module_function (ruby_mWeechat, "config_string_to_boolean", &weechat_ruby_api_config_string_to_boolean, 1); - rb_define_module_function (ruby_mWeechat, "config_option_reset", &weechat_ruby_api_config_option_reset, 2); - rb_define_module_function (ruby_mWeechat, "config_option_set", &weechat_ruby_api_config_option_set, 3); - rb_define_module_function (ruby_mWeechat, "config_option_set_null", &weechat_ruby_api_config_option_set_null, 2); - rb_define_module_function (ruby_mWeechat, "config_option_unset", &weechat_ruby_api_config_option_unset, 1); - rb_define_module_function (ruby_mWeechat, "config_option_rename", &weechat_ruby_api_config_option_rename, 2); - rb_define_module_function (ruby_mWeechat, "config_option_is_null", &weechat_ruby_api_config_option_is_null, 1); - rb_define_module_function (ruby_mWeechat, "config_option_default_is_null", &weechat_ruby_api_config_option_default_is_null, 1); - rb_define_module_function (ruby_mWeechat, "config_boolean", &weechat_ruby_api_config_boolean, 1); - rb_define_module_function (ruby_mWeechat, "config_boolean_default", &weechat_ruby_api_config_boolean_default, 1); - rb_define_module_function (ruby_mWeechat, "config_integer", &weechat_ruby_api_config_integer, 1); - rb_define_module_function (ruby_mWeechat, "config_integer_default", &weechat_ruby_api_config_integer_default, 1); - rb_define_module_function (ruby_mWeechat, "config_string", &weechat_ruby_api_config_string, 1); - rb_define_module_function (ruby_mWeechat, "config_string_default", &weechat_ruby_api_config_string_default, 1); - rb_define_module_function (ruby_mWeechat, "config_color", &weechat_ruby_api_config_color, 1); - rb_define_module_function (ruby_mWeechat, "config_color_default", &weechat_ruby_api_config_color_default, 1); - rb_define_module_function (ruby_mWeechat, "config_write_option", &weechat_ruby_api_config_write_option, 2); - rb_define_module_function (ruby_mWeechat, "config_write_line", &weechat_ruby_api_config_write_line, 3); - rb_define_module_function (ruby_mWeechat, "config_write", &weechat_ruby_api_config_write, 1); - rb_define_module_function (ruby_mWeechat, "config_read", &weechat_ruby_api_config_read, 1); - rb_define_module_function (ruby_mWeechat, "config_reload", &weechat_ruby_api_config_reload, 1); - rb_define_module_function (ruby_mWeechat, "config_option_free", &weechat_ruby_api_config_option_free, 1); - rb_define_module_function (ruby_mWeechat, "config_section_free_options", &weechat_ruby_api_config_section_free_options, 1); - rb_define_module_function (ruby_mWeechat, "config_section_free", &weechat_ruby_api_config_section_free, 1); - rb_define_module_function (ruby_mWeechat, "config_free", &weechat_ruby_api_config_free, 1); - rb_define_module_function (ruby_mWeechat, "config_get", &weechat_ruby_api_config_get, 1); - rb_define_module_function (ruby_mWeechat, "config_get_plugin", &weechat_ruby_api_config_get_plugin, 1); - rb_define_module_function (ruby_mWeechat, "config_is_set_plugin", &weechat_ruby_api_config_is_set_plugin, 1); - rb_define_module_function (ruby_mWeechat, "config_set_plugin", &weechat_ruby_api_config_set_plugin, 2); - rb_define_module_function (ruby_mWeechat, "config_set_desc_plugin", &weechat_ruby_api_config_set_desc_plugin, 2); - rb_define_module_function (ruby_mWeechat, "config_unset_plugin", &weechat_ruby_api_config_unset_plugin, 1); - rb_define_module_function (ruby_mWeechat, "key_bind", &weechat_ruby_api_key_bind, 2); - rb_define_module_function (ruby_mWeechat, "key_unbind", &weechat_ruby_api_key_unbind, 2); - rb_define_module_function (ruby_mWeechat, "prefix", &weechat_ruby_api_prefix, 1); - rb_define_module_function (ruby_mWeechat, "color", &weechat_ruby_api_color, 1); - rb_define_module_function (ruby_mWeechat, "print", &weechat_ruby_api_print, 2); - rb_define_module_function (ruby_mWeechat, "print_date_tags", &weechat_ruby_api_print_date_tags, 4); - rb_define_module_function (ruby_mWeechat, "print_y", &weechat_ruby_api_print_y, 3); - rb_define_module_function (ruby_mWeechat, "log_print", &weechat_ruby_api_log_print, 1); - rb_define_module_function (ruby_mWeechat, "hook_command", &weechat_ruby_api_hook_command, 7); - rb_define_module_function (ruby_mWeechat, "hook_command_run", &weechat_ruby_api_hook_command_run, 3); - rb_define_module_function (ruby_mWeechat, "hook_timer", &weechat_ruby_api_hook_timer, 5); - rb_define_module_function (ruby_mWeechat, "hook_fd", &weechat_ruby_api_hook_fd, 6); - rb_define_module_function (ruby_mWeechat, "hook_process", &weechat_ruby_api_hook_process, 4); - rb_define_module_function (ruby_mWeechat, "hook_connect", &weechat_ruby_api_hook_connect, 8); - rb_define_module_function (ruby_mWeechat, "hook_print", &weechat_ruby_api_hook_print, 6); - rb_define_module_function (ruby_mWeechat, "hook_signal", &weechat_ruby_api_hook_signal, 3); - rb_define_module_function (ruby_mWeechat, "hook_signal_send", &weechat_ruby_api_hook_signal_send, 3); - rb_define_module_function (ruby_mWeechat, "hook_hsignal", &weechat_ruby_api_hook_hsignal, 3); - rb_define_module_function (ruby_mWeechat, "hook_hsignal_send", &weechat_ruby_api_hook_hsignal_send, 2); - rb_define_module_function (ruby_mWeechat, "hook_config", &weechat_ruby_api_hook_config, 3); - rb_define_module_function (ruby_mWeechat, "hook_completion", &weechat_ruby_api_hook_completion, 4); - rb_define_module_function (ruby_mWeechat, "hook_completion_list_add", &weechat_ruby_api_hook_completion_list_add, 4); - rb_define_module_function (ruby_mWeechat, "hook_modifier", &weechat_ruby_api_hook_modifier, 3); - rb_define_module_function (ruby_mWeechat, "hook_modifier_exec", &weechat_ruby_api_hook_modifier_exec, 3); - rb_define_module_function (ruby_mWeechat, "hook_info", &weechat_ruby_api_hook_info, 5); - rb_define_module_function (ruby_mWeechat, "hook_info_hashtable", &weechat_ruby_api_hook_info_hashtable, 6); - rb_define_module_function (ruby_mWeechat, "hook_infolist", &weechat_ruby_api_hook_infolist, 6); - rb_define_module_function (ruby_mWeechat, "hook_focus", &weechat_ruby_api_hook_focus, 3); - rb_define_module_function (ruby_mWeechat, "unhook", &weechat_ruby_api_unhook, 1); - rb_define_module_function (ruby_mWeechat, "unhook_all", &weechat_ruby_api_unhook_all, 0); - rb_define_module_function (ruby_mWeechat, "buffer_new", &weechat_ruby_api_buffer_new, 5); - rb_define_module_function (ruby_mWeechat, "buffer_search", &weechat_ruby_api_buffer_search, 2); - rb_define_module_function (ruby_mWeechat, "buffer_search_main", &weechat_ruby_api_buffer_search_main, 0); - rb_define_module_function (ruby_mWeechat, "current_buffer", &weechat_ruby_api_current_buffer, 0); - rb_define_module_function (ruby_mWeechat, "buffer_clear", &weechat_ruby_api_buffer_clear, 1); - rb_define_module_function (ruby_mWeechat, "buffer_close", &weechat_ruby_api_buffer_close, 1); - rb_define_module_function (ruby_mWeechat, "buffer_merge", &weechat_ruby_api_buffer_merge, 2); - rb_define_module_function (ruby_mWeechat, "buffer_unmerge", &weechat_ruby_api_buffer_unmerge, 2); - rb_define_module_function (ruby_mWeechat, "buffer_get_integer", &weechat_ruby_api_buffer_get_integer, 2); - rb_define_module_function (ruby_mWeechat, "buffer_get_string", &weechat_ruby_api_buffer_get_string, 2); - rb_define_module_function (ruby_mWeechat, "buffer_get_pointer", &weechat_ruby_api_buffer_get_pointer, 2); - rb_define_module_function (ruby_mWeechat, "buffer_set", &weechat_ruby_api_buffer_set, 3); - rb_define_module_function (ruby_mWeechat, "buffer_string_replace_local_var", &weechat_ruby_api_buffer_string_replace_local_var, 2); - rb_define_module_function (ruby_mWeechat, "buffer_match_list", &weechat_ruby_api_buffer_match_list, 2); - rb_define_module_function (ruby_mWeechat, "current_window", &weechat_ruby_api_current_window, 0); - rb_define_module_function (ruby_mWeechat, "window_search_with_buffer", &weechat_ruby_api_window_search_with_buffer, 1); - rb_define_module_function (ruby_mWeechat, "window_get_integer", &weechat_ruby_api_window_get_integer, 2); - rb_define_module_function (ruby_mWeechat, "window_get_string", &weechat_ruby_api_window_get_string, 2); - rb_define_module_function (ruby_mWeechat, "window_get_pointer", &weechat_ruby_api_window_get_pointer, 2); - rb_define_module_function (ruby_mWeechat, "window_set_title", &weechat_ruby_api_window_set_title, 1); - rb_define_module_function (ruby_mWeechat, "nicklist_add_group", &weechat_ruby_api_nicklist_add_group, 5); - rb_define_module_function (ruby_mWeechat, "nicklist_search_group", &weechat_ruby_api_nicklist_search_group, 3); - rb_define_module_function (ruby_mWeechat, "nicklist_add_nick", &weechat_ruby_api_nicklist_add_nick, 7); - rb_define_module_function (ruby_mWeechat, "nicklist_search_nick", &weechat_ruby_api_nicklist_search_nick, 3); - rb_define_module_function (ruby_mWeechat, "nicklist_remove_group", &weechat_ruby_api_nicklist_remove_group, 2); - rb_define_module_function (ruby_mWeechat, "nicklist_remove_nick", &weechat_ruby_api_nicklist_remove_nick, 2); - rb_define_module_function (ruby_mWeechat, "nicklist_remove_all", &weechat_ruby_api_nicklist_remove_all, 1); - rb_define_module_function (ruby_mWeechat, "nicklist_group_get_integer", &weechat_ruby_api_nicklist_group_get_integer, 3); - rb_define_module_function (ruby_mWeechat, "nicklist_group_get_string", &weechat_ruby_api_nicklist_group_get_string, 3); - rb_define_module_function (ruby_mWeechat, "nicklist_group_get_pointer", &weechat_ruby_api_nicklist_group_get_pointer, 3); - rb_define_module_function (ruby_mWeechat, "nicklist_group_set", &weechat_ruby_api_nicklist_group_set, 4); - rb_define_module_function (ruby_mWeechat, "nicklist_nick_get_integer", &weechat_ruby_api_nicklist_nick_get_integer, 3); - rb_define_module_function (ruby_mWeechat, "nicklist_nick_get_string", &weechat_ruby_api_nicklist_nick_get_string, 3); - rb_define_module_function (ruby_mWeechat, "nicklist_nick_get_pointer", &weechat_ruby_api_nicklist_nick_get_pointer, 3); - rb_define_module_function (ruby_mWeechat, "nicklist_nick_set", &weechat_ruby_api_nicklist_nick_set, 4); - rb_define_module_function (ruby_mWeechat, "bar_item_search", &weechat_ruby_api_bar_item_search, 1); - rb_define_module_function (ruby_mWeechat, "bar_item_new", &weechat_ruby_api_bar_item_new, 3); - rb_define_module_function (ruby_mWeechat, "bar_item_update", &weechat_ruby_api_bar_item_update, 1); - rb_define_module_function (ruby_mWeechat, "bar_item_remove", &weechat_ruby_api_bar_item_remove, 1); - rb_define_module_function (ruby_mWeechat, "bar_search", &weechat_ruby_api_bar_search, 1); - rb_define_module_function (ruby_mWeechat, "bar_new", &weechat_ruby_api_bar_new, 15); - rb_define_module_function (ruby_mWeechat, "bar_set", &weechat_ruby_api_bar_set, 3); - rb_define_module_function (ruby_mWeechat, "bar_update", &weechat_ruby_api_bar_update, 1); - rb_define_module_function (ruby_mWeechat, "bar_remove", &weechat_ruby_api_bar_remove, 1); - rb_define_module_function (ruby_mWeechat, "command", &weechat_ruby_api_command, 2); - rb_define_module_function (ruby_mWeechat, "info_get", &weechat_ruby_api_info_get, 2); - rb_define_module_function (ruby_mWeechat, "info_get_hashtable", &weechat_ruby_api_info_get_hashtable, 2); - rb_define_module_function (ruby_mWeechat, "infolist_new", &weechat_ruby_api_infolist_new, 0); - rb_define_module_function (ruby_mWeechat, "infolist_new_item", &weechat_ruby_api_infolist_new_item, 1); - rb_define_module_function (ruby_mWeechat, "infolist_new_var_integer", &weechat_ruby_api_infolist_new_var_integer, 3); - rb_define_module_function (ruby_mWeechat, "infolist_new_var_string", &weechat_ruby_api_infolist_new_var_string, 3); - rb_define_module_function (ruby_mWeechat, "infolist_new_var_pointer", &weechat_ruby_api_infolist_new_var_pointer, 3); - rb_define_module_function (ruby_mWeechat, "infolist_new_var_time", &weechat_ruby_api_infolist_new_var_time, 3); - rb_define_module_function (ruby_mWeechat, "infolist_get", &weechat_ruby_api_infolist_get, 3); - rb_define_module_function (ruby_mWeechat, "infolist_next", &weechat_ruby_api_infolist_next, 1); - rb_define_module_function (ruby_mWeechat, "infolist_prev", &weechat_ruby_api_infolist_prev, 1); - rb_define_module_function (ruby_mWeechat, "infolist_reset_item_cursor", &weechat_ruby_api_infolist_reset_item_cursor, 1); - rb_define_module_function (ruby_mWeechat, "infolist_fields", &weechat_ruby_api_infolist_fields, 1); - rb_define_module_function (ruby_mWeechat, "infolist_integer", &weechat_ruby_api_infolist_integer, 2); - rb_define_module_function (ruby_mWeechat, "infolist_string", &weechat_ruby_api_infolist_string, 2); - rb_define_module_function (ruby_mWeechat, "infolist_pointer", &weechat_ruby_api_infolist_pointer, 2); - rb_define_module_function (ruby_mWeechat, "infolist_time", &weechat_ruby_api_infolist_time, 2); - rb_define_module_function (ruby_mWeechat, "infolist_free", &weechat_ruby_api_infolist_free, 1); - rb_define_module_function (ruby_mWeechat, "hdata_get", &weechat_ruby_api_hdata_get, 1); - rb_define_module_function (ruby_mWeechat, "hdata_get_var_offset", &weechat_ruby_api_hdata_get_var_offset, 2); - rb_define_module_function (ruby_mWeechat, "hdata_get_var_type_string", &weechat_ruby_api_hdata_get_var_type_string, 2); - rb_define_module_function (ruby_mWeechat, "hdata_get_var_hdata", &weechat_ruby_api_hdata_get_var_hdata, 2); - rb_define_module_function (ruby_mWeechat, "hdata_get_list", &weechat_ruby_api_hdata_get_list, 2); - rb_define_module_function (ruby_mWeechat, "hdata_check_pointer", &weechat_ruby_api_hdata_check_pointer, 3); - rb_define_module_function (ruby_mWeechat, "hdata_move", &weechat_ruby_api_hdata_move, 3); - rb_define_module_function (ruby_mWeechat, "hdata_char", &weechat_ruby_api_hdata_char, 3); - rb_define_module_function (ruby_mWeechat, "hdata_integer", &weechat_ruby_api_hdata_integer, 3); - rb_define_module_function (ruby_mWeechat, "hdata_long", &weechat_ruby_api_hdata_long, 3); - rb_define_module_function (ruby_mWeechat, "hdata_string", &weechat_ruby_api_hdata_string, 3); - rb_define_module_function (ruby_mWeechat, "hdata_pointer", &weechat_ruby_api_hdata_pointer, 3); - rb_define_module_function (ruby_mWeechat, "hdata_time", &weechat_ruby_api_hdata_time, 3); - rb_define_module_function (ruby_mWeechat, "hdata_get_string", &weechat_ruby_api_hdata_get_string, 2); - rb_define_module_function (ruby_mWeechat, "upgrade_new", &weechat_ruby_api_upgrade_new, 2); - rb_define_module_function (ruby_mWeechat, "upgrade_write_object", &weechat_ruby_api_upgrade_write_object, 3); - rb_define_module_function (ruby_mWeechat, "upgrade_read", &weechat_ruby_api_upgrade_read, 3); - rb_define_module_function (ruby_mWeechat, "upgrade_close", &weechat_ruby_api_upgrade_close, 1); + API_DEF_FUNC(register, 7); + API_DEF_FUNC(plugin_get_name, 1); + API_DEF_FUNC(charset_set, 1); + API_DEF_FUNC(iconv_to_internal, 2); + API_DEF_FUNC(iconv_from_internal, 2); + API_DEF_FUNC(gettext, 1); + API_DEF_FUNC(ngettext, 3); + API_DEF_FUNC(string_match, 3); + API_DEF_FUNC(string_has_highlight, 2); + API_DEF_FUNC(string_has_highlight_regex, 2); + API_DEF_FUNC(string_mask_to_regex, 1); + API_DEF_FUNC(string_remove_color, 2); + API_DEF_FUNC(string_is_command_char, 1); + API_DEF_FUNC(string_input_for_buffer, 1); + API_DEF_FUNC(mkdir_home, 2); + API_DEF_FUNC(mkdir, 2); + API_DEF_FUNC(mkdir_parents, 2); + API_DEF_FUNC(list_new, 0); + API_DEF_FUNC(list_add, 4); + API_DEF_FUNC(list_search, 2); + API_DEF_FUNC(list_search_pos, 2); + API_DEF_FUNC(list_casesearch, 2); + API_DEF_FUNC(list_casesearch_pos, 2); + API_DEF_FUNC(list_get, 2); + API_DEF_FUNC(list_set, 2); + API_DEF_FUNC(list_next, 1); + API_DEF_FUNC(list_prev, 1); + API_DEF_FUNC(list_string, 1); + API_DEF_FUNC(list_size, 1); + API_DEF_FUNC(list_remove, 2); + API_DEF_FUNC(list_remove_all, 1); + API_DEF_FUNC(list_free, 1); + API_DEF_FUNC(config_new, 3); + API_DEF_FUNC(config_new_section, 14); + API_DEF_FUNC(config_search_section, 2); + API_DEF_FUNC(config_new_option, 17); + API_DEF_FUNC(config_search_option, 3); + API_DEF_FUNC(config_string_to_boolean, 1); + API_DEF_FUNC(config_option_reset, 2); + API_DEF_FUNC(config_option_set, 3); + API_DEF_FUNC(config_option_set_null, 2); + API_DEF_FUNC(config_option_unset, 1); + API_DEF_FUNC(config_option_rename, 2); + API_DEF_FUNC(config_option_is_null, 1); + API_DEF_FUNC(config_option_default_is_null, 1); + API_DEF_FUNC(config_boolean, 1); + API_DEF_FUNC(config_boolean_default, 1); + API_DEF_FUNC(config_integer, 1); + API_DEF_FUNC(config_integer_default, 1); + API_DEF_FUNC(config_string, 1); + API_DEF_FUNC(config_string_default, 1); + API_DEF_FUNC(config_color, 1); + API_DEF_FUNC(config_color_default, 1); + API_DEF_FUNC(config_write_option, 2); + API_DEF_FUNC(config_write_line, 3); + API_DEF_FUNC(config_write, 1); + API_DEF_FUNC(config_read, 1); + API_DEF_FUNC(config_reload, 1); + API_DEF_FUNC(config_option_free, 1); + API_DEF_FUNC(config_section_free_options, 1); + API_DEF_FUNC(config_section_free, 1); + API_DEF_FUNC(config_free, 1); + API_DEF_FUNC(config_get, 1); + API_DEF_FUNC(config_get_plugin, 1); + API_DEF_FUNC(config_is_set_plugin, 1); + API_DEF_FUNC(config_set_plugin, 2); + API_DEF_FUNC(config_set_desc_plugin, 2); + API_DEF_FUNC(config_unset_plugin, 1); + API_DEF_FUNC(key_bind, 2); + API_DEF_FUNC(key_unbind, 2); + API_DEF_FUNC(prefix, 1); + API_DEF_FUNC(color, 1); + API_DEF_FUNC(print, 2); + API_DEF_FUNC(print_date_tags, 4); + API_DEF_FUNC(print_y, 3); + API_DEF_FUNC(log_print, 1); + API_DEF_FUNC(hook_command, 7); + API_DEF_FUNC(hook_command_run, 3); + API_DEF_FUNC(hook_timer, 5); + API_DEF_FUNC(hook_fd, 6); + API_DEF_FUNC(hook_process, 4); + API_DEF_FUNC(hook_connect, 8); + API_DEF_FUNC(hook_print, 6); + API_DEF_FUNC(hook_signal, 3); + API_DEF_FUNC(hook_signal_send, 3); + API_DEF_FUNC(hook_hsignal, 3); + API_DEF_FUNC(hook_hsignal_send, 2); + API_DEF_FUNC(hook_config, 3); + API_DEF_FUNC(hook_completion, 4); + API_DEF_FUNC(hook_completion_list_add, 4); + API_DEF_FUNC(hook_modifier, 3); + API_DEF_FUNC(hook_modifier_exec, 3); + API_DEF_FUNC(hook_info, 5); + API_DEF_FUNC(hook_info_hashtable, 6); + API_DEF_FUNC(hook_infolist, 6); + API_DEF_FUNC(hook_focus, 3); + API_DEF_FUNC(unhook, 1); + API_DEF_FUNC(unhook_all, 0); + API_DEF_FUNC(buffer_new, 5); + API_DEF_FUNC(buffer_search, 2); + API_DEF_FUNC(buffer_search_main, 0); + API_DEF_FUNC(current_buffer, 0); + API_DEF_FUNC(buffer_clear, 1); + API_DEF_FUNC(buffer_close, 1); + API_DEF_FUNC(buffer_merge, 2); + API_DEF_FUNC(buffer_unmerge, 2); + API_DEF_FUNC(buffer_get_integer, 2); + API_DEF_FUNC(buffer_get_string, 2); + API_DEF_FUNC(buffer_get_pointer, 2); + API_DEF_FUNC(buffer_set, 3); + API_DEF_FUNC(buffer_string_replace_local_var, 2); + API_DEF_FUNC(buffer_match_list, 2); + API_DEF_FUNC(current_window, 0); + API_DEF_FUNC(window_search_with_buffer, 1); + API_DEF_FUNC(window_get_integer, 2); + API_DEF_FUNC(window_get_string, 2); + API_DEF_FUNC(window_get_pointer, 2); + API_DEF_FUNC(window_set_title, 1); + API_DEF_FUNC(nicklist_add_group, 5); + API_DEF_FUNC(nicklist_search_group, 3); + API_DEF_FUNC(nicklist_add_nick, 7); + API_DEF_FUNC(nicklist_search_nick, 3); + API_DEF_FUNC(nicklist_remove_group, 2); + API_DEF_FUNC(nicklist_remove_nick, 2); + API_DEF_FUNC(nicklist_remove_all, 1); + API_DEF_FUNC(nicklist_group_get_integer, 3); + API_DEF_FUNC(nicklist_group_get_string, 3); + API_DEF_FUNC(nicklist_group_get_pointer, 3); + API_DEF_FUNC(nicklist_group_set, 4); + API_DEF_FUNC(nicklist_nick_get_integer, 3); + API_DEF_FUNC(nicklist_nick_get_string, 3); + API_DEF_FUNC(nicklist_nick_get_pointer, 3); + API_DEF_FUNC(nicklist_nick_set, 4); + API_DEF_FUNC(bar_item_search, 1); + API_DEF_FUNC(bar_item_new, 3); + API_DEF_FUNC(bar_item_update, 1); + API_DEF_FUNC(bar_item_remove, 1); + API_DEF_FUNC(bar_search, 1); + API_DEF_FUNC(bar_new, 15); + API_DEF_FUNC(bar_set, 3); + API_DEF_FUNC(bar_update, 1); + API_DEF_FUNC(bar_remove, 1); + API_DEF_FUNC(command, 2); + API_DEF_FUNC(info_get, 2); + API_DEF_FUNC(info_get_hashtable, 2); + API_DEF_FUNC(infolist_new, 0); + API_DEF_FUNC(infolist_new_item, 1); + API_DEF_FUNC(infolist_new_var_integer, 3); + API_DEF_FUNC(infolist_new_var_string, 3); + API_DEF_FUNC(infolist_new_var_pointer, 3); + API_DEF_FUNC(infolist_new_var_time, 3); + API_DEF_FUNC(infolist_get, 3); + API_DEF_FUNC(infolist_next, 1); + API_DEF_FUNC(infolist_prev, 1); + API_DEF_FUNC(infolist_reset_item_cursor, 1); + API_DEF_FUNC(infolist_fields, 1); + API_DEF_FUNC(infolist_integer, 2); + API_DEF_FUNC(infolist_string, 2); + API_DEF_FUNC(infolist_pointer, 2); + API_DEF_FUNC(infolist_time, 2); + API_DEF_FUNC(infolist_free, 1); + API_DEF_FUNC(hdata_get, 1); + API_DEF_FUNC(hdata_get_var_offset, 2); + API_DEF_FUNC(hdata_get_var_type_string, 2); + API_DEF_FUNC(hdata_get_var_hdata, 2); + API_DEF_FUNC(hdata_get_list, 2); + API_DEF_FUNC(hdata_check_pointer, 3); + API_DEF_FUNC(hdata_move, 3); + API_DEF_FUNC(hdata_char, 3); + API_DEF_FUNC(hdata_integer, 3); + API_DEF_FUNC(hdata_long, 3); + API_DEF_FUNC(hdata_string, 3); + API_DEF_FUNC(hdata_pointer, 3); + API_DEF_FUNC(hdata_time, 3); + API_DEF_FUNC(hdata_hashtable, 3); + API_DEF_FUNC(hdata_get_string, 2); + API_DEF_FUNC(upgrade_new, 2); + API_DEF_FUNC(upgrade_write_object, 3); + API_DEF_FUNC(upgrade_read, 3); + API_DEF_FUNC(upgrade_close, 1); } diff --git a/src/plugins/scripts/ruby/weechat-ruby.c b/src/plugins/scripts/ruby/weechat-ruby.c index 085617cd7..a76ea6530 100644 --- a/src/plugins/scripts/ruby/weechat-ruby.c +++ b/src/plugins/scripts/ruby/weechat-ruby.c @@ -110,8 +110,8 @@ typedef struct protect_call_arg { void weechat_ruby_hashtable_map_cb (void *data, struct t_hashtable *hashtable, - const void *key, - const void *value) + const char *key, + const char *value) { VALUE *hash; @@ -120,8 +120,7 @@ weechat_ruby_hashtable_map_cb (void *data, hash = (VALUE *)data; - rb_hash_aset (hash[0], rb_str_new2 ((char *)key), - rb_str_new2 ((char *)value)); + rb_hash_aset (hash[0], rb_str_new2 (key), rb_str_new2 (value)); } /* @@ -137,9 +136,9 @@ weechat_ruby_hashtable_to_hash (struct t_hashtable *hashtable) if (NIL_P (hash)) return Qnil; - weechat_hashtable_map (hashtable, - &weechat_ruby_hashtable_map_cb, - &hash); + weechat_hashtable_map_string (hashtable, + &weechat_ruby_hashtable_map_cb, + &hash); return hash; } diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c index 81b9cb5ce..cca006a06 100644 --- a/src/plugins/scripts/tcl/weechat-tcl-api.c +++ b/src/plugins/scripts/tcl/weechat-tcl-api.c @@ -194,6 +194,12 @@ return TCL_OK; \ } +#define API_DEF_FUNC(__name) \ + Tcl_CreateObjCommand (interp, "weechat::" #__name, \ + weechat_tcl_api_##__name, \ + (ClientData) NULL, \ + (Tcl_CmdDeleteProc*)NULL); + /* * weechat_tcl_api_register: startup function for all WeeChat Tcl scripts @@ -5977,6 +5983,36 @@ weechat_tcl_api_hdata_time (ClientData clientData, Tcl_Interp *interp, } /* + * weechat_tcl_api_hdata_hashtable: get hashtable value of a variable in + * structure using hdata + */ + +static int +weechat_tcl_api_hdata_hashtable (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) +{ + Tcl_Obj *objp, *result_dict; + char *hdata, *pointer, *name; + int i; + + API_FUNC(1, "hdata_hashtable", API_RETURN_EMPTY); + if (objc < 4) + API_WRONG_ARGS(API_RETURN_EMPTY); + + hdata = Tcl_GetStringFromObj (objv[1], &i); + pointer = Tcl_GetStringFromObj (objv[2], &i); + name = Tcl_GetStringFromObj (objv[3], &i); + + result_dict = weechat_tcl_hashtable_to_dict ( + interp, + weechat_hdata_hashtable (script_str2ptr (hdata), + script_str2ptr (pointer), + name)); + + API_RETURN_OBJ(result_dict); +} + +/* * weechat_tcl_api_hdata_get_string: get hdata property as string */ @@ -6263,360 +6299,183 @@ void weechat_tcl_api_init (Tcl_Interp *interp) Tcl_DecrRefCount (objp); /* interface functions */ - Tcl_CreateObjCommand (interp, "weechat::register", - weechat_tcl_api_register, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::plugin_get_name", - weechat_tcl_api_plugin_get_name, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::charset_set", - weechat_tcl_api_charset_set, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::iconv_to_internal", - weechat_tcl_api_iconv_to_internal, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::iconv_from_internal", - weechat_tcl_api_iconv_from_internal, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::gettext", - weechat_tcl_api_gettext, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::ngettext", - weechat_tcl_api_ngettext, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::string_match", - weechat_tcl_api_string_match, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::string_has_highlight", - weechat_tcl_api_string_has_highlight, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::string_has_highlight_regex", - weechat_tcl_api_string_has_highlight_regex, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::string_mask_to_regex", - weechat_tcl_api_string_mask_to_regex, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::string_remove_color", - weechat_tcl_api_string_remove_color, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::string_is_command_char", - weechat_tcl_api_string_is_command_char, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::string_input_for_buffer", - weechat_tcl_api_string_input_for_buffer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::mkdir_home", - weechat_tcl_api_mkdir_home, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::mkdir", - weechat_tcl_api_mkdir, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::mkdir_parents", - weechat_tcl_api_mkdir_parents, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::list_new", - weechat_tcl_api_list_new, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::list_add", - weechat_tcl_api_list_add, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::list_search", - weechat_tcl_api_list_search, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::list_search_pos", - weechat_tcl_api_list_search_pos, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::list_casesearch", - weechat_tcl_api_list_casesearch, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::list_casesearch_pos", - weechat_tcl_api_list_casesearch_pos, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::list_get", - weechat_tcl_api_list_get, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::list_set", - weechat_tcl_api_list_set, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::list_next", - weechat_tcl_api_list_next, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::list_prev", - weechat_tcl_api_list_prev, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::list_string", - weechat_tcl_api_list_string, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::list_size", - weechat_tcl_api_list_size, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::list_remove", - weechat_tcl_api_list_remove, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::list_remove_all", - weechat_tcl_api_list_remove_all, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::list_free", - weechat_tcl_api_list_free, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_new", - weechat_tcl_api_config_new, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_new_section", - weechat_tcl_api_config_new_section, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_search_section", - weechat_tcl_api_config_search_section, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_new_option", - weechat_tcl_api_config_new_option, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_search_option", - weechat_tcl_api_config_search_option, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_string_to_boolean", - weechat_tcl_api_config_string_to_boolean, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_option_reset", - weechat_tcl_api_config_option_reset, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_option_set", - weechat_tcl_api_config_option_set, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_option_set_null", - weechat_tcl_api_config_option_set_null, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_option_unset", - weechat_tcl_api_config_option_unset, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_option_rename", - weechat_tcl_api_config_option_rename, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_option_is_null", - weechat_tcl_api_config_option_is_null, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_option_default_is_null", - weechat_tcl_api_config_option_default_is_null, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_boolean", - weechat_tcl_api_config_boolean, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_boolean_default", - weechat_tcl_api_config_boolean_default, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_integer", - weechat_tcl_api_config_integer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_integer_default", - weechat_tcl_api_config_integer_default, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_string", - weechat_tcl_api_config_string, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_string_default", - weechat_tcl_api_config_string_default, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_color", - weechat_tcl_api_config_color, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_color_default", - weechat_tcl_api_config_color_default, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_write_option", - weechat_tcl_api_config_write_option, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_write_line", - weechat_tcl_api_config_write_line, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_write", - weechat_tcl_api_config_write, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_read", - weechat_tcl_api_config_read, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_reload", - weechat_tcl_api_config_reload, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_option_free", - weechat_tcl_api_config_option_free, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_section_free_options", - weechat_tcl_api_config_section_free_options, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_section_free", - weechat_tcl_api_config_section_free, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_free", - weechat_tcl_api_config_free, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_get", - weechat_tcl_api_config_get, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_get_plugin", - weechat_tcl_api_config_get_plugin, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_is_set_plugin", - weechat_tcl_api_config_is_set_plugin, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_set_plugin", - weechat_tcl_api_config_set_plugin, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_set_desc_plugin", - weechat_tcl_api_config_set_desc_plugin, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::config_unset_plugin", - weechat_tcl_api_config_unset_plugin, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::key_bind", - weechat_tcl_api_key_bind, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::key_unbind", - weechat_tcl_api_key_unbind, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::prefix", - weechat_tcl_api_prefix, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::color", - weechat_tcl_api_color, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::print", - weechat_tcl_api_print, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::print_date_tags", - weechat_tcl_api_print_date_tags, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::print_y", - weechat_tcl_api_print_y, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::log_print", - weechat_tcl_api_log_print, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hook_command", - weechat_tcl_api_hook_command, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hook_command_run", - weechat_tcl_api_hook_command_run, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hook_timer", - weechat_tcl_api_hook_timer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hook_fd", - weechat_tcl_api_hook_fd, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hook_process", - weechat_tcl_api_hook_process, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hook_connect", - weechat_tcl_api_hook_connect, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hook_print", - weechat_tcl_api_hook_print, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hook_signal", - weechat_tcl_api_hook_signal, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hook_signal_send", - weechat_tcl_api_hook_signal_send, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hook_hsignal", - weechat_tcl_api_hook_hsignal, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hook_hsignal_send", - weechat_tcl_api_hook_hsignal_send, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hook_config", - weechat_tcl_api_hook_config, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hook_completion", - weechat_tcl_api_hook_completion, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hook_completion_list_add", - weechat_tcl_api_hook_completion_list_add, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hook_modifier", - weechat_tcl_api_hook_modifier, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hook_modifier_exec", - weechat_tcl_api_hook_modifier_exec, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hook_info", - weechat_tcl_api_hook_info, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hook_info_hashtable", - weechat_tcl_api_hook_info_hashtable, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hook_infolist", - weechat_tcl_api_hook_infolist, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hook_focus", - weechat_tcl_api_hook_focus, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::unhook", - weechat_tcl_api_unhook, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::unhook_all", - weechat_tcl_api_unhook_all, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::buffer_new", - weechat_tcl_api_buffer_new, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::buffer_search", - weechat_tcl_api_buffer_search, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::buffer_search_main", - weechat_tcl_api_buffer_search_main, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::current_buffer", - weechat_tcl_api_current_buffer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::buffer_clear", - weechat_tcl_api_buffer_clear, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::buffer_close", - weechat_tcl_api_buffer_close, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::buffer_merge", - weechat_tcl_api_buffer_merge, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::buffer_unmerge", - weechat_tcl_api_buffer_unmerge, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::buffer_get_integer", - weechat_tcl_api_buffer_get_integer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::buffer_get_string", - weechat_tcl_api_buffer_get_string, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::buffer_get_pointer", - weechat_tcl_api_buffer_get_pointer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::buffer_set", - weechat_tcl_api_buffer_set, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::buffer_string_replace_local_var", - weechat_tcl_api_buffer_string_replace_local_var, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::buffer_match_list", - weechat_tcl_api_buffer_match_list, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::current_window", - weechat_tcl_api_current_window, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::window_search_with_buffer", - weechat_tcl_api_window_search_with_buffer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::window_get_integer", - weechat_tcl_api_window_get_integer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::window_get_string", - weechat_tcl_api_window_get_string, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::window_get_pointer", - weechat_tcl_api_window_get_pointer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::window_set_title", - weechat_tcl_api_window_set_title, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::nicklist_add_group", - weechat_tcl_api_nicklist_add_group, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::nicklist_search_group", - weechat_tcl_api_nicklist_search_group, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::nicklist_add_nick", - weechat_tcl_api_nicklist_add_nick, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::nicklist_search_nick", - weechat_tcl_api_nicklist_search_nick, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::nicklist_remove_group", - weechat_tcl_api_nicklist_remove_group, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::nicklist_remove_nick", - weechat_tcl_api_nicklist_remove_nick, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::nicklist_remove_all", - weechat_tcl_api_nicklist_remove_all, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::nicklist_group_get_integer", - weechat_tcl_api_nicklist_group_get_integer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::nicklist_group_get_string", - weechat_tcl_api_nicklist_group_get_string, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::nicklist_group_get_pointer", - weechat_tcl_api_nicklist_group_get_pointer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::nicklist_group_set", - weechat_tcl_api_nicklist_group_set, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::nicklist_nick_get_integer", - weechat_tcl_api_nicklist_nick_get_integer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::nicklist_nick_get_string", - weechat_tcl_api_nicklist_nick_get_string, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::nicklist_nick_get_pointer", - weechat_tcl_api_nicklist_nick_get_pointer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::nicklist_nick_set", - weechat_tcl_api_nicklist_nick_set, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::bar_item_search", - weechat_tcl_api_bar_item_search, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::bar_item_new", - weechat_tcl_api_bar_item_new, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::bar_item_update", - weechat_tcl_api_bar_item_update, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::bar_item_remove", - weechat_tcl_api_bar_item_remove, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::bar_search", - weechat_tcl_api_bar_search, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::bar_new", - weechat_tcl_api_bar_new, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::bar_set", - weechat_tcl_api_bar_set, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::bar_update", - weechat_tcl_api_bar_update, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::bar_remove", - weechat_tcl_api_bar_remove, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::command", - weechat_tcl_api_command, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::info_get", - weechat_tcl_api_info_get, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::info_get_hashtable", - weechat_tcl_api_info_get_hashtable, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::infolist_new", - weechat_tcl_api_infolist_new, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::infolist_new_item", - weechat_tcl_api_infolist_new_item, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::infolist_new_var_integer", - weechat_tcl_api_infolist_new_var_integer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::infolist_new_var_string", - weechat_tcl_api_infolist_new_var_string, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::infolist_new_var_pointer", - weechat_tcl_api_infolist_new_var_pointer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::infolist_new_var_time", - weechat_tcl_api_infolist_new_var_time, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::infolist_get", - weechat_tcl_api_infolist_get, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::infolist_next", - weechat_tcl_api_infolist_next, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::infolist_prev", - weechat_tcl_api_infolist_prev, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::infolist_reset_item_cursor", - weechat_tcl_api_infolist_reset_item_cursor, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::infolist_fields", - weechat_tcl_api_infolist_fields, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::infolist_integer", - weechat_tcl_api_infolist_integer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::infolist_string", - weechat_tcl_api_infolist_string, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::infolist_pointer", - weechat_tcl_api_infolist_pointer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::infolist_time", - weechat_tcl_api_infolist_time, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::infolist_free", - weechat_tcl_api_infolist_free, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hdata_get", - weechat_tcl_api_hdata_get, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hdata_get_var_offset", - weechat_tcl_api_hdata_get_var_offset, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hdata_get_var_type_string", - weechat_tcl_api_hdata_get_var_type_string, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hdata_get_var_hdata", - weechat_tcl_api_hdata_get_var_hdata, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hdata_get_list", - weechat_tcl_api_hdata_get_list, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hdata_check_pointer", - weechat_tcl_api_hdata_check_pointer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hdata_move", - weechat_tcl_api_hdata_move, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hdata_integer", - weechat_tcl_api_hdata_integer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hdata_long", - weechat_tcl_api_hdata_long, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hdata_string", - weechat_tcl_api_hdata_string, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hdata_pointer", - weechat_tcl_api_hdata_pointer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hdata_time", - weechat_tcl_api_hdata_time, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::hdata_get_string", - weechat_tcl_api_hdata_get_string, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::upgrade_new", - weechat_tcl_api_upgrade_new, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::upgrade_write_object", - weechat_tcl_api_upgrade_write_object, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::upgrade_read", - weechat_tcl_api_upgrade_read, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); - Tcl_CreateObjCommand (interp, "weechat::upgrade_close", - weechat_tcl_api_upgrade_close, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); + API_DEF_FUNC(register); + API_DEF_FUNC(plugin_get_name); + API_DEF_FUNC(charset_set); + API_DEF_FUNC(iconv_to_internal); + API_DEF_FUNC(iconv_from_internal); + API_DEF_FUNC(gettext); + API_DEF_FUNC(ngettext); + API_DEF_FUNC(string_match); + API_DEF_FUNC(string_has_highlight); + API_DEF_FUNC(string_has_highlight_regex); + API_DEF_FUNC(string_mask_to_regex); + API_DEF_FUNC(string_remove_color); + API_DEF_FUNC(string_is_command_char); + API_DEF_FUNC(string_input_for_buffer); + API_DEF_FUNC(mkdir_home); + API_DEF_FUNC(mkdir); + API_DEF_FUNC(mkdir_parents); + API_DEF_FUNC(list_new); + API_DEF_FUNC(list_add); + API_DEF_FUNC(list_search); + API_DEF_FUNC(list_search_pos); + API_DEF_FUNC(list_casesearch); + API_DEF_FUNC(list_casesearch_pos); + API_DEF_FUNC(list_get); + API_DEF_FUNC(list_set); + API_DEF_FUNC(list_next); + API_DEF_FUNC(list_prev); + API_DEF_FUNC(list_string); + API_DEF_FUNC(list_size); + API_DEF_FUNC(list_remove); + API_DEF_FUNC(list_remove_all); + API_DEF_FUNC(list_free); + API_DEF_FUNC(config_new); + API_DEF_FUNC(config_new_section); + API_DEF_FUNC(config_search_section); + API_DEF_FUNC(config_new_option); + API_DEF_FUNC(config_search_option); + API_DEF_FUNC(config_string_to_boolean); + API_DEF_FUNC(config_option_reset); + API_DEF_FUNC(config_option_set); + API_DEF_FUNC(config_option_set_null); + API_DEF_FUNC(config_option_unset); + API_DEF_FUNC(config_option_rename); + API_DEF_FUNC(config_option_is_null); + API_DEF_FUNC(config_option_default_is_null); + API_DEF_FUNC(config_boolean); + API_DEF_FUNC(config_boolean_default); + API_DEF_FUNC(config_integer); + API_DEF_FUNC(config_integer_default); + API_DEF_FUNC(config_string); + API_DEF_FUNC(config_string_default); + API_DEF_FUNC(config_color); + API_DEF_FUNC(config_color_default); + API_DEF_FUNC(config_write_option); + API_DEF_FUNC(config_write_line); + API_DEF_FUNC(config_write); + API_DEF_FUNC(config_read); + API_DEF_FUNC(config_reload); + API_DEF_FUNC(config_option_free); + API_DEF_FUNC(config_section_free_options); + API_DEF_FUNC(config_section_free); + API_DEF_FUNC(config_free); + API_DEF_FUNC(config_get); + API_DEF_FUNC(config_get_plugin); + API_DEF_FUNC(config_is_set_plugin); + API_DEF_FUNC(config_set_plugin); + API_DEF_FUNC(config_set_desc_plugin); + API_DEF_FUNC(config_unset_plugin); + API_DEF_FUNC(key_bind); + API_DEF_FUNC(key_unbind); + API_DEF_FUNC(prefix); + API_DEF_FUNC(color); + API_DEF_FUNC(print); + API_DEF_FUNC(print_date_tags); + API_DEF_FUNC(print_y); + API_DEF_FUNC(log_print); + API_DEF_FUNC(hook_command); + API_DEF_FUNC(hook_command_run); + API_DEF_FUNC(hook_timer); + API_DEF_FUNC(hook_fd); + API_DEF_FUNC(hook_process); + API_DEF_FUNC(hook_connect); + API_DEF_FUNC(hook_print); + API_DEF_FUNC(hook_signal); + API_DEF_FUNC(hook_signal_send); + API_DEF_FUNC(hook_hsignal); + API_DEF_FUNC(hook_hsignal_send); + API_DEF_FUNC(hook_config); + API_DEF_FUNC(hook_completion); + API_DEF_FUNC(hook_completion_list_add); + API_DEF_FUNC(hook_modifier); + API_DEF_FUNC(hook_modifier_exec); + API_DEF_FUNC(hook_info); + API_DEF_FUNC(hook_info_hashtable); + API_DEF_FUNC(hook_infolist); + API_DEF_FUNC(hook_focus); + API_DEF_FUNC(unhook); + API_DEF_FUNC(unhook_all); + API_DEF_FUNC(buffer_new); + API_DEF_FUNC(buffer_search); + API_DEF_FUNC(buffer_search_main); + API_DEF_FUNC(current_buffer); + API_DEF_FUNC(buffer_clear); + API_DEF_FUNC(buffer_close); + API_DEF_FUNC(buffer_merge); + API_DEF_FUNC(buffer_unmerge); + API_DEF_FUNC(buffer_get_integer); + API_DEF_FUNC(buffer_get_string); + API_DEF_FUNC(buffer_get_pointer); + API_DEF_FUNC(buffer_set); + API_DEF_FUNC(buffer_string_replace_local_var); + API_DEF_FUNC(buffer_match_list); + API_DEF_FUNC(current_window); + API_DEF_FUNC(window_search_with_buffer); + API_DEF_FUNC(window_get_integer); + API_DEF_FUNC(window_get_string); + API_DEF_FUNC(window_get_pointer); + API_DEF_FUNC(window_set_title); + API_DEF_FUNC(nicklist_add_group); + API_DEF_FUNC(nicklist_search_group); + API_DEF_FUNC(nicklist_add_nick); + API_DEF_FUNC(nicklist_search_nick); + API_DEF_FUNC(nicklist_remove_group); + API_DEF_FUNC(nicklist_remove_nick); + API_DEF_FUNC(nicklist_remove_all); + API_DEF_FUNC(nicklist_group_get_integer); + API_DEF_FUNC(nicklist_group_get_string); + API_DEF_FUNC(nicklist_group_get_pointer); + API_DEF_FUNC(nicklist_group_set); + API_DEF_FUNC(nicklist_nick_get_integer); + API_DEF_FUNC(nicklist_nick_get_string); + API_DEF_FUNC(nicklist_nick_get_pointer); + API_DEF_FUNC(nicklist_nick_set); + API_DEF_FUNC(bar_item_search); + API_DEF_FUNC(bar_item_new); + API_DEF_FUNC(bar_item_update); + API_DEF_FUNC(bar_item_remove); + API_DEF_FUNC(bar_search); + API_DEF_FUNC(bar_new); + API_DEF_FUNC(bar_set); + API_DEF_FUNC(bar_update); + API_DEF_FUNC(bar_remove); + API_DEF_FUNC(command); + API_DEF_FUNC(info_get); + API_DEF_FUNC(info_get_hashtable); + API_DEF_FUNC(infolist_new); + API_DEF_FUNC(infolist_new_item); + API_DEF_FUNC(infolist_new_var_integer); + API_DEF_FUNC(infolist_new_var_string); + API_DEF_FUNC(infolist_new_var_pointer); + API_DEF_FUNC(infolist_new_var_time); + API_DEF_FUNC(infolist_get); + API_DEF_FUNC(infolist_next); + API_DEF_FUNC(infolist_prev); + API_DEF_FUNC(infolist_reset_item_cursor); + API_DEF_FUNC(infolist_fields); + API_DEF_FUNC(infolist_integer); + API_DEF_FUNC(infolist_string); + API_DEF_FUNC(infolist_pointer); + API_DEF_FUNC(infolist_time); + API_DEF_FUNC(infolist_free); + API_DEF_FUNC(hdata_get); + API_DEF_FUNC(hdata_get_var_offset); + API_DEF_FUNC(hdata_get_var_type_string); + API_DEF_FUNC(hdata_get_var_hdata); + API_DEF_FUNC(hdata_get_list); + API_DEF_FUNC(hdata_check_pointer); + API_DEF_FUNC(hdata_move); + API_DEF_FUNC(hdata_integer); + API_DEF_FUNC(hdata_long); + API_DEF_FUNC(hdata_string); + API_DEF_FUNC(hdata_pointer); + API_DEF_FUNC(hdata_time); + API_DEF_FUNC(hdata_hashtable); + API_DEF_FUNC(hdata_get_string); + API_DEF_FUNC(upgrade_new); + API_DEF_FUNC(upgrade_write_object); + API_DEF_FUNC(upgrade_read); + API_DEF_FUNC(upgrade_close); } diff --git a/src/plugins/scripts/tcl/weechat-tcl.c b/src/plugins/scripts/tcl/weechat-tcl.c index 9c1b0717a..8adabfc1a 100644 --- a/src/plugins/scripts/tcl/weechat-tcl.c +++ b/src/plugins/scripts/tcl/weechat-tcl.c @@ -79,8 +79,8 @@ Tcl_Interp* cinterp; void weechat_tcl_hashtable_map_cb (void *data, struct t_hashtable *hashtable, - const void *key, - const void *value) + const char *key, + const char *value) { void **data_array; Tcl_Interp *interp; @@ -94,8 +94,8 @@ weechat_tcl_hashtable_map_cb (void *data, dict = data_array[1]; Tcl_DictObjPut (interp, dict, - Tcl_NewStringObj ((char *)key, -1), - Tcl_NewStringObj ((char *)value, -1)); + Tcl_NewStringObj (key, -1), + Tcl_NewStringObj (value, -1)); } /* @@ -116,9 +116,9 @@ weechat_tcl_hashtable_to_dict (Tcl_Interp *interp, data[0] = interp; data[1] = dict; - weechat_hashtable_map (hashtable, - &weechat_tcl_hashtable_map_cb, - data); + weechat_hashtable_map_string (hashtable, + &weechat_tcl_hashtable_map_cb, + data); return dict; } diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index 058d70106..71ee4653b 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -46,7 +46,7 @@ struct timeval; */ /* API version (used to check that plugin has same API and can be loaded) */ -#define WEECHAT_PLUGIN_API_VERSION "20111217-01" +#define WEECHAT_PLUGIN_API_VERSION "20111219-01" /* macros for defining plugin infos */ #define WEECHAT_PLUGIN_NAME(__name) \ @@ -111,6 +111,7 @@ struct timeval; #define WEECHAT_HDATA_STRING 4 #define WEECHAT_HDATA_POINTER 5 #define WEECHAT_HDATA_TIME 6 +#define WEECHAT_HDATA_HASHTABLE 7 /* buffer hotlist */ #define WEECHAT_HOTLIST_LOW "0" @@ -323,6 +324,12 @@ struct t_weechat_plugin const void *key, const void *value), void *callback_map_data); + void (*hashtable_map_string) (struct t_hashtable *hashtable, + void (*callback_map) (void *data, + struct t_hashtable *hashtable, + const char *key, + const char *value), + void *callback_map_data); int (*hashtable_get_integer) (struct t_hashtable *hashtable, const char *property); const char *(*hashtable_get_string) (struct t_hashtable *hashtable, @@ -842,6 +849,8 @@ struct t_weechat_plugin const char *name); time_t (*hdata_time) (struct t_hdata *hdata, void *pointer, const char *name); + struct t_hashtable *(*hdata_hashtable) (struct t_hdata *hdata, + void *pointer, const char *name); const char *(*hdata_get_string) (struct t_hdata *hdata, const char *property); @@ -1063,6 +1072,10 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin); weechat_plugin->hashtable_has_key(__hashtable, __key) #define weechat_hashtable_map(__hashtable, __cb_map, __cb_map_data) \ weechat_plugin->hashtable_map(__hashtable, __cb_map, __cb_map_data) +#define weechat_hashtable_map_string(__hashtable, __cb_map, \ + __cb_map_data) \ + weechat_plugin->hashtable_map_string(__hashtable, __cb_map, \ + __cb_map_data) #define weechat_hashtable_get_integer(__hashtable, __property) \ weechat_plugin->hashtable_get_integer(__hashtable, __property) #define weechat_hashtable_get_string(__hashtable, __property) \ @@ -1591,6 +1604,8 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin); weechat_plugin->hdata_pointer(__hdata, __pointer, __name) #define weechat_hdata_time(__hdata, __pointer, __name) \ weechat_plugin->hdata_time(__hdata, __pointer, __name) +#define weechat_hdata_hashtable(__hdata, __pointer, __name) \ + weechat_plugin->hdata_hashtable(__hdata, __pointer, __name) #define weechat_hdata_get_string(__hdata, __property) \ weechat_plugin->hdata_get_string(__hdata, __property) |