api: add argument "flags" in function hdata_new_list
parent
3092c09bc9
commit
7aaf3be15b
|
@ -82,6 +82,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
|
|||
* core: add signals "key_combo_{default|search|cursor}"
|
||||
* core: display a warning in case of inconsistency between the options
|
||||
weechat.look.save_{config|layout}_on_exit
|
||||
* api: add argument "flags" in function hdata_new_list
|
||||
* api: change type of arguments displayed/highlight in hook_print callback from
|
||||
string to integer (in scripts)
|
||||
* api: allow wildcard "*" inside the mask in function string_match
|
||||
|
|
|
@ -13547,7 +13547,7 @@ This function is not available in scripting API.
|
|||
|
||||
==== weechat_hdata_new_list
|
||||
|
||||
_WeeChat ≥ 0.3.6._
|
||||
_WeeChat ≥ 0.3.6, updated in 1.0._
|
||||
|
||||
Create a new list pointer in hdata.
|
||||
|
||||
|
@ -13555,7 +13555,7 @@ Prototype:
|
|||
|
||||
[source,C]
|
||||
----
|
||||
void weechat_hdata_new_list (struct t_hdata *hdata, const char *name, void *pointer);
|
||||
void weechat_hdata_new_list (struct t_hdata *hdata, const char *name, void *pointer, int flags);
|
||||
----
|
||||
|
||||
Arguments:
|
||||
|
@ -13563,6 +13563,8 @@ Arguments:
|
|||
* 'hdata': hdata pointer
|
||||
* 'name': variable name
|
||||
* 'pointer': list pointer
|
||||
* 'flags': combination of following values: _(WeeChat ≥ 1.0)_
|
||||
** 'WEECHAT_HDATA_LIST_CHECK_POINTERS': list used to check pointers
|
||||
|
||||
C example:
|
||||
|
||||
|
@ -13590,16 +13592,16 @@ weechat_hdata_new_var (hdata, "string_split", offsetof (struct t_myplugin_list,
|
|||
weechat_hdata_new_var (hdata, "prev", offsetof (struct t_myplugin_list, prev), WEECHAT_HDATA_POINTER, NULL, "myplugin_list");
|
||||
weechat_hdata_new_var (hdata, "next", offsetof (struct t_myplugin_list, next), WEECHAT_HDATA_POINTER, NULL, "myplugin_list");
|
||||
|
||||
weechat_hdata_new_list (hdata, "buffers", &buffers);
|
||||
weechat_hdata_new_list (hdata, "last_buffer", &last_buffer);
|
||||
weechat_hdata_new_list (hdata, "buffers", &buffers, WEECHAT_HDATA_LIST_CHECK_POINTERS);
|
||||
weechat_hdata_new_list (hdata, "last_buffer", &last_buffer, 0);
|
||||
----
|
||||
|
||||
The macro "WEECHAT_HDATA_LIST" can be used to shorten code:
|
||||
|
||||
[source,C]
|
||||
----
|
||||
WEECHAT_HDATA_LIST(buffers);
|
||||
WEECHAT_HDATA_LIST(last_buffer);
|
||||
WEECHAT_HDATA_LIST(buffers, WEECHAT_HDATA_LIST_CHECK_POINTERS);
|
||||
WEECHAT_HDATA_LIST(last_buffer, 0);
|
||||
----
|
||||
|
||||
[NOTE]
|
||||
|
@ -14037,7 +14039,7 @@ buffers = weechat.hdata_get_list(hdata, "gui_buffers")
|
|||
|
||||
==== weechat_hdata_check_pointer
|
||||
|
||||
_WeeChat ≥ 0.3.7._
|
||||
_WeeChat ≥ 0.3.7, updated in 1.0._
|
||||
|
||||
Check if a pointer is valid for a hdata and a list pointer.
|
||||
|
||||
|
@ -14051,7 +14053,10 @@ int weechat_hdata_check_pointer (struct t_hdata *hdata, void *list, void *pointe
|
|||
Arguments:
|
||||
|
||||
* 'hdata': hdata pointer
|
||||
* 'list': list pointer
|
||||
* 'list': list pointer; if NULL _(WeeChat ≥ 1.0)_, the pointer is checked with
|
||||
the lists in hdata that have flag "check pointers" (see
|
||||
<<_weechat_hdata_new_list,weechat_hdata_new_list>>), and if no such list
|
||||
exists, the pointer is considered as valid
|
||||
* 'pointer': pointer to check
|
||||
|
||||
Return value:
|
||||
|
|
|
@ -13811,7 +13811,7 @@ Cette fonction n'est pas disponible dans l'API script.
|
|||
|
||||
==== weechat_hdata_new_list
|
||||
|
||||
_WeeChat ≥ 0.3.6._
|
||||
_WeeChat ≥ 0.3.6, mis à jour dans la 1.0._
|
||||
|
||||
Créer un nouveau pointer vers une liste dans le hdata.
|
||||
|
||||
|
@ -13819,7 +13819,7 @@ Prototype :
|
|||
|
||||
[source,C]
|
||||
----
|
||||
void weechat_hdata_new_list (struct t_hdata *hdata, const char *name, void *pointer);
|
||||
void weechat_hdata_new_list (struct t_hdata *hdata, const char *name, void *pointer, int flags);
|
||||
----
|
||||
|
||||
Paramètres :
|
||||
|
@ -13827,6 +13827,9 @@ Paramètres :
|
|||
* 'hdata' : pointeur vers le hdata
|
||||
* 'name' : nom de la variable
|
||||
* 'pointer' : pointeur vers la liste
|
||||
* 'flags' : combinaison des valeurs suivantes : _(WeeChat ≥ 1.0)_
|
||||
** 'WEECHAT_HDATA_LIST_CHECK_POINTERS' : liste utilisée pour vérifier les
|
||||
pointeurs
|
||||
|
||||
Exemple en C :
|
||||
|
||||
|
@ -13854,16 +13857,16 @@ weechat_hdata_new_var (hdata, "string_split", offsetof (struct t_myplugin_list,
|
|||
weechat_hdata_new_var (hdata, "prev", offsetof (struct t_myplugin_list, prev), WEECHAT_HDATA_POINTER, NULL, "myplugin_list");
|
||||
weechat_hdata_new_var (hdata, "next", offsetof (struct t_myplugin_list, next), WEECHAT_HDATA_POINTER, NULL, "myplugin_list");
|
||||
|
||||
weechat_hdata_new_list (hdata, "buffers", &buffers);
|
||||
weechat_hdata_new_list (hdata, "last_buffer", &last_buffer);
|
||||
weechat_hdata_new_list (hdata, "buffers", &buffers, WEECHAT_HDATA_LIST_CHECK_POINTERS);
|
||||
weechat_hdata_new_list (hdata, "last_buffer", &last_buffer, 0);
|
||||
----
|
||||
|
||||
La macro "WEECHAT_HDATA_LIST" peut être utilisée pour raccourcir le code :
|
||||
|
||||
[source,C]
|
||||
----
|
||||
WEECHAT_HDATA_LIST(buffers);
|
||||
WEECHAT_HDATA_LIST(last_buffer);
|
||||
WEECHAT_HDATA_LIST(buffers, WEECHAT_HDATA_LIST_CHECK_POINTERS);
|
||||
WEECHAT_HDATA_LIST(last_buffer, 0);
|
||||
----
|
||||
|
||||
[NOTE]
|
||||
|
@ -14305,7 +14308,7 @@ buffers = weechat.hdata_get_list(hdata, "gui_buffers")
|
|||
|
||||
==== weechat_hdata_check_pointer
|
||||
|
||||
_WeeChat ≥ 0.3.7._
|
||||
_WeeChat ≥ 0.3.7, mis à jour dans la 1.0._
|
||||
|
||||
Vérifier si un pointeur est valide pour un hdata et un pointeur de liste.
|
||||
|
||||
|
@ -14319,7 +14322,11 @@ int weechat_hdata_check_pointer (struct t_hdata *hdata, void *list, void *pointe
|
|||
Paramètres :
|
||||
|
||||
* 'hdata' : pointeur vers le hdata
|
||||
* 'list' : pointeur vers une liste
|
||||
* 'list' : pointeur vers une liste; si NULL _(WeeChat ≥ 1.0)_, le pointeur est
|
||||
vérifié avec les listes dans le hdata qui ont le drapeau
|
||||
"vérifier les pointeurs" (voir
|
||||
<<_weechat_hdata_new_list,weechat_hdata_new_list>>), et s'il n'y a pas de
|
||||
telle liste, le pointeur est considéré comme valide
|
||||
* 'pointer' : pointeur à vérifier
|
||||
|
||||
Valeur de retour :
|
||||
|
|
|
@ -13931,7 +13931,8 @@ Questa funzione non è disponibile nelle API per lo scripting.
|
|||
|
||||
==== weechat_hdata_new_list
|
||||
|
||||
_WeeChat ≥ 0.3.6._
|
||||
// TRANSLATION MISSING
|
||||
_WeeChat ≥ 0.3.6, updated in 1.0._
|
||||
|
||||
Crea una nuovo puntatore alla lista in hdata.
|
||||
|
||||
|
@ -13939,7 +13940,7 @@ Prototipo:
|
|||
|
||||
[source,C]
|
||||
----
|
||||
void weechat_hdata_new_list (struct t_hdata *hdata, const char *name, void *pointer);
|
||||
void weechat_hdata_new_list (struct t_hdata *hdata, const char *name, void *pointer, int flags);
|
||||
----
|
||||
|
||||
Argomenti:
|
||||
|
@ -13947,6 +13948,9 @@ Argomenti:
|
|||
* 'hdata': puntatore hdata
|
||||
* 'name': nome delal variabile
|
||||
* 'pointer': puntatore alla lista
|
||||
// TRANSLATION MISSING
|
||||
* 'flags': combination of following values: _(WeeChat ≥ 1.0)_
|
||||
** 'WEECHAT_HDATA_LIST_CHECK_POINTERS': list used to check pointers
|
||||
|
||||
Esempio in C:
|
||||
|
||||
|
@ -13974,16 +13978,16 @@ weechat_hdata_new_var (hdata, "string_split", offsetof (struct t_myplugin_list,
|
|||
weechat_hdata_new_var (hdata, "prev", offsetof (struct t_myplugin_list, prev), WEECHAT_HDATA_POINTER, NULL, "myplugin_list");
|
||||
weechat_hdata_new_var (hdata, "next", offsetof (struct t_myplugin_list, next), WEECHAT_HDATA_POINTER, NULL, "myplugin_list");
|
||||
|
||||
weechat_hdata_new_list (hdata, "buffers", &buffers);
|
||||
weechat_hdata_new_list (hdata, "last_buffer", &last_buffer);
|
||||
weechat_hdata_new_list (hdata, "buffers", &buffers, WEECHAT_HDATA_LIST_CHECK_POINTERS);
|
||||
weechat_hdata_new_list (hdata, "last_buffer", &last_buffer, 0);
|
||||
----
|
||||
|
||||
La macro "WEECHAT_HDATA_LIST" può essere usata per accorciare il codice:
|
||||
|
||||
[source,C]
|
||||
----
|
||||
WEECHAT_HDATA_LIST(buffers);
|
||||
WEECHAT_HDATA_LIST(last_buffer);
|
||||
WEECHAT_HDATA_LIST(buffers, WEECHAT_HDATA_LIST_CHECK_POINTERS);
|
||||
WEECHAT_HDATA_LIST(last_buffer, 0);
|
||||
----
|
||||
|
||||
[NOTE]
|
||||
|
@ -14428,7 +14432,8 @@ buffers = weechat.hdata_get_list(hdata, "gui_buffers")
|
|||
|
||||
==== weechat_hdata_check_pointer
|
||||
|
||||
_WeeChat ≥ 0.3.7._
|
||||
// TRANSLATION MISSING
|
||||
_WeeChat ≥ 0.3.7, updated in 1.0._
|
||||
|
||||
Verifica se un puntatore è valido per un hdata e un puntatore della lista.
|
||||
|
||||
|
@ -14442,7 +14447,11 @@ int weechat_hdata_check_pointer (struct t_hdata *hdata, void *list, void *pointe
|
|||
Argomenti:
|
||||
|
||||
* 'hdata': puntatore hdata
|
||||
* 'list': puntatore alla lista
|
||||
// TRANSLATION MISSING
|
||||
* 'list': puntatore alla lista; if NULL _(WeeChat ≥ 1.0)_, the pointer is
|
||||
checked with the lists in hdata that have flag "check pointers" (see
|
||||
<<_weechat_hdata_new_list,weechat_hdata_new_list>>), and if no such list
|
||||
exists, the pointer is considered as valid
|
||||
* 'pointer': puntatore da verificare
|
||||
|
||||
Valore restituito:
|
||||
|
|
|
@ -13538,7 +13538,8 @@ WEECHAT_HDATA_VAR(struct t_myplugin_list, next, POINTER, 0, NULL, "myplugin_list
|
|||
|
||||
==== weechat_hdata_new_list
|
||||
|
||||
_WeeChat バージョン 0.3.6 以上で利用可。_
|
||||
// TRANSLATION MISSING
|
||||
_WeeChat ≥ 0.3.6, updated in 1.0._
|
||||
|
||||
hdata に新しいリストへのポインタを作成。
|
||||
|
||||
|
@ -13546,7 +13547,7 @@ hdata に新しいリストへのポインタを作成。
|
|||
|
||||
[source,C]
|
||||
----
|
||||
void weechat_hdata_new_list (struct t_hdata *hdata, const char *name, void *pointer);
|
||||
void weechat_hdata_new_list (struct t_hdata *hdata, const char *name, void *pointer, int flags);
|
||||
----
|
||||
|
||||
引数:
|
||||
|
@ -13554,6 +13555,9 @@ void weechat_hdata_new_list (struct t_hdata *hdata, const char *name, void *poin
|
|||
* 'hdata': hdata へのポインタ
|
||||
* 'name': 変数名
|
||||
* 'pointer': リストへのポインタ
|
||||
// TRANSLATION MISSING
|
||||
* 'flags': combination of following values: _(WeeChat ≥ 1.0)_
|
||||
** 'WEECHAT_HDATA_LIST_CHECK_POINTERS': list used to check pointers
|
||||
|
||||
C 言語での使用例:
|
||||
|
||||
|
@ -13581,16 +13585,16 @@ weechat_hdata_new_var (hdata, "string_split", offsetof (struct t_myplugin_list,
|
|||
weechat_hdata_new_var (hdata, "prev", offsetof (struct t_myplugin_list, prev), WEECHAT_HDATA_POINTER, NULL, "myplugin_list");
|
||||
weechat_hdata_new_var (hdata, "next", offsetof (struct t_myplugin_list, next), WEECHAT_HDATA_POINTER, NULL, "myplugin_list");
|
||||
|
||||
weechat_hdata_new_list (hdata, "buffers", &buffers);
|
||||
weechat_hdata_new_list (hdata, "last_buffer", &last_buffer);
|
||||
weechat_hdata_new_list (hdata, "buffers", &buffers, WEECHAT_HDATA_LIST_CHECK_POINTERS);
|
||||
weechat_hdata_new_list (hdata, "last_buffer", &last_buffer, 0);
|
||||
----
|
||||
|
||||
コードを短くするためにはマクロ "WEECHAT_HDATA_LIST" を使います。
|
||||
|
||||
[source,C]
|
||||
----
|
||||
WEECHAT_HDATA_LIST(buffers);
|
||||
WEECHAT_HDATA_LIST(last_buffer);
|
||||
WEECHAT_HDATA_LIST(buffers, WEECHAT_HDATA_LIST_CHECK_POINTERS);
|
||||
WEECHAT_HDATA_LIST(last_buffer, 0);
|
||||
----
|
||||
|
||||
[NOTE]
|
||||
|
@ -14028,7 +14032,8 @@ buffers = weechat.hdata_get_list(hdata, "gui_buffers")
|
|||
|
||||
==== weechat_hdata_check_pointer
|
||||
|
||||
_WeeChat バージョン 0.3.7 以上で利用可。_
|
||||
// TRANSLATION MISSING
|
||||
_WeeChat ≥ 0.3.7, updated in 1.0._
|
||||
|
||||
hdata とリストへのポインタを使ってポインタの妥当性を確認する。
|
||||
|
||||
|
@ -14042,7 +14047,11 @@ int weechat_hdata_check_pointer (struct t_hdata *hdata, void *list, void *pointe
|
|||
引数:
|
||||
|
||||
* 'hdata': hdata へのポインタ
|
||||
* 'list': リストへのポインタ
|
||||
// TRANSLATION MISSING
|
||||
* 'list': list pointer; if NULL _(WeeChat ≥ 1.0)_, the pointer is checked with
|
||||
the lists in hdata that have flag "check pointers" (see
|
||||
<<_weechat_hdata_new_list,weechat_hdata_new_list>>), and if no such list
|
||||
exists, the pointer is considered as valid
|
||||
* 'pointer': 確認するポインタ
|
||||
|
||||
戻り値:
|
||||
|
|
|
@ -2718,8 +2718,8 @@ config_file_hdata_config_file_cb (void *data, const char *hdata_name)
|
|||
HDATA_VAR(struct t_config_file, last_section, POINTER, 0, NULL, "config_section");
|
||||
HDATA_VAR(struct t_config_file, prev_config, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_VAR(struct t_config_file, next_config, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_LIST(config_files);
|
||||
HDATA_LIST(last_config_file);
|
||||
HDATA_LIST(config_files, WEECHAT_HDATA_LIST_CHECK_POINTERS);
|
||||
HDATA_LIST(last_config_file, 0);
|
||||
}
|
||||
return hdata;
|
||||
}
|
||||
|
|
|
@ -72,6 +72,21 @@ hdata_free_var (struct t_hashtable *hashtable,
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Frees a hdata list.
|
||||
*/
|
||||
|
||||
void
|
||||
hdata_free_list (struct t_hashtable *hashtable,
|
||||
const void *key, void *value)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) hashtable;
|
||||
(void) key;
|
||||
|
||||
free (value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Creates a new hdata.
|
||||
*
|
||||
|
@ -111,6 +126,7 @@ hdata_new (struct t_weechat_plugin *plugin, const char *hdata_name,
|
|||
WEECHAT_HASHTABLE_POINTER,
|
||||
NULL,
|
||||
NULL);
|
||||
new_hdata->hash_list->callback_free_value = &hdata_free_list;
|
||||
hashtable_set (weechat_hdata, hdata_name, new_hdata);
|
||||
new_hdata->create_allowed = create_allowed;
|
||||
new_hdata->delete_allowed = delete_allowed;
|
||||
|
@ -153,12 +169,21 @@ hdata_new_var (struct t_hdata *hdata, const char *name, int offset, int type,
|
|||
*/
|
||||
|
||||
void
|
||||
hdata_new_list (struct t_hdata *hdata, const char *name, void *pointer)
|
||||
hdata_new_list (struct t_hdata *hdata, const char *name, void *pointer,
|
||||
int flags)
|
||||
{
|
||||
struct t_hdata_list *list;
|
||||
|
||||
if (!hdata || !name)
|
||||
return;
|
||||
|
||||
hashtable_set (hdata->hash_list, name, pointer);
|
||||
list = malloc (sizeof (*list));
|
||||
if (list)
|
||||
{
|
||||
list->pointer = pointer;
|
||||
list->flags = flags;
|
||||
hashtable_set (hdata->hash_list, name, list);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -399,20 +424,20 @@ hdata_get_var_at_offset (struct t_hdata *hdata, void *pointer, int offset)
|
|||
void *
|
||||
hdata_get_list (struct t_hdata *hdata, const char *name)
|
||||
{
|
||||
void *ptr_value;
|
||||
struct t_hdata_list *ptr_list;
|
||||
|
||||
if (!hdata || !name)
|
||||
return NULL;
|
||||
|
||||
ptr_value = hashtable_get (hdata->hash_list, name);
|
||||
if (ptr_value)
|
||||
return *((void **)ptr_value);
|
||||
ptr_list = hashtable_get (hdata->hash_list, name);
|
||||
if (ptr_list)
|
||||
return *((void **)(ptr_list->pointer));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks if a pointer is valid for a given hdata/list.
|
||||
* Checks if a pointer is in the list.
|
||||
*
|
||||
* Returns:
|
||||
* 1: pointer exists in list
|
||||
|
@ -420,15 +445,16 @@ hdata_get_list (struct t_hdata *hdata, const char *name)
|
|||
*/
|
||||
|
||||
int
|
||||
hdata_check_pointer (struct t_hdata *hdata, void *list, void *pointer)
|
||||
hdata_check_pointer_in_list (struct t_hdata *hdata, void *list, void *pointer)
|
||||
{
|
||||
void *ptr_current;
|
||||
|
||||
if (!hdata || !list || !pointer)
|
||||
if (!hdata || !pointer)
|
||||
return 0;
|
||||
|
||||
if (pointer == list)
|
||||
return 1;
|
||||
|
||||
ptr_current = list;
|
||||
while (ptr_current)
|
||||
{
|
||||
|
@ -440,6 +466,83 @@ hdata_check_pointer (struct t_hdata *hdata, void *list, void *pointer)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks if a pointer is in a list with flag "check_pointers".
|
||||
*/
|
||||
|
||||
void
|
||||
hdata_check_pointer_map_cb (void *data, struct t_hashtable *hashtable,
|
||||
const void *key, const void *value)
|
||||
{
|
||||
void **pointers, *pointer, **num_lists, **found;
|
||||
struct t_hdata *ptr_hdata;
|
||||
struct t_hdata_list *ptr_list;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) hashtable;
|
||||
(void) key;
|
||||
|
||||
pointers = (void **)data;
|
||||
ptr_hdata = pointers[0];
|
||||
pointer = pointers[1];
|
||||
num_lists = &pointers[2];
|
||||
found = &pointers[3];
|
||||
|
||||
/* pointer already found in another list? just exit */
|
||||
if (*found)
|
||||
return;
|
||||
|
||||
ptr_list = (struct t_hdata_list *)value;
|
||||
if (!ptr_list || !(ptr_list->flags & WEECHAT_HDATA_LIST_CHECK_POINTERS))
|
||||
return;
|
||||
|
||||
*found = (void *)((unsigned long int)hdata_check_pointer_in_list (
|
||||
ptr_hdata,
|
||||
*((void **)(ptr_list->pointer)),
|
||||
pointer));
|
||||
(*num_lists)++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks if a pointer is valid for a given hdata/list.
|
||||
*
|
||||
* If argument "list" is NULL, the check is made with all lists in hdata
|
||||
* that have flag "check_pointers". If no list is defined with this flag,
|
||||
* the pointer is considered valid (so this function returns 1); if the
|
||||
* pointer is not found in any list, this function returns 0.
|
||||
*
|
||||
* Returns:
|
||||
* 1: pointer exists in the given list (or a list with check_pointers flag)
|
||||
* 0: pointer does not exist
|
||||
*/
|
||||
|
||||
int
|
||||
hdata_check_pointer (struct t_hdata *hdata, void *list, void *pointer)
|
||||
{
|
||||
void *pointers[4];
|
||||
|
||||
if (!hdata || !pointer)
|
||||
return 0;
|
||||
|
||||
if (list)
|
||||
{
|
||||
/* search pointer in the given list */
|
||||
return hdata_check_pointer_in_list (hdata, list, pointer);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* search pointer in all lists with flag "check_pointers" */
|
||||
pointers[0] = hdata;
|
||||
pointers[1] = pointer;
|
||||
pointers[2] = 0; /* number of lists with flag check_pointers */
|
||||
pointers[3] = 0; /* pointer found? (0/1) */
|
||||
hashtable_map (hdata->hash_list,
|
||||
&hdata_check_pointer_map_cb,
|
||||
pointers);
|
||||
return ((pointers[2] == 0) || pointers[3]) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Moves pointer to another element in list.
|
||||
*/
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
hdata_new_var (hdata, #__name, offsetof (__struct, __name), \
|
||||
WEECHAT_HDATA_##__type, __update_allowed, \
|
||||
__array_size, __hdata_name)
|
||||
#define HDATA_LIST(__name) hdata_new_list (hdata, #__name, &(__name));
|
||||
#define HDATA_LIST(__name, __flags) \
|
||||
hdata_new_list (hdata, #__name, &(__name), __flags);
|
||||
|
||||
struct t_hdata_var
|
||||
{
|
||||
|
@ -36,6 +37,12 @@ struct t_hdata_var
|
|||
char *hdata_name; /* hdata name */
|
||||
};
|
||||
|
||||
struct t_hdata_list
|
||||
{
|
||||
void *pointer; /* list pointer */
|
||||
int flags; /* flags for list */
|
||||
};
|
||||
|
||||
struct t_hdata
|
||||
{
|
||||
char *name; /* name of hdata */
|
||||
|
@ -79,7 +86,7 @@ extern void hdata_new_var (struct t_hdata *hdata, const char *name, int offset,
|
|||
int type, int update_allowed, const char *array_size,
|
||||
const char *hdata_name);
|
||||
extern void hdata_new_list (struct t_hdata *hdata, const char *name,
|
||||
void *pointer);
|
||||
void *pointer, int flags);
|
||||
extern int hdata_get_var_offset (struct t_hdata *hdata, const char *name);
|
||||
extern int hdata_get_var_type (struct t_hdata *hdata, const char *name);
|
||||
extern const char *hdata_get_var_type_string (struct t_hdata *hdata,
|
||||
|
|
|
@ -636,8 +636,8 @@ proxy_hdata_proxy_cb (void *data, const char *hdata_name)
|
|||
HDATA_VAR(struct t_proxy, options, POINTER, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_proxy, prev_proxy, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_VAR(struct t_proxy, next_proxy, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_LIST(weechat_proxies);
|
||||
HDATA_LIST(last_weechat_proxy);
|
||||
HDATA_LIST(weechat_proxies, WEECHAT_HDATA_LIST_CHECK_POINTERS);
|
||||
HDATA_LIST(last_weechat_proxy, 0);
|
||||
}
|
||||
return hdata;
|
||||
}
|
||||
|
|
|
@ -2174,8 +2174,8 @@ gui_bar_item_hdata_bar_item_cb (void *data, const char *hdata_name)
|
|||
HDATA_VAR(struct t_gui_bar_item, build_callback_data, POINTER, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_gui_bar_item, prev_item, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_VAR(struct t_gui_bar_item, next_item, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_LIST(gui_bar_items);
|
||||
HDATA_LIST(last_gui_bar_item);
|
||||
HDATA_LIST(gui_bar_items, WEECHAT_HDATA_LIST_CHECK_POINTERS);
|
||||
HDATA_LIST(last_gui_bar_item, 0);
|
||||
}
|
||||
return hdata;
|
||||
}
|
||||
|
|
|
@ -2280,8 +2280,8 @@ gui_bar_hdata_bar_cb (void *data, const char *hdata_name)
|
|||
HDATA_VAR(struct t_gui_bar, bar_refresh_needed, INTEGER, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_gui_bar, prev_bar, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_VAR(struct t_gui_bar, next_bar, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_LIST(gui_bars);
|
||||
HDATA_LIST(last_gui_bar);
|
||||
HDATA_LIST(gui_bars, WEECHAT_HDATA_LIST_CHECK_POINTERS);
|
||||
HDATA_LIST(last_gui_bar, 0);
|
||||
}
|
||||
return hdata;
|
||||
}
|
||||
|
|
|
@ -4024,9 +4024,9 @@ gui_buffer_hdata_buffer_cb (void *data, const char *hdata_name)
|
|||
HDATA_VAR(struct t_gui_buffer, local_variables, HASHTABLE, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_gui_buffer, prev_buffer, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_VAR(struct t_gui_buffer, next_buffer, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_LIST(gui_buffers);
|
||||
HDATA_LIST(last_gui_buffer);
|
||||
HDATA_LIST(gui_buffer_last_displayed);
|
||||
HDATA_LIST(gui_buffers, WEECHAT_HDATA_LIST_CHECK_POINTERS);
|
||||
HDATA_LIST(last_gui_buffer, 0);
|
||||
HDATA_LIST(gui_buffer_last_displayed, 0);
|
||||
}
|
||||
return hdata;
|
||||
}
|
||||
|
@ -4074,8 +4074,8 @@ gui_buffer_hdata_buffer_visited_cb (void *data, const char *hdata_name)
|
|||
HDATA_VAR(struct t_gui_buffer_visited, buffer, POINTER, 0, NULL, "buffer");
|
||||
HDATA_VAR(struct t_gui_buffer_visited, prev_buffer, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_VAR(struct t_gui_buffer_visited, next_buffer, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_LIST(gui_buffers_visited);
|
||||
HDATA_LIST(last_gui_buffer_visited);
|
||||
HDATA_LIST(gui_buffers_visited, WEECHAT_HDATA_LIST_CHECK_POINTERS);
|
||||
HDATA_LIST(last_gui_buffer_visited, 0);
|
||||
}
|
||||
return hdata;
|
||||
}
|
||||
|
|
|
@ -516,8 +516,8 @@ gui_filter_hdata_filter_cb (void *data, const char *hdata_name)
|
|||
HDATA_VAR(struct t_gui_filter, regex_message, POINTER, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_gui_filter, prev_filter, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_VAR(struct t_gui_filter, next_filter, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_LIST(gui_filters);
|
||||
HDATA_LIST(last_gui_filter);
|
||||
HDATA_LIST(gui_filters, WEECHAT_HDATA_LIST_CHECK_POINTERS);
|
||||
HDATA_LIST(last_gui_filter, 0);
|
||||
}
|
||||
return hdata;
|
||||
}
|
||||
|
|
|
@ -291,8 +291,8 @@ gui_history_hdata_history_cb (void *data, const char *hdata_name)
|
|||
HDATA_VAR(struct t_gui_history, text, STRING, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_gui_history, prev_history, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_VAR(struct t_gui_history, next_history, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_LIST(gui_history);
|
||||
HDATA_LIST(last_gui_history);
|
||||
HDATA_LIST(gui_history, WEECHAT_HDATA_LIST_CHECK_POINTERS);
|
||||
HDATA_LIST(last_gui_history, 0);
|
||||
}
|
||||
return hdata;
|
||||
}
|
||||
|
|
|
@ -540,8 +540,8 @@ gui_hotlist_hdata_hotlist_cb (void *data, const char *hdata_name)
|
|||
HDATA_VAR(struct t_gui_hotlist, count, INTEGER, 0, GUI_HOTLIST_NUM_PRIORITIES_STR, NULL);
|
||||
HDATA_VAR(struct t_gui_hotlist, prev_hotlist, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_VAR(struct t_gui_hotlist, next_hotlist, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_LIST(gui_hotlist);
|
||||
HDATA_LIST(last_gui_hotlist);
|
||||
HDATA_LIST(gui_hotlist, WEECHAT_HDATA_LIST_CHECK_POINTERS);
|
||||
HDATA_LIST(last_gui_hotlist, 0);
|
||||
}
|
||||
return hdata;
|
||||
}
|
||||
|
|
|
@ -1871,22 +1871,22 @@ gui_key_hdata_key_cb (void *data, const char *hdata_name)
|
|||
"gui_keys%s%s",
|
||||
(i == GUI_KEY_CONTEXT_DEFAULT) ? "" : "_",
|
||||
(i == GUI_KEY_CONTEXT_DEFAULT) ? "" : gui_key_context_string[i]);
|
||||
hdata_new_list(hdata, str_list, &gui_keys[i]);
|
||||
hdata_new_list(hdata, str_list, &gui_keys[i], 0);
|
||||
snprintf (str_list, sizeof (str_list),
|
||||
"last_gui_key%s%s",
|
||||
(i == GUI_KEY_CONTEXT_DEFAULT) ? "" : "_",
|
||||
(i == GUI_KEY_CONTEXT_DEFAULT) ? "" : gui_key_context_string[i]);
|
||||
hdata_new_list(hdata, str_list, &last_gui_key[i]);
|
||||
hdata_new_list(hdata, str_list, &last_gui_key[i], 0);
|
||||
snprintf (str_list, sizeof (str_list),
|
||||
"gui_default_keys%s%s",
|
||||
(i == GUI_KEY_CONTEXT_DEFAULT) ? "" : "_",
|
||||
(i == GUI_KEY_CONTEXT_DEFAULT) ? "" : gui_key_context_string[i]);
|
||||
hdata_new_list(hdata, str_list, &gui_default_keys[i]);
|
||||
hdata_new_list(hdata, str_list, &gui_default_keys[i], 0);
|
||||
snprintf (str_list, sizeof (str_list),
|
||||
"last_gui_default_key%s%s",
|
||||
(i == GUI_KEY_CONTEXT_DEFAULT) ? "" : "_",
|
||||
(i == GUI_KEY_CONTEXT_DEFAULT) ? "" : gui_key_context_string[i]);
|
||||
hdata_new_list(hdata, str_list, &last_gui_default_key[i]);
|
||||
hdata_new_list(hdata, str_list, &last_gui_default_key[i], 0);
|
||||
}
|
||||
}
|
||||
return hdata;
|
||||
|
|
|
@ -954,9 +954,9 @@ gui_layout_hdata_layout_cb (void *data, const char *hdata_name)
|
|||
HDATA_VAR(struct t_gui_layout, internal_id_current_window, INTEGER, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_gui_layout, prev_layout, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_VAR(struct t_gui_layout, next_layout, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_LIST(gui_layouts);
|
||||
HDATA_LIST(last_gui_layout);
|
||||
HDATA_LIST(gui_layout_current);
|
||||
HDATA_LIST(gui_layouts, WEECHAT_HDATA_LIST_CHECK_POINTERS);
|
||||
HDATA_LIST(last_gui_layout, 0);
|
||||
HDATA_LIST(gui_layout_current, 0);
|
||||
}
|
||||
return hdata;
|
||||
}
|
||||
|
|
|
@ -1760,9 +1760,9 @@ gui_window_hdata_window_cb (void *data, const char *hdata_name)
|
|||
HDATA_VAR(struct t_gui_window, ptr_tree, POINTER, 0, NULL, "window_tree");
|
||||
HDATA_VAR(struct t_gui_window, prev_window, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_VAR(struct t_gui_window, next_window, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_LIST(gui_windows);
|
||||
HDATA_LIST(last_gui_window);
|
||||
HDATA_LIST(gui_current_window);
|
||||
HDATA_LIST(gui_windows, WEECHAT_HDATA_LIST_CHECK_POINTERS);
|
||||
HDATA_LIST(last_gui_window, 0);
|
||||
HDATA_LIST(gui_current_window, 0);
|
||||
}
|
||||
return hdata;
|
||||
}
|
||||
|
@ -1817,7 +1817,7 @@ gui_window_hdata_window_tree_cb (void *data, const char *hdata_name)
|
|||
HDATA_VAR(struct t_gui_window_tree, child1, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_VAR(struct t_gui_window_tree, child2, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_VAR(struct t_gui_window_tree, window, POINTER, 0, NULL, "window");
|
||||
HDATA_LIST(gui_windows_tree);
|
||||
HDATA_LIST(gui_windows_tree, 0);
|
||||
}
|
||||
return hdata;
|
||||
}
|
||||
|
|
|
@ -326,8 +326,8 @@ irc_ignore_hdata_ignore_cb (void *data, const char *hdata_name)
|
|||
WEECHAT_HDATA_VAR(struct t_irc_ignore, channel, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_ignore, prev_ignore, POINTER, 0, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_ignore, next_ignore, POINTER, 0, NULL, hdata_name);
|
||||
WEECHAT_HDATA_LIST(irc_ignore_list);
|
||||
WEECHAT_HDATA_LIST(last_irc_ignore);
|
||||
WEECHAT_HDATA_LIST(irc_ignore_list, WEECHAT_HDATA_LIST_CHECK_POINTERS);
|
||||
WEECHAT_HDATA_LIST(last_irc_ignore, 0);
|
||||
}
|
||||
return hdata;
|
||||
}
|
||||
|
|
|
@ -1007,8 +1007,8 @@ irc_redirect_hdata_redirect_pattern_cb (void *data, const char *hdata_name)
|
|||
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_extra, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, prev_redirect, POINTER, 0, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, next_redirect, POINTER, 0, NULL, hdata_name);
|
||||
WEECHAT_HDATA_LIST(irc_redirect_patterns);
|
||||
WEECHAT_HDATA_LIST(last_irc_redirect_pattern);
|
||||
WEECHAT_HDATA_LIST(irc_redirect_patterns, WEECHAT_HDATA_LIST_CHECK_POINTERS);
|
||||
WEECHAT_HDATA_LIST(last_irc_redirect_pattern, 0);
|
||||
}
|
||||
return hdata;
|
||||
}
|
||||
|
|
|
@ -4904,8 +4904,8 @@ irc_server_hdata_server_cb (void *data, const char *hdata_name)
|
|||
WEECHAT_HDATA_VAR(struct t_irc_server, last_channel, POINTER, 0, NULL, "irc_channel");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, prev_server, POINTER, 0, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, next_server, POINTER, 0, NULL, hdata_name);
|
||||
WEECHAT_HDATA_LIST(irc_servers);
|
||||
WEECHAT_HDATA_LIST(last_irc_server);
|
||||
WEECHAT_HDATA_LIST(irc_servers, WEECHAT_HDATA_LIST_CHECK_POINTERS);
|
||||
WEECHAT_HDATA_LIST(last_irc_server, 0);
|
||||
}
|
||||
return hdata;
|
||||
}
|
||||
|
|
|
@ -1380,8 +1380,9 @@ plugin_script_hdata_script (struct t_weechat_plugin *weechat_plugin,
|
|||
WEECHAT_HDATA_VAR(struct t_plugin_script, unloading, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_plugin_script, prev_script, POINTER, 0, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_plugin_script, next_script, POINTER, 0, NULL, hdata_name);
|
||||
weechat_hdata_new_list (hdata, "scripts", scripts);
|
||||
weechat_hdata_new_list (hdata, "last_script", last_script);
|
||||
weechat_hdata_new_list (hdata, "scripts", scripts,
|
||||
WEECHAT_HDATA_LIST_CHECK_POINTERS);
|
||||
weechat_hdata_new_list (hdata, "last_script", last_script, 0);
|
||||
}
|
||||
return hdata;
|
||||
}
|
||||
|
|
|
@ -1247,8 +1247,8 @@ plugin_hdata_plugin_cb (void *data, const char *hdata_name)
|
|||
HDATA_VAR(struct t_weechat_plugin, debug, INTEGER, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, prev_plugin, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_VAR(struct t_weechat_plugin, next_plugin, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_LIST(weechat_plugins);
|
||||
HDATA_LIST(last_weechat_plugin);
|
||||
HDATA_LIST(weechat_plugins, WEECHAT_HDATA_LIST_CHECK_POINTERS);
|
||||
HDATA_LIST(last_weechat_plugin, 0);
|
||||
}
|
||||
return hdata;
|
||||
}
|
||||
|
|
|
@ -1520,8 +1520,8 @@ script_repo_hdata_script_cb (void *data, const char *hdata_name)
|
|||
WEECHAT_HDATA_VAR(struct t_script_repo, install_order, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_script_repo, prev_script, POINTER, 0, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_script_repo, next_script, POINTER, 0, NULL, hdata_name);
|
||||
WEECHAT_HDATA_LIST(scripts_repo);
|
||||
WEECHAT_HDATA_LIST(last_script_repo);
|
||||
WEECHAT_HDATA_LIST(scripts_repo, WEECHAT_HDATA_LIST_CHECK_POINTERS);
|
||||
WEECHAT_HDATA_LIST(last_script_repo, 0);
|
||||
}
|
||||
return hdata;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ struct timeval;
|
|||
* please change the date with current one; for a second change at same
|
||||
* date, increment the 01, otherwise please keep 01.
|
||||
*/
|
||||
#define WEECHAT_PLUGIN_API_VERSION "20140313-01"
|
||||
#define WEECHAT_PLUGIN_API_VERSION "20140524-01"
|
||||
|
||||
/* macros for defining plugin infos */
|
||||
#define WEECHAT_PLUGIN_NAME(__name) \
|
||||
|
@ -125,6 +125,9 @@ struct timeval;
|
|||
#define WEECHAT_HDATA_HASHTABLE 7
|
||||
#define WEECHAT_HDATA_SHARED_STRING 8
|
||||
|
||||
/* flags for hdata lists */
|
||||
#define WEECHAT_HDATA_LIST_CHECK_POINTERS 1
|
||||
|
||||
/* buffer hotlist */
|
||||
#define WEECHAT_HOTLIST_LOW "0"
|
||||
#define WEECHAT_HOTLIST_MESSAGE "1"
|
||||
|
@ -879,7 +882,7 @@ struct t_weechat_plugin
|
|||
int type, int update_allowed, const char *array_size,
|
||||
const char *hdata_name);
|
||||
void (*hdata_new_list) (struct t_hdata *hdata, const char *name,
|
||||
void *pointer);
|
||||
void *pointer, int flags);
|
||||
struct t_hdata *(*hdata_get) (struct t_weechat_plugin *plugin,
|
||||
const char *hdata_name);
|
||||
int (*hdata_get_var_offset) (struct t_hdata *hdata, const char *name);
|
||||
|
@ -1685,10 +1688,10 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
|
|||
weechat_hdata_new_var (hdata, #__name, offsetof (__struct, __name), \
|
||||
WEECHAT_HDATA_##__type, __update_allowed, \
|
||||
__array_size, __hdata_name)
|
||||
#define weechat_hdata_new_list(__hdata, __name, __pointer) \
|
||||
weechat_plugin->hdata_new_list(__hdata, __name, __pointer)
|
||||
#define WEECHAT_HDATA_LIST(__name) \
|
||||
weechat_hdata_new_list (hdata, #__name, &(__name));
|
||||
#define weechat_hdata_new_list(__hdata, __name, __pointer, __flags) \
|
||||
weechat_plugin->hdata_new_list(__hdata, __name, __pointer, __flags)
|
||||
#define WEECHAT_HDATA_LIST(__name, __flags) \
|
||||
weechat_hdata_new_list (hdata, #__name, &(__name), __flags);
|
||||
#define weechat_hdata_get(__hdata_name) \
|
||||
weechat_plugin->hdata_get(weechat_plugin, __hdata_name)
|
||||
#define weechat_hdata_get_var_offset(__hdata, __name) \
|
||||
|
|
Loading…
Reference in New Issue