api: add new function hdata_check_pointer

v2.8-utf8proc
Sebastien Helleu 2011-12-17 17:03:39 +01:00
parent dc8807a417
commit bd3f554e02
19 changed files with 503 additions and 82 deletions

View File

@ -1,7 +1,7 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
v0.3.7-dev, 2011-12-16
v0.3.7-dev, 2011-12-17
Version 0.3.7 (under dev!)
@ -35,8 +35,8 @@ Version 0.3.7 (under dev!)
* core: fix compilation error with "pid_t" on Mac OS X (bug #34639)
* core: enable background process under Cygwin to connect to servers, fix
reconnection problem (bug #34626)
* api: add new functions strcasecmp_range, strncasecmp_range, hdata_char and
nicklist_get_next_item
* api: add new functions strcasecmp_range, strncasecmp_range,
hdata_check_pointer, hdata_char 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)

View File

@ -356,8 +356,9 @@ Liste der Skript API Funktionen:
infolist_time, infolist_free
| hdata |
hdata_get, hdata_get_var_offset, hdata_get_var_type_string,
hdata_get_var_hdata, hdata_get_list, hdata_move, hdata_integer, hdata_long,
hdata_string, hdata_pointer, hdata_time, hdata_get_string
hdata_get_var_hdata, hdata_get_list, hdata_check_pointer, hdata_move,
hdata_char, hdata_integer, hdata_long, hdata_string, hdata_pointer,
hdata_time, hdata_get_string
| Upgrade |
upgrade_new, upgrade_write_object, upgrade_read, upgrade_close
|========================================

View File

@ -12324,8 +12324,16 @@ C example:
int offset = weechat_hdata_get_var_offset (hdata, "name");
----------------------------------------
[NOTE]
This function is not available in scripting API.
Script (Python):
[source,python]
----------------------------------------
# prototype
offset = weechat.hdata_get_var_offset(hdata, name)
# example
offset = weechat.hdata_get(hdata, "name")
----------------------------------------
weechat_hdata_get_var_type
^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -12585,6 +12593,65 @@ hdata = weechat.hdata_get("buffer")
buffers = weechat.hdata_get_list(hdata, "gui_buffers")
----------------------------------------
weechat_hdata_check_pointer
^^^^^^^^^^^^^^^^^^^^^^^^^^^
_New in version 0.3.7._
Check if a pointer is valid for a hdata and a list pointer.
Prototype:
[source,C]
----------------------------------------
int weechat_hdata_check_pointer (struct t_hdata *hdata, void *list, void *pointer);
----------------------------------------
Arguments:
* 'hdata': hdata pointer
* 'list': list pointer
* 'pointer': pointer to check
Return value:
* 1 if pointer is in list, 0 if not found
C example:
[source,C]
----------------------------------------
/* check if a buffer pointer is valid */
struct t_hdata *hdata = weechat_hdata_get ("buffer");
if (weechat_hdata_check_pointer (hdata,
weechat_hdata_get_list (hdata, "gui_buffers"),
ptr_buffer))
{
/* valid pointer */
}
else
{
/* invalid pointer */
}
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototype
rc = weechat.hdata_check_pointer(hdata, list, pointer)
# example
hdata = weechat.hdata_get("buffer")
if weechat.hdata_check_pointer(hdata, weechat.hdata_get_list(hdata, "gui_buffers"), ptr_buffer):
# valid pointer
# ...
else:
# invalid pointer
# ...
----------------------------------------
weechat_hdata_move
^^^^^^^^^^^^^^^^^^

View File

@ -347,8 +347,9 @@ List of functions in script API:
infolist_time, infolist_free
| hdata |
hdata_get, hdata_get_var_offset, hdata_get_var_type_string,
hdata_get_var_hdata, hdata_get_list, hdata_move, hdata_integer, hdata_long,
hdata_string, hdata_pointer, hdata_time, hdata_get_string
hdata_get_var_hdata, hdata_get_list, hdata_check_pointer, hdata_move,
hdata_char, hdata_integer, hdata_long, hdata_string, hdata_pointer,
hdata_time, hdata_get_string
| upgrade |
upgrade_new, upgrade_write_object, upgrade_read, upgrade_close
|========================================

View File

@ -1141,10 +1141,10 @@ Paramètres :
* 'separators' : délimiteurs utilisés pour le découpage
* 'keep_eol' : si différent de 0, alors chaque paramètre contiendra toutes les
chaînes jusqu'à la fin de la ligne (voir exemple ci-dessous)
** 0: chaque chaîne contiendra un mot
** 1: chaque chaîne contiendra toute la chaîne jusqu'à la fin de la ligne (voir
** 0 : chaque chaîne contiendra un mot
** 1 : chaque chaîne contiendra toute la chaîne jusqu'à la fin de la ligne (voir
exemple ci-dessous)
** 2: comme 1, mais ne supprime pas les séparateurs en fin de chaîne avant le
** 2 : comme 1, mais ne supprime pas les séparateurs en fin de chaîne avant le
découpage (_nouveau dans la version 0.3.6_)
* 'num_items_max' : nombre maximum de chaînes à créer (0 = pas de limite)
* 'num_items' : pointeur vers un entier qui contiendra le nombre de chaînes
@ -6776,7 +6776,7 @@ toujours).
[NOTE]
La taille du tampon pour l'envoi des données au "callback" est de 64 Ko (il y a
2 tampons: un pour stdout et un pour stderr).
2 tampons : un pour stdout et un pour stderr).
Si la sortie du processus fils (stdout ou stderr) est plus longue que 64 Ko, le
"callback" sera appelé plusieurs fois.
@ -8072,7 +8072,7 @@ my_completion_cb (void *data, const char *completion_item,
}
----------------------------------------
Script (Python):
Script (Python) :
[source,python]
----------------------------------------
@ -8572,7 +8572,7 @@ weechat_hook_hdata
Accroche un hdata : le "callback" retournera un pointeur vers le hdata demandé.
Prototype:
Prototype :
[source,C]
----------------------------------------
@ -8712,7 +8712,7 @@ relâché). +
^(4)^ Il s'agit de la date lorsque WeeChat ajoute la ligne dans le tampon
(supérieure ou égale à "_chat_line_date").
Informations additionnelles pour l'objet de barre "buffer_nicklist":
Informations additionnelles pour l'objet de barre "buffer_nicklist" :
[width="70%",cols="3m,3,8",options="header"]
|========================================
@ -9219,7 +9219,7 @@ Paramètres :
** 'number' : numéro du tampon (commence à 1)
** 'layout_number' : numéro du tampon sauvegardé dans le "layout"
** 'layout_number_merge_order' : ordre du tampon mélangé pour le "layout"
** 'short_name_is_set': 1 si le nom court est défini, 0 si non défini
** 'short_name_is_set' : 1 si le nom court est défini, 0 si non défini
** 'type' : type de tampon (0 : formaté, 1 : contenu libre)
** 'notify' : niveau de notification du tampon
** 'num_displayed' : nombre de fenêtres affichant ce tampon
@ -9760,7 +9760,7 @@ struct t_gui_window *weechat_window_search_with_buffer (struct t_gui_buffer *buf
Paramètre :
* 'buffer': buffer pointer
* 'buffer' : pointeur vers le tampon
Valeur de retour :
@ -9776,7 +9776,7 @@ weechat_printf (NULL,
weechat_window_search_with_buffer (weechat_buffer_search_main ()));
----------------------------------------
Script (Python):
Script (Python) :
[source,python]
----------------------------------------
@ -12491,7 +12491,7 @@ Exemple en C :
struct t_hdata *hdata = weechat_hdata_get ("irc_server");
----------------------------------------
Script (Python):
Script (Python) :
[source,python]
----------------------------------------
@ -12532,8 +12532,16 @@ Exemple en C :
int offset = weechat_hdata_get_var_offset (hdata, "name");
----------------------------------------
[NOTE]
Cette fonction n'est pas disponible dans l'API script.
Script (Python) :
[source,python]
----------------------------------------
# prototype
offset = weechat.hdata_get_var_offset(hdata, name)
# exemple
offset = weechat.hdata_get(hdata, "name")
----------------------------------------
weechat_hdata_get_var_type
^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -12625,7 +12633,7 @@ Exemple en C :
weechat_printf (NULL, "type = %s", weechat_hdata_get_var_type_string (hdata, "name"));
----------------------------------------
Script (Python):
Script (Python) :
[source,python]
----------------------------------------
@ -12666,7 +12674,7 @@ Exemple en C :
weechat_printf (NULL, "hdata = %s", weechat_hdata_get_var_hdata (hdata, "name"));
----------------------------------------
Script (Python):
Script (Python) :
[source,python]
----------------------------------------
@ -12782,7 +12790,7 @@ struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *buffers = weechat_hdata_get_list (hdata, "gui_buffers");
----------------------------------------
Script (Python):
Script (Python) :
[source,python]
----------------------------------------
@ -12794,6 +12802,65 @@ hdata = weechat.hdata_get("buffer")
buffers = weechat.hdata_get_list(hdata, "gui_buffers")
----------------------------------------
weechat_hdata_check_pointer
^^^^^^^^^^^^^^^^^^^^^^^^^^^
_Nouveau dans la version 0.3.7._
Vérifie si un pointeur est valide pour un hdata et un pointeur de liste.
Prototype :
[source,C]
----------------------------------------
int weechat_hdata_check_pointer (struct t_hdata *hdata, void *list, void *pointer);
----------------------------------------
Paramètres :
* 'hdata' : pointeur vers le hdata
* 'list' : pointeur vers une liste
* 'pointer' : pointeur à vérifier
Valeur de retour :
* 1 si le pointeur est dans la liste, 0 si non trouvé
Exemple en C :
[source,C]
----------------------------------------
/* vérifie si le pointeur vers le tampon est valide */
struct t_hdata *hdata = weechat_hdata_get ("buffer");
if (weechat_hdata_check_pointer (hdata,
weechat_hdata_get_list (hdata, "gui_buffers"),
ptr_buffer))
{
/* pointeur valide */
}
else
{
/* pointeur invalide */
}
----------------------------------------
Script (Python) :
[source,python]
----------------------------------------
# prototype
rc = weechat.hdata_check_pointer(hdata, list, pointer)
# exemple
hdata = weechat.hdata_get("buffer")
if weechat.hdata_check_pointer(hdata, weechat.hdata_get_list(hdata, "gui_buffers"), ptr_buffer):
# pointeur valide
# ...
else:
# pointeur invalide
# ...
----------------------------------------
weechat_hdata_move
^^^^^^^^^^^^^^^^^^
@ -12834,7 +12901,7 @@ if (buffer)
buffer = weechat_hdata_move (hdata, buffer, -1);
----------------------------------------
Script (Python):
Script (Python) :
[source,python]
----------------------------------------
@ -12885,7 +12952,7 @@ Exemple en C :
weechat_printf (NULL, "letter = %c", weechat_hdata_char (hdata, pointer, "letter"));
----------------------------------------
Script (Python):
Script (Python) :
[source,python]
----------------------------------------
@ -12930,7 +12997,7 @@ struct t_gui_buffer *buffer = weechat_buffer_search_main ();
weechat_printf (NULL, "number = %d", weechat_hdata_integer (hdata, buffer, "number"));
----------------------------------------
Script (Python):
Script (Python) :
[source,python]
----------------------------------------
@ -12975,7 +13042,7 @@ Exemple en C :
weechat_printf (NULL, "longvar = %ld", weechat_hdata_long (hdata, pointer, "longvar"));
----------------------------------------
Script (Python):
Script (Python) :
[source,python]
----------------------------------------
@ -13020,7 +13087,7 @@ struct t_gui_buffer *buffer = weechat_buffer_search_main ();
weechat_printf (NULL, "name = %s", weechat_hdata_string (hdata, buffer, "name"));
----------------------------------------
Script (Python):
Script (Python) :
[source,python]
----------------------------------------
@ -13067,7 +13134,7 @@ struct t_gui_buffer *buffer = weechat_buffer_search_main ();
weechat_printf (NULL, "lines = %lx", weechat_hdata_pointer (hdata, buffer, "lines"));
----------------------------------------
Script (Python):
Script (Python) :
[source,python]
----------------------------------------
@ -13130,7 +13197,7 @@ if (ptr)
}
----------------------------------------
Script (Python):
Script (Python) :
[source,python]
----------------------------------------
@ -13199,7 +13266,7 @@ weechat_printf (NULL, "variables dans le hdata: %s" weechat_hdata_get_string (hd
weechat_printf (NULL, "listes dans le hdata: %s" weechat_hdata_get_string (hdata, "list_keys"));
----------------------------------------
Script (Python):
Script (Python) :
[source,python]
----------------------------------------

View File

@ -356,8 +356,9 @@ Liste des fonctions de l'API script :
infolist_time, infolist_free
| hdata |
hdata_get, hdata_get_var_offset, hdata_get_var_type_string,
hdata_get_var_hdata, hdata_get_list, hdata_move, hdata_integer, hdata_long,
hdata_string, hdata_pointer, hdata_time, hdata_get_string
hdata_get_var_hdata, hdata_get_list, hdata_check_pointer, hdata_move,
hdata_char, hdata_integer, hdata_long, hdata_string, hdata_pointer,
hdata_time, hdata_get_string
| mise à jour |
upgrade_new, upgrade_write_object, upgrade_read, upgrade_close
|========================================

View File

@ -12441,8 +12441,16 @@ Esempio in C:
int offset = weechat_hdata_get_var_offset (hdata, "name");
----------------------------------------
[NOTE]
Questa funzione non è disponibile nelle API per lo scripting.
Script (Python):
[source,python]
----------------------------------------
# prototipo
offset = weechat.hdata_get_var_offset(hdata, name)
# esempio
offset = weechat.hdata_get(hdata, "name")
----------------------------------------
weechat_hdata_get_var_type
^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -12703,6 +12711,69 @@ hdata = weechat.hdata_get("buffer")
buffers = weechat.hdata_get_list(hdata, "gui_buffers")
----------------------------------------
weechat_hdata_check_pointer
^^^^^^^^^^^^^^^^^^^^^^^^^^^
_Novità nella versione 0.3.7._
// TRANSLATION MISSING
Check if a pointer is valid for a hdata and a list pointer.
Prototipo:
[source,C]
----------------------------------------
int weechat_hdata_check_pointer (struct t_hdata *hdata, void *list, void *pointer);
----------------------------------------
Argomenti:
* 'hdata': puntatore hdata
// TRANSLATION MISSING
* 'list': list pointer
// TRANSLATION MISSING
* 'pointer': pointer to check
Valore restituito:
// TRANSLATION MISSING
* 1 if pointer is in list, 0 if not found
Esempio in C:
[source,C]
----------------------------------------
/* check if a buffer pointer is valid */
struct t_hdata *hdata = weechat_hdata_get ("buffer");
if (weechat_hdata_check_pointer (hdata,
weechat_hdata_get_list (hdata, "gui_buffers"),
ptr_buffer))
{
/* valid pointer */
}
else
{
/* invalid pointer */
}
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototipo
rc = weechat.hdata_check_pointer(hdata, list, pointer)
# esempio
hdata = weechat.hdata_get("buffer")
if weechat.hdata_check_pointer(hdata, weechat.hdata_get_list(hdata, "gui_buffers"), ptr_buffer):
# valid pointer
# ...
else:
# invalid pointer
# ...
----------------------------------------
weechat_hdata_move
^^^^^^^^^^^^^^^^^^

View File

@ -353,10 +353,11 @@ Elenco di funzioni nelle API per gli script:
infolist_get, infolist_next, infolist_prev, infolist_reset_item_cursor, +
infolist_fields, infolist_integer, infolist_string, infolist_pointer, +
infolist_time, infolist_free
| hdata |
| hdata |
hdata_get, hdata_get_var_offset, hdata_get_var_type_string,
hdata_get_var_hdata, hdata_get_list, hdata_move, hdata_integer, hdata_long,
hdata_string, hdata_pointer, hdata_time, hdata_get_string
hdata_get_var_hdata, hdata_get_list, hdata_check_pointer, hdata_move,
hdata_char, hdata_integer, hdata_long, hdata_string, hdata_pointer,
hdata_time, hdata_get_string
| aggiornamento |
upgrade_new, upgrade_write_object, upgrade_read, upgrade_close
|========================================

View File

@ -347,8 +347,9 @@ Lista funkcji w API skryptów:
infolist_time, infolist_free
| hdata |
hdata_get, hdata_get_var_offset, hdata_get_var_type_string,
hdata_get_var_hdata, hdata_get_list, hdata_move, hdata_integer, hdata_long,
hdata_string, hdata_pointer, hdata_time, hdata_get_string
hdata_get_var_hdata, hdata_get_list, hdata_check_pointer, hdata_move,
hdata_char, hdata_integer, hdata_long, hdata_string, hdata_pointer,
hdata_time, hdata_get_string
| uaktualnienie |
upgrade_new, upgrade_write_object, upgrade_read, upgrade_close
|========================================

View File

@ -235,6 +235,33 @@ hdata_get_list (struct t_hdata *hdata, const char *name)
return NULL;
}
/*
* hdata_check_pointer: check if a pointer is valid for a given hdata/list
* return 1 if pointer exists in list
* 0 if pointer does not exist
*/
int
hdata_check_pointer (struct t_hdata *hdata, void *list, void *pointer)
{
void *ptr_current;
if (hdata && list && pointer)
{
if (pointer == list)
return 1;
ptr_current = list;
while (ptr_current)
{
ptr_current = hdata_move (hdata, ptr_current, 1);
if (ptr_current && (ptr_current == pointer))
return 1;
}
}
return 0;
}
/*
* hdata_move: move pointer to another element in list
*/

View File

@ -61,6 +61,8 @@ extern void *hdata_get_var (struct t_hdata *hdata, void *pointer,
extern void *hdata_get_var_at_offset (struct t_hdata *hdata, void *pointer,
int offset);
extern void *hdata_get_list (struct t_hdata *hdata, const char *name);
extern int hdata_check_pointer (struct t_hdata *hdata, void *list,
void *pointer);
extern void *hdata_move (struct t_hdata *hdata, void *pointer, int count);
extern char hdata_char (struct t_hdata *hdata, void *pointer,
const char *name);

View File

@ -739,6 +739,7 @@ plugin_load (const char *filename, int argc, char **argv)
new_plugin->hdata_get_var = &hdata_get_var;
new_plugin->hdata_get_var_at_offset = &hdata_get_var_at_offset;
new_plugin->hdata_get_list = &hdata_get_list;
new_plugin->hdata_check_pointer = &hdata_check_pointer;
new_plugin->hdata_move = &hdata_move;
new_plugin->hdata_char = &hdata_char;
new_plugin->hdata_integer = &hdata_integer;

View File

@ -4837,6 +4837,27 @@ weechat_guile_api_hdata_get_list (SCM hdata, SCM name)
API_RETURN_STRING_FREE(result);
}
/*
* weechat_guile_api_hdata_check_pointer: check pointer with hdata/list
*/
SCM
weechat_guile_api_hdata_check_pointer (SCM hdata, SCM list, SCM pointer)
{
int value;
API_FUNC(1, "hdata_check_pointer", API_RETURN_INT(0));
if (!scm_is_string (hdata) || !scm_is_string (list)
|| !scm_is_string (pointer))
API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_hdata_check_pointer (script_str2ptr (scm_i_string_chars (hdata)),
script_str2ptr (scm_i_string_chars (list)),
script_str2ptr (scm_i_string_chars (pointer)));
API_RETURN_INT(value);
}
/*
* weechat_guile_api_hdata_move: move pointer to another element in list
*/
@ -5341,6 +5362,7 @@ weechat_guile_api_module_init (void *data)
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);
@ -5361,16 +5383,20 @@ weechat_guile_api_module_init (void *data)
"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",
"weechat:mkdir_home", "weechat:mkdir",
"weechat:mkdir_parents", "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",
"weechat:config_new", "weechat:config_new_section",
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",
@ -5388,11 +5414,14 @@ weechat_guile_api_module_init (void *data)
"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",
"weechat:key_bind", "weechat:key_unbind",
"weechat:prefix", "weechat:color",
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",
"weechat:hook_command", "weechat:hook_command_run",
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",
@ -5403,46 +5432,57 @@ weechat_guile_api_module_init (void *data)
"weechat:hook_info", "weechat:hook_info_hashtable",
"weechat:hook_infolist", "weechat:hook_focus",
"weechat:unhook", "weechat:unhook_all",
"weechat:buffer_new", "weechat:buffer_search",
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",
"weechat:current_window", "weechat:window_search_with_buffer",
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",
"weechat:nicklist_add_group", "weechat:nicklist_search_group",
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", "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",
"weechat:command", "weechat:info_get",
"weechat:info_get_hashtable", "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", "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_move", "weechat:hdata_integer",
"weechat:hdata_long", "weechat:hdata_string",
"weechat:hdata_pointer", "weechat:hdata_time",
"weechat:hdata_get_string", "weechat:upgrade_new",
"weechat:upgrade_write_object", "weechat:upgrade_read",
"weechat:upgrade_close",
"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);
/* interface constants */

View File

@ -5329,6 +5329,31 @@ weechat_lua_api_hdata_get_list (lua_State *L)
API_RETURN_STRING_FREE(result);
}
/*
* weechat_lua_api_hdata_check_pointer: check pointer with hdata/list
*/
static int
weechat_lua_api_hdata_check_pointer (lua_State *L)
{
const char *hdata, *list, *pointer;
int value;
API_FUNC(1, "hdata_check_pointer", API_RETURN_INT(0));
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_INT(0));
hdata = lua_tostring (lua_current_interpreter, -3);
list = lua_tostring (lua_current_interpreter, -2);
pointer = lua_tostring (lua_current_interpreter, -1);
value = weechat_hdata_check_pointer (script_str2ptr (hdata),
script_str2ptr (list),
script_str2ptr (pointer));
API_RETURN_INT(value);
}
/*
* weechat_lua_api_hdata_move: move pointer to another element in list
*/
@ -6238,6 +6263,7 @@ const struct luaL_reg weechat_lua_api_funcs[] = {
{ "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 },

View File

@ -5069,6 +5069,31 @@ XS (XS_weechat_api_hdata_get_list)
API_RETURN_STRING_FREE(result);
}
/*
* weechat::hdata_check_pointer: check pointer with hdata/list
*/
XS (XS_weechat_api_hdata_check_pointer)
{
char *hdata, *list, *pointer;
int value;
dXSARGS;
API_FUNC(1, "hdata_check_pointer", API_RETURN_INT(0));
if (items < 3)
API_WRONG_ARGS(API_RETURN_INT(0));
hdata = SvPV_nolen (ST (0));
list = SvPV_nolen (ST (1));
pointer = SvPV_nolen (ST (2));
value = weechat_hdata_check_pointer (script_str2ptr (hdata),
script_str2ptr (list),
script_str2ptr (pointer));
API_RETURN_INT(value);
}
/*
* weechat::hdata_move: move pointer to another element in list
*/
@ -5595,6 +5620,7 @@ weechat_perl_api_init (pTHX)
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");

View File

@ -5249,6 +5249,30 @@ weechat_python_api_hdata_get_list (PyObject *self, PyObject *args)
API_RETURN_STRING_FREE(result);
}
/*
* weechat_python_api_hdata_check_pointer: check pointer with hdata/list
*/
static PyObject *
weechat_python_api_hdata_check_pointer (PyObject *self, PyObject *args)
{
char *hdata, *list, *pointer;
int value;
API_FUNC(1, "hdata_check_pointer", API_RETURN_INT(0));
hdata = NULL;
list = NULL;
pointer = NULL;
if (!PyArg_ParseTuple (args, "sss", &hdata, &list, &pointer))
API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_hdata_check_pointer (script_str2ptr (hdata),
script_str2ptr (list),
script_str2ptr (pointer));
API_RETURN_INT(value);
}
/*
* weechat_python_api_hdata_move: move pointer to another element in list
*/
@ -5765,6 +5789,7 @@ PyMethodDef weechat_python_funcs[] =
{ "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, "" },

View File

@ -6028,6 +6028,36 @@ weechat_ruby_api_hdata_get_list (VALUE class, VALUE hdata, VALUE name)
API_RETURN_STRING_FREE(result);
}
/*
* weechat_ruby_api_hdata_check_pointer: check pointer with hdata/list
*/
static VALUE
weechat_ruby_api_hdata_check_pointer (VALUE class, VALUE hdata, VALUE list,
VALUE pointer)
{
char *c_hdata, *c_list, *c_pointer;
int value;
API_FUNC(1, "hdata_check_pointer", API_RETURN_INT(0));
if (NIL_P (hdata) || NIL_P (list) || NIL_P (pointer))
API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (hdata, T_STRING);
Check_Type (list, T_STRING);
Check_Type (pointer, T_STRING);
c_hdata = StringValuePtr (hdata);
c_list = StringValuePtr (list);
c_pointer = StringValuePtr (pointer);
value = weechat_hdata_check_pointer (script_str2ptr (c_hdata),
script_str2ptr (c_list),
script_str2ptr (c_pointer));
API_RETURN_INT(value);
}
/*
* weechat_ruby_api_hdata_move: move pointer to another element in list
*/
@ -6657,6 +6687,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
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);

View File

@ -5772,6 +5772,33 @@ weechat_tcl_api_hdata_get_list (ClientData clientData, Tcl_Interp *interp,
API_RETURN_STRING_FREE(result);
}
/*
* weechat_tcl_api_hdata_check_pointer: check pointer with hdata/list
*/
static int
weechat_tcl_api_hdata_check_pointer (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
char *hdata, *list, *pointer;
int result, i;
API_FUNC(1, "hdata_check_pointer", API_RETURN_INT(0));
if (objc < 4)
API_WRONG_ARGS(API_RETURN_INT(0));
hdata = Tcl_GetStringFromObj (objv[1], &i);
list = Tcl_GetStringFromObj (objv[2], &i);
pointer = Tcl_GetStringFromObj (objv[3], &i);
result = weechat_hdata_check_pointer (script_str2ptr (hdata),
script_str2ptr (list),
script_str2ptr (pointer));
API_RETURN_INT(result);
}
/*
* weechat_tcl_api_hdata_move: move pointer to another element in list
*/
@ -6568,6 +6595,8 @@ void weechat_tcl_api_init (Tcl_Interp *interp)
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",

View File

@ -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 "20111206-01"
#define WEECHAT_PLUGIN_API_VERSION "20111217-01"
/* macros for defining plugin infos */
#define WEECHAT_PLUGIN_NAME(__name) \
@ -827,6 +827,8 @@ struct t_weechat_plugin
void *(*hdata_get_var_at_offset) (struct t_hdata *hdata, void *pointer,
int offset);
void *(*hdata_get_list) (struct t_hdata *hdata, const char *name);
int (*hdata_check_pointer) (struct t_hdata *hdata, void *list,
void *pointer);
void *(*hdata_move) (struct t_hdata *hdata, void *pointer, int count);
char (*hdata_char) (struct t_hdata *hdata, void *pointer,
const char *name);
@ -1573,6 +1575,8 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
__offset)
#define weechat_hdata_get_list(__hdata, __name) \
weechat_plugin->hdata_get_list(__hdata, __name)
#define weechat_hdata_check_pointer(__hdata, __list, __pointer) \
weechat_plugin->hdata_check_pointer(__hdata, __list, __pointer)
#define weechat_hdata_move(__hdata, __pointer, __count) \
weechat_plugin->hdata_move(__hdata, __pointer, __count)
#define weechat_hdata_char(__hdata, __pointer, __name) \