diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2012-07-20 18:12:07 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2012-07-20 18:12:07 +0200 |
commit | eab011073224b13ada61f80f3731e8dd459b7bfa (patch) | |
tree | bc05f9c4bd577a2c8ae7b8917098a4f6c54c8310 | |
parent | 658013a1e42967e498629367ac7d2d39ba7eec51 (diff) | |
download | weechat-eab011073224b13ada61f80f3731e8dd459b7bfa.zip |
core: add support of arrays in hdata variables
37 files changed, 1581 insertions, 614 deletions
@@ -1,12 +1,13 @@ WeeChat ChangeLog ================= Sébastien Helleu <flashcode@flashtux.org> -v0.3.9-dev, 2012-07-17 +v0.3.9-dev, 2012-07-20 Version 0.3.9 (under dev!) -------------------------- +* core: add support of arrays in hdata variables * core: add command line option "-r" (or "--run-command") to run command(s) after startup of WeeChat * core: fix refresh of bar items "buffer_filter" and "scroll" in root bars diff --git a/doc/de/autogen/plugin_api/hdata.txt b/doc/de/autogen/plugin_api/hdata.txt index 976954167..f406d200d 100644 --- a/doc/de/autogen/plugin_api/hdata.txt +++ b/doc/de/autogen/plugin_api/hdata.txt @@ -112,8 +112,8 @@ 'reloading_from_config' (integer) + 'reloaded_from_config' (integer) + 'addresses_count' (integer) + - 'addresses_array' (pointer) + - 'ports_array' (pointer) + + 'addresses_array' (string, array_size: 'addresses_count') + + 'ports_array' (integer, array_size: 'addresses_count') + 'index_current_address' (integer) + 'current_address' (string) + 'current_ip' (string) + @@ -130,7 +130,7 @@ 'tls_cert_key' (other) + 'unterminated_message' (string) + 'nicks_count' (integer) + - 'nicks_array' (pointer) + + 'nicks_array' (string, array_size: 'nicks_count') + 'nick_first_tried' (integer) + 'nick' (string) + 'nick_modes' (string) + @@ -176,7 +176,7 @@ 'name' (string) + 'options' (pointer) + 'conditions_count' (integer) + - 'conditions_array' (pointer) + + 'conditions_array' (string, array_size: 'conditions_count') + 'items_count' (integer) + 'items_subcount' (pointer) + 'items_array' (pointer) + @@ -283,7 +283,7 @@ 'highlight_regex_compiled' (pointer) + 'highlight_tags' (string) + 'highlight_tags_count' (integer) + - 'highlight_tags_array' (pointer) + + 'highlight_tags_array' (string, array_size: 'highlight_tags_count') + 'hotlist_max_level_nicks' (hashtable) + 'keys' (pointer, hdata: 'key') + 'last_key' (pointer, hdata: 'key') + @@ -344,7 +344,7 @@ 'name' (string) + 'type' (integer) + 'description' (string) + - 'string_values' (pointer) + + 'string_values' (string, array_size: '*') + 'min' (integer) + 'max' (integer) + 'default_value' (pointer) + @@ -390,7 +390,7 @@ 'buffers' (pointer) + 'tags' (string) + 'tags_count' (integer) + - 'tags_array' (pointer) + + 'tags_array' (string, array_size: 'tags_count') + 'regex' (string) + 'regex_prefix' (pointer) + 'regex_message' (pointer) + @@ -451,7 +451,7 @@ 'date_printed' (time) + 'str_time' (string) + 'tags_count' (integer) + - 'tags_array' (pointer) + + 'tags_array' (string, array_size: 'tags_count') + 'displayed' (char) + 'highlight' (char) + 'refresh_needed' (char) + diff --git a/doc/docgen.py b/doc/docgen.py index 4f60bc333..565288b0f 100644 --- a/doc/docgen.py +++ b/doc/docgen.py @@ -210,13 +210,17 @@ def get_hdata(): (key, value) = item.split(':') var_type = int(value) >> 16 var_offset = int(value) & 0xFFFF + var_array_size = weechat.hdata_get_var_array_size_string(ptr_hdata, '', key) + if var_array_size: + var_array_size = ', array_size: \'%s\'' % var_array_size var_hdata = weechat.hdata_get_var_hdata(ptr_hdata, key) if var_hdata: var_hdata = ', hdata: \'%s\'' % var_hdata hdata2.append({'offset': var_offset, - 'text': '\'%s\' (%s%s)' % (key, - weechat.hdata_get_var_type_string(ptr_hdata, key), - var_hdata)}) + 'text': '\'%s\' (%s%s%s)' % (key, + weechat.hdata_get_var_type_string(ptr_hdata, key), + var_array_size, + var_hdata)}) hdata2 = sorted(hdata2, key=itemgetter('offset')) for item in hdata2: if variables: diff --git a/doc/en/autogen/plugin_api/hdata.txt b/doc/en/autogen/plugin_api/hdata.txt index 075f94f66..31683b417 100644 --- a/doc/en/autogen/plugin_api/hdata.txt +++ b/doc/en/autogen/plugin_api/hdata.txt @@ -112,8 +112,8 @@ 'reloading_from_config' (integer) + 'reloaded_from_config' (integer) + 'addresses_count' (integer) + - 'addresses_array' (pointer) + - 'ports_array' (pointer) + + 'addresses_array' (string, array_size: 'addresses_count') + + 'ports_array' (integer, array_size: 'addresses_count') + 'index_current_address' (integer) + 'current_address' (string) + 'current_ip' (string) + @@ -130,7 +130,7 @@ 'tls_cert_key' (other) + 'unterminated_message' (string) + 'nicks_count' (integer) + - 'nicks_array' (pointer) + + 'nicks_array' (string, array_size: 'nicks_count') + 'nick_first_tried' (integer) + 'nick' (string) + 'nick_modes' (string) + @@ -176,7 +176,7 @@ 'name' (string) + 'options' (pointer) + 'conditions_count' (integer) + - 'conditions_array' (pointer) + + 'conditions_array' (string, array_size: 'conditions_count') + 'items_count' (integer) + 'items_subcount' (pointer) + 'items_array' (pointer) + @@ -283,7 +283,7 @@ 'highlight_regex_compiled' (pointer) + 'highlight_tags' (string) + 'highlight_tags_count' (integer) + - 'highlight_tags_array' (pointer) + + 'highlight_tags_array' (string, array_size: 'highlight_tags_count') + 'hotlist_max_level_nicks' (hashtable) + 'keys' (pointer, hdata: 'key') + 'last_key' (pointer, hdata: 'key') + @@ -344,7 +344,7 @@ 'name' (string) + 'type' (integer) + 'description' (string) + - 'string_values' (pointer) + + 'string_values' (string, array_size: '*') + 'min' (integer) + 'max' (integer) + 'default_value' (pointer) + @@ -390,7 +390,7 @@ 'buffers' (pointer) + 'tags' (string) + 'tags_count' (integer) + - 'tags_array' (pointer) + + 'tags_array' (string, array_size: 'tags_count') + 'regex' (string) + 'regex_prefix' (pointer) + 'regex_message' (pointer) + @@ -451,7 +451,7 @@ 'date_printed' (time) + 'str_time' (string) + 'tags_count' (integer) + - 'tags_array' (pointer) + + 'tags_array' (string, array_size: 'tags_count') + 'displayed' (char) + 'highlight' (char) + 'refresh_needed' (char) + diff --git a/doc/en/weechat_plugin_api.en.txt b/doc/en/weechat_plugin_api.en.txt index 63251824e..e7c711749 100644 --- a/doc/en/weechat_plugin_api.en.txt +++ b/doc/en/weechat_plugin_api.en.txt @@ -12652,7 +12652,7 @@ Prototype: [source,C] ---------------------------------------- void weechat_hdata_new_var (struct t_hdata *hdata, const char *name, int offset, int type, - const char *hdata_name); + const char *array_size, const char *hdata_name); ---------------------------------------- Arguments: @@ -12667,7 +12667,15 @@ Arguments: ** WEECHAT_HDATA_STRING ** WEECHAT_HDATA_POINTER ** WEECHAT_HDATA_TIME +** WEECHAT_HDATA_HASHTABLE ** WEECHAT_HDATA_OTHER +* 'array_size': not NULL only if a variable is an array, and it can be: + (_new in version 0.3.9_) +** name of variable in hdata: this variable will be used as size of array + (dynamic size for array) +** integer (as string): fixed size for array +** '*': automatic size: the size of array is computed by looking at values, when + the first NULL is found (only for type string, pointer or hashtable) * 'hdata_name': name of a hdata (if it's a pointer to a structure with hdata) C example: @@ -12678,7 +12686,9 @@ struct t_myplugin_list { char *name; struct t_gui_buffer *buffer; - int count; + int tags_count; + char **tags_array; + char **string_split; struct t_myplugin_list *prev; struct t_myplugin_list *next; }; @@ -12686,22 +12696,26 @@ struct t_myplugin_list /* ... */ struct t_hdata *hdata = weechat_hdata_new ("myplugin_list", "prev", "next"); -weechat_hdata_new_var (hdata, "name", offsetof (struct t_myplugin_list, name), WEECHAT_HDATA_STRING, NULL); -weechat_hdata_new_var (hdata, "buffer", offsetof (struct t_myplugin_list, buffer), WEECHAT_HDATA_POINTER, NULL); -weechat_hdata_new_var (hdata, "count", offsetof (struct t_myplugin_list, count), WEECHAT_HDATA_INTEGER, NULL); -weechat_hdata_new_var (hdata, "prev", offsetof (struct t_myplugin_list, prev), WEECHAT_HDATA_POINTER, "myplugin_list"); -weechat_hdata_new_var (hdata, "next", offsetof (struct t_myplugin_list, next), WEECHAT_HDATA_POINTER, "myplugin_list"); +weechat_hdata_new_var (hdata, "name", offsetof (struct t_myplugin_list, name), WEECHAT_HDATA_STRING, NULL, NULL); +weechat_hdata_new_var (hdata, "buffer", offsetof (struct t_myplugin_list, buffer), WEECHAT_HDATA_POINTER, NULL, NULL); +weechat_hdata_new_var (hdata, "tags_count", offsetof (struct t_myplugin_list, tags_count), WEECHAT_HDATA_INTEGER, NULL, NULL); +weechat_hdata_new_var (hdata, "tags_array", offsetof (struct t_myplugin_list, tags_array), WEECHAT_HDATA_STRING, "tags_count", NULL); +weechat_hdata_new_var (hdata, "string_split", offsetof (struct t_myplugin_list, string_split), WEECHAT_HDATA_STRING, "*", NULL); +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"); ---------------------------------------- The macro "WEECHAT_HDATA_VAR" can be used to shorten code: [source,C] ---------------------------------------- -WEECHAT_HDATA_VAR(struct t_myplugin_list, name, STRING, NULL); -WEECHAT_HDATA_VAR(struct t_myplugin_list, buffer, POINTER, NULL); -WEECHAT_HDATA_VAR(struct t_myplugin_list, count, INTEGER, NULL); -WEECHAT_HDATA_VAR(struct t_myplugin_list, prev, POINTER, "myplugin_list"); -WEECHAT_HDATA_VAR(struct t_myplugin_list, next, POINTER, "myplugin_list"); +WEECHAT_HDATA_VAR(struct t_myplugin_list, name, STRING, NULL, NULL); +WEECHAT_HDATA_VAR(struct t_myplugin_list, buffer, POINTER, NULL, NULL); +WEECHAT_HDATA_VAR(struct t_myplugin_list, tags_count, INTEGER, NULL, NULL); +WEECHAT_HDATA_VAR(struct t_myplugin_list, tags_array, STRING, "tags_count", NULL); +WEECHAT_HDATA_VAR(struct t_myplugin_list, string_split, STRING, "*", NULL); +WEECHAT_HDATA_VAR(struct t_myplugin_list, prev, POINTER, NULL, "myplugin_list"); +WEECHAT_HDATA_VAR(struct t_myplugin_list, next, POINTER, NULL, "myplugin_list"); ---------------------------------------- [NOTE] @@ -12735,22 +12749,24 @@ struct t_myplugin_list { char *name; struct t_gui_buffer *buffer; - int count; + int tags_count; + char **tags_array; + char **string_split; struct t_myplugin_list *prev; struct t_myplugin_list *next; }; -struct t_myplugin_list *buffers = NULL; -struct t_myplugin_list *last_buffer = NULL; - /* ... */ struct t_hdata *hdata = weechat_hdata_new ("myplugin_list", "prev", "next"); -weechat_hdata_new_var (hdata, "name", offsetof (struct t_myplugin_list, name), WEECHAT_HDATA_STRING, NULL); -weechat_hdata_new_var (hdata, "buffer", offsetof (struct t_myplugin_list, buffer), WEECHAT_HDATA_POINTER, NULL); -weechat_hdata_new_var (hdata, "count", offsetof (struct t_myplugin_list, count), WEECHAT_HDATA_INTEGER, NULL); -weechat_hdata_new_var (hdata, "prev", offsetof (struct t_myplugin_list, prev), WEECHAT_HDATA_POINTER, "myplugin_list"); -weechat_hdata_new_var (hdata, "next", offsetof (struct t_myplugin_list, next), WEECHAT_HDATA_POINTER, "myplugin_list"); +weechat_hdata_new_var (hdata, "name", offsetof (struct t_myplugin_list, name), WEECHAT_HDATA_STRING, NULL, NULL); +weechat_hdata_new_var (hdata, "buffer", offsetof (struct t_myplugin_list, buffer), WEECHAT_HDATA_POINTER, NULL, NULL); +weechat_hdata_new_var (hdata, "tags_count", offsetof (struct t_myplugin_list, tags_count), WEECHAT_HDATA_INTEGER, NULL, NULL); +weechat_hdata_new_var (hdata, "tags_array", offsetof (struct t_myplugin_list, tags_array), WEECHAT_HDATA_STRING, "tags_count", NULL); +weechat_hdata_new_var (hdata, "string_split", offsetof (struct t_myplugin_list, string_split), WEECHAT_HDATA_STRING, "*", NULL); +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); ---------------------------------------- @@ -12850,7 +12866,7 @@ Script (Python): offset = weechat.hdata_get_var_offset(hdata, name) # example -offset = weechat.hdata_get(hdata, "name") +offset = weechat.hdata_get_var_offset(hdata, "name") ---------------------------------------- weechat_hdata_get_var_type @@ -12901,6 +12917,9 @@ switch (type) case WEECHAT_HDATA_TIME: /* ... */ break; + case WEECHAT_HDATA_HASHTABLE: + /* ... */ + break; case WEECHAT_HDATA_OTHER: /* ... */ break; @@ -12954,6 +12973,92 @@ type = weechat.hdata_get_var_type_string(hdata, name) weechat.prnt("", "type = %s" % weechat.hdata_get_var_type_string("name")) ---------------------------------------- +weechat_hdata_get_var_array_size +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_New in version 0.3.9._ + +Return array size for variable in hdata. + +Prototype: + +[source,C] +---------------------------------------- +int weechat_hdata_get_var_array_size (struct t_hdata *hdata, void *pointer, const char *name); +---------------------------------------- + +Arguments: + +* 'hdata': hdata pointer +* 'pointer': pointer to WeeChat/plugin object +* 'name': variable name + +Return value: + +* array size for variable, -1 if variable is not an array or if an error occurred + +C example: + +[source,C] +---------------------------------------- +int array_size = weechat_hdata_get_var_array_size (hdata, pointer, "name"); +---------------------------------------- + +Script (Python): + +[source,python] +---------------------------------------- +# prototype +array_size = weechat.hdata_get_var_array_size(hdata, pointer, name) + +# example +array_size = weechat.hdata_get_var_array_size(hdata, pointer, "name") +---------------------------------------- + +weechat_hdata_get_var_array_size_string +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_New in version 0.3.9._ + +Return array size for variable in hdata (as string). + +Prototype: + +[source,C] +---------------------------------------- +const char *weechat_hdata_get_var_array_size_string (struct t_hdata *hdata, void *pointer, + const char *name); +---------------------------------------- + +Arguments: + +* 'hdata': hdata pointer +* 'pointer': pointer to WeeChat/plugin object +* 'name': variable name + +Return value: + +* array size for variable as string, NULL if variable is not an array or if an + error occurred + +C example: + +[source,C] +---------------------------------------- +const char *array_size = weechat_hdata_get_var_array_size_string (hdata, pointer, "name"); +---------------------------------------- + +Script (Python): + +[source,python] +---------------------------------------- +# prototype +array_size = weechat.hdata_get_var_array_size_string(hdata, pointer, name) + +# example +array_size = weechat.hdata_get_var_array_size_string(hdata, pointer, "name") +---------------------------------------- + weechat_hdata_get_var_hdata ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13247,7 +13352,8 @@ Arguments: * 'hdata': hdata pointer * 'pointer': pointer to WeeChat/plugin object -* 'name': variable name (must be type "char") +* 'name': variable name (must be type "char"); for arrays, the name can be + "N|name" where N is the index in array (starting at 0), for example: "2|name" Return value: @@ -13289,7 +13395,8 @@ Arguments: * 'hdata': hdata pointer * 'pointer': pointer to WeeChat/plugin object -* 'name': variable name (must be type "integer") +* 'name': variable name (must be type "integer"); for arrays, the name can be + "N|name" where N is the index in array (starting at 0), for example: "2|name" Return value: @@ -13335,7 +13442,8 @@ Arguments: * 'hdata': hdata pointer * 'pointer': pointer to WeeChat/plugin object -* 'name': variable name (must be type "long") +* 'name': variable name (must be type "long"); for arrays, the name can be + "N|name" where N is the index in array (starting at 0), for example: "2|name" Return value: @@ -13377,7 +13485,8 @@ Arguments: * 'hdata': hdata pointer * 'pointer': pointer to WeeChat/plugin object -* 'name': variable name (must be type "string") +* 'name': variable name (must be type "string"); for arrays, the name can be + "N|name" where N is the index in array (starting at 0), for example: "2|name" Return value: @@ -13423,7 +13532,8 @@ Arguments: * 'hdata': hdata pointer * 'pointer': pointer to WeeChat/plugin object -* 'name': variable name (must be type "pointer") +* 'name': variable name (must be type "pointer"); for arrays, the name can be + "N|name" where N is the index in array (starting at 0), for example: "2|name" Return value: @@ -13469,7 +13579,8 @@ Arguments: * 'hdata': hdata pointer * 'pointer': pointer to WeeChat/plugin object -* 'name': variable name (must be type "time") +* 'name': variable name (must be type "time"); for arrays, the name can be + "N|name" where N is the index in array (starting at 0), for example: "2|name" Return value: @@ -13540,7 +13651,8 @@ Arguments: * 'hdata': hdata pointer * 'pointer': pointer to WeeChat/plugin object -* 'name': variable name (must be type "hashtable") +* 'name': variable name (must be type "hashtable"); for arrays, the name can be + "N|name" where N is the index in array (starting at 0), for example: "2|name" Return value: diff --git a/doc/fr/autogen/plugin_api/hdata.txt b/doc/fr/autogen/plugin_api/hdata.txt index bdeb5fcc3..93c39dbca 100644 --- a/doc/fr/autogen/plugin_api/hdata.txt +++ b/doc/fr/autogen/plugin_api/hdata.txt @@ -112,8 +112,8 @@ 'reloading_from_config' (integer) + 'reloaded_from_config' (integer) + 'addresses_count' (integer) + - 'addresses_array' (pointer) + - 'ports_array' (pointer) + + 'addresses_array' (string, array_size: 'addresses_count') + + 'ports_array' (integer, array_size: 'addresses_count') + 'index_current_address' (integer) + 'current_address' (string) + 'current_ip' (string) + @@ -130,7 +130,7 @@ 'tls_cert_key' (other) + 'unterminated_message' (string) + 'nicks_count' (integer) + - 'nicks_array' (pointer) + + 'nicks_array' (string, array_size: 'nicks_count') + 'nick_first_tried' (integer) + 'nick' (string) + 'nick_modes' (string) + @@ -176,7 +176,7 @@ 'name' (string) + 'options' (pointer) + 'conditions_count' (integer) + - 'conditions_array' (pointer) + + 'conditions_array' (string, array_size: 'conditions_count') + 'items_count' (integer) + 'items_subcount' (pointer) + 'items_array' (pointer) + @@ -283,7 +283,7 @@ 'highlight_regex_compiled' (pointer) + 'highlight_tags' (string) + 'highlight_tags_count' (integer) + - 'highlight_tags_array' (pointer) + + 'highlight_tags_array' (string, array_size: 'highlight_tags_count') + 'hotlist_max_level_nicks' (hashtable) + 'keys' (pointer, hdata: 'key') + 'last_key' (pointer, hdata: 'key') + @@ -344,7 +344,7 @@ 'name' (string) + 'type' (integer) + 'description' (string) + - 'string_values' (pointer) + + 'string_values' (string, array_size: '*') + 'min' (integer) + 'max' (integer) + 'default_value' (pointer) + @@ -390,7 +390,7 @@ 'buffers' (pointer) + 'tags' (string) + 'tags_count' (integer) + - 'tags_array' (pointer) + + 'tags_array' (string, array_size: 'tags_count') + 'regex' (string) + 'regex_prefix' (pointer) + 'regex_message' (pointer) + @@ -451,7 +451,7 @@ 'date_printed' (time) + 'str_time' (string) + 'tags_count' (integer) + - 'tags_array' (pointer) + + 'tags_array' (string, array_size: 'tags_count') + 'displayed' (char) + 'highlight' (char) + 'refresh_needed' (char) + diff --git a/doc/fr/weechat_plugin_api.fr.txt b/doc/fr/weechat_plugin_api.fr.txt index fc234c704..45fe7e67f 100644 --- a/doc/fr/weechat_plugin_api.fr.txt +++ b/doc/fr/weechat_plugin_api.fr.txt @@ -12870,7 +12870,7 @@ Prototype : [source,C] ---------------------------------------- void weechat_hdata_new_var (struct t_hdata *hdata, const char *name, int offset, int type, - const char *hdata_name); + const char *array_size, const char *hdata_name); ---------------------------------------- Paramètres : @@ -12885,7 +12885,16 @@ Paramètres : ** WEECHAT_HDATA_STRING ** WEECHAT_HDATA_POINTER ** WEECHAT_HDATA_TIME +** WEECHAT_HDATA_HASHTABLE ** WEECHAT_HDATA_OTHER +* 'array_size' : non NULL seulement si la variable est un tableau, et peut être : + (_nouveau dans la version 0.3.9_) +** nom d'une variable du hdata : cette variable sera utilisée comme taille de + tableau (taille dynamique pour le tableau) +** entier (sous forme de chaîne) : taille fixe pour le tableau +** '*' : taille automatique : la taille est calculée en examinant les valeurs, + lorsque le premier NULL est trouvé (seulement pour le type string, pointer ou + hashtable) * 'hdata_name' : nom d'un hdata (si c'est un pointeur vers une structure qui a un hdata) @@ -12897,7 +12906,9 @@ struct t_myplugin_list { char *name; struct t_gui_buffer *buffer; - int count; + int tags_count; + char **tags_array; + char **string_split; struct t_myplugin_list *prev; struct t_myplugin_list *next; }; @@ -12905,22 +12916,26 @@ struct t_myplugin_list /* ... */ struct t_hdata *hdata = weechat_hdata_new ("myplugin_list", "prev", "next"); -weechat_hdata_new_var (hdata, "name", offsetof (struct t_myplugin_list, name), WEECHAT_HDATA_STRING, NULL); -weechat_hdata_new_var (hdata, "buffer", offsetof (struct t_myplugin_list, buffer), WEECHAT_HDATA_POINTER, NULL); -weechat_hdata_new_var (hdata, "count", offsetof (struct t_myplugin_list, count), WEECHAT_HDATA_INTEGER, NULL); -weechat_hdata_new_var (hdata, "prev", offsetof (struct t_myplugin_list, prev), WEECHAT_HDATA_POINTER, "myplugin_list"); -weechat_hdata_new_var (hdata, "next", offsetof (struct t_myplugin_list, next), WEECHAT_HDATA_POINTER, "myplugin_list"); +weechat_hdata_new_var (hdata, "name", offsetof (struct t_myplugin_list, name), WEECHAT_HDATA_STRING, NULL, NULL); +weechat_hdata_new_var (hdata, "buffer", offsetof (struct t_myplugin_list, buffer), WEECHAT_HDATA_POINTER, NULL, NULL); +weechat_hdata_new_var (hdata, "tags_count", offsetof (struct t_myplugin_list, tags_count), WEECHAT_HDATA_INTEGER, NULL, NULL); +weechat_hdata_new_var (hdata, "tags_array", offsetof (struct t_myplugin_list, tags_array), WEECHAT_HDATA_STRING, "tags_count", NULL); +weechat_hdata_new_var (hdata, "string_split", offsetof (struct t_myplugin_list, string_split), WEECHAT_HDATA_STRING, "*", NULL); +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"); ---------------------------------------- La macro "WEECHAT_HDATA_VAR" peut être utilisée pour raccourcir le code : [source,C] ---------------------------------------- -WEECHAT_HDATA_VAR(struct t_myplugin_list, name, STRING, NULL); -WEECHAT_HDATA_VAR(struct t_myplugin_list, buffer, POINTER, NULL); -WEECHAT_HDATA_VAR(struct t_myplugin_list, count, INTEGER, NULL); -WEECHAT_HDATA_VAR(struct t_myplugin_list, prev, POINTER, "myplugin_list"); -WEECHAT_HDATA_VAR(struct t_myplugin_list, next, POINTER, "myplugin_list"); +WEECHAT_HDATA_VAR(struct t_myplugin_list, name, STRING, NULL, NULL); +WEECHAT_HDATA_VAR(struct t_myplugin_list, buffer, POINTER, NULL, NULL); +WEECHAT_HDATA_VAR(struct t_myplugin_list, tags_count, INTEGER, NULL, NULL); +WEECHAT_HDATA_VAR(struct t_myplugin_list, tags_array, STRING, "tags_count", NULL); +WEECHAT_HDATA_VAR(struct t_myplugin_list, string_split, STRING, "*", NULL); +WEECHAT_HDATA_VAR(struct t_myplugin_list, prev, POINTER, NULL, "myplugin_list"); +WEECHAT_HDATA_VAR(struct t_myplugin_list, next, POINTER, NULL, "myplugin_list"); ---------------------------------------- [NOTE] @@ -12954,22 +12969,24 @@ struct t_myplugin_list { char *name; struct t_gui_buffer *buffer; - int count; + int tags_count; + char **tags_array; + char **string_split; struct t_myplugin_list *prev; struct t_myplugin_list *next; }; -struct t_myplugin_list *buffers = NULL; -struct t_myplugin_list *last_buffer = NULL; - /* ... */ struct t_hdata *hdata = weechat_hdata_new ("myplugin_list", "prev", "next"); -weechat_hdata_new_var (hdata, "name", offsetof (struct t_myplugin_list, name), WEECHAT_HDATA_STRING); -weechat_hdata_new_var (hdata, "buffer", offsetof (struct t_myplugin_list, buffer), WEECHAT_HDATA_POINTER); -weechat_hdata_new_var (hdata, "count", offsetof (struct t_myplugin_list, count), WEECHAT_HDATA_INTEGER); -weechat_hdata_new_var (hdata, "prev", offsetof (struct t_myplugin_list, prev), WEECHAT_HDATA_POINTER); -weechat_hdata_new_var (hdata, "next", offsetof (struct t_myplugin_list, next), WEECHAT_HDATA_POINTER); +weechat_hdata_new_var (hdata, "name", offsetof (struct t_myplugin_list, name), WEECHAT_HDATA_STRING, NULL, NULL); +weechat_hdata_new_var (hdata, "buffer", offsetof (struct t_myplugin_list, buffer), WEECHAT_HDATA_POINTER, NULL, NULL); +weechat_hdata_new_var (hdata, "tags_count", offsetof (struct t_myplugin_list, tags_count), WEECHAT_HDATA_INTEGER, NULL, NULL); +weechat_hdata_new_var (hdata, "tags_array", offsetof (struct t_myplugin_list, tags_array), WEECHAT_HDATA_STRING, "tags_count", NULL); +weechat_hdata_new_var (hdata, "string_split", offsetof (struct t_myplugin_list, string_split), WEECHAT_HDATA_STRING, "*", NULL); +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); ---------------------------------------- @@ -13070,7 +13087,7 @@ Script (Python) : offset = weechat.hdata_get_var_offset(hdata, name) # exemple -offset = weechat.hdata_get(hdata, "name") +offset = weechat.hdata_get_var_offset(hdata, "name") ---------------------------------------- weechat_hdata_get_var_type @@ -13121,6 +13138,9 @@ switch (type) case WEECHAT_HDATA_TIME: /* ... */ break; + case WEECHAT_HDATA_HASHTABLE: + /* ... */ + break; case WEECHAT_HDATA_OTHER: /* ... */ break; @@ -13174,6 +13194,94 @@ type = weechat.hdata_get_var_type_string(hdata, name) weechat.prnt("", "type = %s" % weechat.hdata_get_var_type_string(hdata, "name")) ---------------------------------------- +weechat_hdata_get_var_array_size +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_Nouveau dans la version 0.3.9._ + +Retourne la taille du tableau pour la variable dans le hdata. + +Prototype : + +[source,C] +---------------------------------------- +int weechat_hdata_get_var_array_size (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 + +Valeur de retour : + +* taille du tableau pour la variable, -1 si la variable n'est pas un tableau ou + en cas d'erreur + +Exemple en C : + +[source,C] +---------------------------------------- +int array_size = weechat_hdata_get_var_array_size (hdata, pointer, "name"); +---------------------------------------- + +Script (Python) : + +[source,python] +---------------------------------------- +# prototype +array_size = weechat.hdata_get_var_array_size(hdata, pointer, name) + +# exemple +array_size = weechat.hdata_get_var_array_size(hdata, pointer, "name") +---------------------------------------- + +weechat_hdata_get_var_array_size_string +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_Nouveau dans la version 0.3.9._ + +Retourne la taille du tableau pour la variable dans le hdata (sous forme de +chaîne). + +Prototype : + +[source,C] +---------------------------------------- +const char *weechat_hdata_get_var_count_array_size (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 + +Valeur de retour : + +* taille du tableau pour la variable sous forme de chaîne, -1 si la variable + n'est pas un tableau ou en cas d'erreur + +Exemple en C : + +[source,C] +---------------------------------------- +const char *array_size = weechat_hdata_get_var_array_size_string (hdata, pointer, "name"); +---------------------------------------- + +Script (Python) : + +[source,python] +---------------------------------------- +# prototype +array_size = weechat.hdata_get_var_array_size_string(hdata, pointer, name) + +# exemple +array_size = weechat.hdata_get_var_array_size_string(hdata, pointer, "name") +---------------------------------------- + weechat_hdata_get_var_hdata ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13469,7 +13577,9 @@ 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 "char") +* 'name' : nom de la variable (doit être de type "char"); pour les tableaux, + le nom peut être "N|name" où N est un index dans le tableau (démarrant à 0), + par exemple: "2|name" Valeur de retour : @@ -13512,7 +13622,9 @@ 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 "integer") +* 'name' : nom de la variable (doit être de type "integer"); pour les tableaux, + le nom peut être "N|name" où N est un index dans le tableau (démarrant à 0), + par exemple: "2|name" Valeur de retour : @@ -13559,7 +13671,9 @@ 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 "long") +* 'name' : nom de la variable (doit être de type "long"); pour les tableaux, + le nom peut être "N|name" où N est un index dans le tableau (démarrant à 0), + par exemple: "2|name" Valeur de retour : @@ -13602,7 +13716,9 @@ 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 "string") +* 'name' : nom de la variable (doit être de type "string"); pour les tableaux, + le nom peut être "N|name" où N est un index dans le tableau (démarrant à 0), + par exemple: "2|name" Valeur de retour : @@ -13649,7 +13765,9 @@ 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 "pointeur") +* 'name' : nom de la variable (doit être de type "pointeur"); pour les tableaux, + le nom peut être "N|name" où N est un index dans le tableau (démarrant à 0), + par exemple: "2|name" Valeur de retour : @@ -13696,7 +13814,9 @@ 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 "time") +* 'name' : nom de la variable (doit être de type "time"); pour les tableaux, + le nom peut être "N|name" où N est un index dans le tableau (démarrant à 0), + par exemple: "2|name" Valeur de retour : @@ -13768,7 +13888,9 @@ 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") +* 'name' : nom de la variable (doit être de type "hashtable"); pour les tableaux, + le nom peut être "N|name" où N est un index dans le tableau (démarrant à 0), + par exemple: "2|name" Valeur de retour : diff --git a/doc/it/autogen/plugin_api/hdata.txt b/doc/it/autogen/plugin_api/hdata.txt index 7f534393e..c7daeb518 100644 --- a/doc/it/autogen/plugin_api/hdata.txt +++ b/doc/it/autogen/plugin_api/hdata.txt @@ -112,8 +112,8 @@ 'reloading_from_config' (integer) + 'reloaded_from_config' (integer) + 'addresses_count' (integer) + - 'addresses_array' (pointer) + - 'ports_array' (pointer) + + 'addresses_array' (string, array_size: 'addresses_count') + + 'ports_array' (integer, array_size: 'addresses_count') + 'index_current_address' (integer) + 'current_address' (string) + 'current_ip' (string) + @@ -130,7 +130,7 @@ 'tls_cert_key' (other) + 'unterminated_message' (string) + 'nicks_count' (integer) + - 'nicks_array' (pointer) + + 'nicks_array' (string, array_size: 'nicks_count') + 'nick_first_tried' (integer) + 'nick' (string) + 'nick_modes' (string) + @@ -176,7 +176,7 @@ 'name' (string) + 'options' (pointer) + 'conditions_count' (integer) + - 'conditions_array' (pointer) + + 'conditions_array' (string, array_size: 'conditions_count') + 'items_count' (integer) + 'items_subcount' (pointer) + 'items_array' (pointer) + @@ -283,7 +283,7 @@ 'highlight_regex_compiled' (pointer) + 'highlight_tags' (string) + 'highlight_tags_count' (integer) + - 'highlight_tags_array' (pointer) + + 'highlight_tags_array' (string, array_size: 'highlight_tags_count') + 'hotlist_max_level_nicks' (hashtable) + 'keys' (pointer, hdata: 'key') + 'last_key' (pointer, hdata: 'key') + @@ -344,7 +344,7 @@ 'name' (string) + 'type' (integer) + 'description' (string) + - 'string_values' (pointer) + + 'string_values' (string, array_size: '*') + 'min' (integer) + 'max' (integer) + 'default_value' (pointer) + @@ -390,7 +390,7 @@ 'buffers' (pointer) + 'tags' (string) + 'tags_count' (integer) + - 'tags_array' (pointer) + + 'tags_array' (string, array_size: 'tags_count') + 'regex' (string) + 'regex_prefix' (pointer) + 'regex_message' (pointer) + @@ -451,7 +451,7 @@ 'date_printed' (time) + 'str_time' (string) + 'tags_count' (integer) + - 'tags_array' (pointer) + + 'tags_array' (string, array_size: 'tags_count') + 'displayed' (char) + 'highlight' (char) + 'refresh_needed' (char) + diff --git a/doc/it/weechat_plugin_api.it.txt b/doc/it/weechat_plugin_api.it.txt index 1f8ab88fb..7e49e13e9 100644 --- a/doc/it/weechat_plugin_api.it.txt +++ b/doc/it/weechat_plugin_api.it.txt @@ -12772,7 +12772,7 @@ Prototipo: [source,C] ---------------------------------------- void weechat_hdata_new_var (struct t_hdata *hdata, const char *name, int offset, int type, - const char *hdata_name); + const char *array_size, const char *hdata_name); ---------------------------------------- Argomenti: @@ -12787,7 +12787,16 @@ Argomenti: ** WEECHAT_HDATA_STRING ** WEECHAT_HDATA_POINTER ** WEECHAT_HDATA_TIME +** WEECHAT_HDATA_HASHTABLE ** WEECHAT_HDATA_OTHER +// TRANSLATION MISSING +* 'array_size': not NULL only if a variable is an array, and it can be: + (_novità nella versione 0.3.9_) +** name of variable in hdata: this variable will be used as size of array + (dynamic size for array) +** integer (as string): fixed size for array +** '*': automatic size: the size of array is computed by looking at values, when + the first NULL is found (only for type string, pointer or hashtable) * 'hdata_name': nome di un hdata (se è un puntatore ad una struttura con dati) Esempio in C: @@ -12798,7 +12807,9 @@ struct t_myplugin_list { char *name; struct t_gui_buffer *buffer; - int count; + int tags_count; + char **tags_array; + char **string_split; struct t_myplugin_list *prev; struct t_myplugin_list *next; }; @@ -12806,22 +12817,26 @@ struct t_myplugin_list /* ... */ struct t_hdata *hdata = weechat_hdata_new ("myplugin_list", "prev", "next"); -weechat_hdata_new_var (hdata, "name", offsetof (struct t_myplugin_list, name), WEECHAT_HDATA_STRING, NULL); -weechat_hdata_new_var (hdata, "buffer", offsetof (struct t_myplugin_list, buffer), WEECHAT_HDATA_POINTER, NULL); -weechat_hdata_new_var (hdata, "count", offsetof (struct t_myplugin_list, count), WEECHAT_HDATA_INTEGER, NULL); -weechat_hdata_new_var (hdata, "prev", offsetof (struct t_myplugin_list, prev), WEECHAT_HDATA_POINTER, "myplugin_list"); -weechat_hdata_new_var (hdata, "next", offsetof (struct t_myplugin_list, next), WEECHAT_HDATA_POINTER, "myplugin_list"); +weechat_hdata_new_var (hdata, "name", offsetof (struct t_myplugin_list, name), WEECHAT_HDATA_STRING, NULL, NULL); +weechat_hdata_new_var (hdata, "buffer", offsetof (struct t_myplugin_list, buffer), WEECHAT_HDATA_POINTER, NULL, NULL); +weechat_hdata_new_var (hdata, "tags_count", offsetof (struct t_myplugin_list, tags_count), WEECHAT_HDATA_INTEGER, NULL, NULL); +weechat_hdata_new_var (hdata, "tags_array", offsetof (struct t_myplugin_list, tags_array), WEECHAT_HDATA_STRING, "tags_count", NULL); +weechat_hdata_new_var (hdata, "string_split", offsetof (struct t_myplugin_list, string_split), WEECHAT_HDATA_STRING, "*", NULL); +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"); ---------------------------------------- La macro "WEECHAT_HDATA_VAR" può essere usata per accorciare il codice: [source,C] ---------------------------------------- -WEECHAT_HDATA_VAR(struct t_myplugin_list, name, STRING, NULL); -WEECHAT_HDATA_VAR(struct t_myplugin_list, buffer, POINTER, NULL); -WEECHAT_HDATA_VAR(struct t_myplugin_list, count, INTEGER, NULL); -WEECHAT_HDATA_VAR(struct t_myplugin_list, prev, POINTER, "myplugin_list"); -WEECHAT_HDATA_VAR(struct t_myplugin_list, next, POINTER, "myplugin_list"); +WEECHAT_HDATA_VAR(struct t_myplugin_list, name, STRING, NULL, NULL); +WEECHAT_HDATA_VAR(struct t_myplugin_list, buffer, POINTER, NULL, NULL); +WEECHAT_HDATA_VAR(struct t_myplugin_list, tags_count, INTEGER, NULL, NULL); +WEECHAT_HDATA_VAR(struct t_myplugin_list, tags_array, STRING, "tags_count", NULL); +WEECHAT_HDATA_VAR(struct t_myplugin_list, string_split, STRING, "*", NULL); +WEECHAT_HDATA_VAR(struct t_myplugin_list, prev, POINTER, NULL, "myplugin_list"); +WEECHAT_HDATA_VAR(struct t_myplugin_list, next, POINTER, NULL, "myplugin_list"); ---------------------------------------- [NOTE] @@ -12855,22 +12870,24 @@ struct t_myplugin_list { char *name; struct t_gui_buffer *buffer; - int count; - struct t_myplugin_list *prev; + int tags_count; + char **tags_array; + char **string_split; + struct t_myplugin_list *prev; struct t_myplugin_list *next; }; -struct t_myplugin_list *buffers = NULL; -struct t_myplugin_list *last_buffer = NULL; - /* ... */ struct t_hdata *hdata = weechat_hdata_new ("myplugin_list", "prev", "next"); -weechat_hdata_new_var (hdata, "name", offsetof (struct t_myplugin_list, name), WEECHAT_HDATA_STRING, NULL); -weechat_hdata_new_var (hdata, "buffer", offsetof (struct t_myplugin_list, buffer), WEECHAT_HDATA_POINTER, NULL); -weechat_hdata_new_var (hdata, "count", offsetof (struct t_myplugin_list, count), WEECHAT_HDATA_INTEGER, NULL); -weechat_hdata_new_var (hdata, "prev", offsetof (struct t_myplugin_list, prev), WEECHAT_HDATA_POINTER, "myplugin_list"); -weechat_hdata_new_var (hdata, "next", offsetof (struct t_myplugin_list, next), WEECHAT_HDATA_POINTER, "myplugin_list"); +weechat_hdata_new_var (hdata, "name", offsetof (struct t_myplugin_list, name), WEECHAT_HDATA_STRING, NULL, NULL); +weechat_hdata_new_var (hdata, "buffer", offsetof (struct t_myplugin_list, buffer), WEECHAT_HDATA_POINTER, NULL, NULL); +weechat_hdata_new_var (hdata, "tags_count", offsetof (struct t_myplugin_list, tags_count), WEECHAT_HDATA_INTEGER, NULL, NULL); +weechat_hdata_new_var (hdata, "tags_array", offsetof (struct t_myplugin_list, tags_array), WEECHAT_HDATA_STRING, "tags_count", NULL); +weechat_hdata_new_var (hdata, "string_split", offsetof (struct t_myplugin_list, string_split), WEECHAT_HDATA_STRING, "*", NULL); +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); ---------------------------------------- @@ -12970,7 +12987,7 @@ Script (Python): offset = weechat.hdata_get_var_offset(hdata, name) # esempio -offset = weechat.hdata_get(hdata, "name") +offset = weechat.hdata_get_var_offset(hdata, "name") ---------------------------------------- weechat_hdata_get_var_type @@ -13021,6 +13038,9 @@ switch (type) case WEECHAT_HDATA_TIME: /* ... */ break; + case WEECHAT_HDATA_HASHTABLE: + /* ... */ + break; case WEECHAT_HDATA_OTHER: /* ... */ break; @@ -13075,6 +13095,96 @@ type = weechat.hdata_get_var_type_string(hdata, name) weechat.prnt("", "type = %s" % weechat.hdata_get_var_type_string(hdata, "name")) ---------------------------------------- +weechat_hdata_get_var_array_size +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_Novità nella versione 0.3.9._ + +// TRANSLATION MISSING +Return array size for variable in hdata. + +Prototipo: + +[source,C] +---------------------------------------- +int weechat_hdata_get_var_array_size (struct t_hdata *hdata, void *pointer, const char *name); +---------------------------------------- + +Argomenti: + +* 'hdata': puntatore hdata +* 'pointer': puntarore all'oggetto di WeeChat/plugin +* 'name': nome della variabile + +Valore restituito: + +// TRANSLATION MISSING +* array size for variable, -1 if variable is not an array or if an error occurred + +Esempio in C: + +[source,C] +---------------------------------------- +int array_size = weechat_hdata_get_var_array_size (hdata, pointer, "name"); +---------------------------------------- + +Script (Python): + +[source,python] +---------------------------------------- +# prototipo +array_size = weechat.hdata_get_var_array_size(hdata, pointer, name) + +# esempio +array_size = weechat.hdata_get_var_array_size(hdata, pointer, "name") +---------------------------------------- + +weechat_hdata_get_var_array_size_string +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_Novità nella versione 0.3.9._ + +// TRANSLATION MISSING +Return array size for variable in hdata (as string). + +Prototipo: + +[source,C] +---------------------------------------- +const char *weechat_hdata_get_var_array_size_string (struct t_hdata *hdata, void *pointer, + const char *name); +---------------------------------------- + +Argomenti: + +* 'hdata': puntatore hdata +* 'pointer': puntarore all'oggetto di WeeChat/plugin +* 'name': nome della variabile + +Valore restituito: + +// TRANSLATION MISSING +* array size for variable as string, NULL if variable is not an array or if an + error occurred + +Esempio in C: + +[source,C] +---------------------------------------- +const char *array_size = weechat_hdata_get_var_array_size_string (hdata, pointer, "name"); +---------------------------------------- + +Script (Python): + +[source,python] +---------------------------------------- +# prototipo +array_size = weechat.hdata_get_var_array_size_string(hdata, pointer, name) + +# esempio +array_size = weechat.hdata_get_var_array_size_string(hdata, pointer, "name") +---------------------------------------- + weechat_hdata_get_var_hdata ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13368,7 +13478,10 @@ Argomenti: * 'hdata': puntatore hdata * 'pointer': puntatore all'oggetto di WeeChat/plugin -* 'name': nome della variabile (deve essere di tipo "char") +// TRANSLATION MISSING +* 'name': nome della variabile (deve essere di tipo "char"); for arrays, + the name can be "N|name" where N is the index in array (starting at 0), + for example: "2|name" Valore restituito: @@ -13410,7 +13523,10 @@ Argomenti: * 'hdata': puntatore hdata * 'pointer': puntatore all'oggetto di WeeChat/plugin -* 'name': nome della variabile (deve essere di tipo "integer") +// TRANSLATION MISSING +* 'name': nome della variabile (deve essere di tipo "integer"); for arrays, + the name can be "N|name" where N is the index in array (starting at 0), + for example: "2|name" Valore restituito: @@ -13456,7 +13572,10 @@ Argomenti: * 'hdata': puntatore hdata * 'pointer': puntatore all'oggetto di WeeChat/plugin -* 'name': nome della variabile (deve essere di tipo "long") +// TRANSLATION MISSING +* 'name': nome della variabile (deve essere di tipo "long"); for arrays, + the name can be "N|name" where N is the index in array (starting at 0), + for example: "2|name" Valore restituito: @@ -13498,7 +13617,10 @@ Argomenti: * 'hdata': puntatore hdata * 'pointer': puntatore all'oggetto di WeeChat/plugin -* 'name': nome della variabile (deve essere di tipo "string") +// TRANSLATION MISSING +* 'name': nome della variabile (deve essere di tipo "string"); for arrays, + the name can be "N|name" where N is the index in array (starting at 0), + for example: "2|name" Valore restituito: @@ -13544,7 +13666,10 @@ Argomenti: * 'hdata': hdata hdata * 'pointer': pointer all'oggetto di WeeChat/plugin -* 'name': nome della variabile (deve essere di tipo "pointer") +// TRANSLATION MISSING +* 'name': nome della variabile (deve essere di tipo "pointer"); for arrays, + the name can be "N|name" where N is the index in array (starting at 0), + for example: "2|name" Valore restituito: @@ -13590,7 +13715,10 @@ Argomenti: * 'hdata': puntatore hdata * 'pointer': puntatore all'oggetto di WeeChat/plugin -* 'name': nome della variabile (deve essere di tipo "time") +// TRANSLATION MISSING +* 'name': nome della variabile (deve essere di tipo "time"); for arrays, + the name can be "N|name" where N is the index in array (starting at 0), + for example: "2|name" Valore restituito: @@ -13662,7 +13790,10 @@ Argomenti: * 'hdata': puntatore hdata * 'pointer': puntatore all'oggetto di WeeChat/plugin -* 'name': nome della variabile (deve essere di tipo "hashtable") +// TRANSLATION MISSING +* 'name': nome della variabile (deve essere di tipo "hashtable"); for arrays, + the name can be "N|name" where N is the index in array (starting at 0), + for example: "2|name" Valore restituito: diff --git a/src/core/wee-config-file.c b/src/core/wee-config-file.c index 32c0561a4..aecb438b5 100644 --- a/src/core/wee-config-file.c +++ b/src/core/wee-config-file.c @@ -2609,16 +2609,16 @@ config_file_hdata_config_file_cb (void *data, const char *hdata_name) hdata = hdata_new (NULL, hdata_name, "prev_config", "next_config"); if (hdata) { - HDATA_VAR(struct t_config_file, plugin, POINTER, "plugin"); - HDATA_VAR(struct t_config_file, name, STRING, NULL); - HDATA_VAR(struct t_config_file, filename, STRING, NULL); - HDATA_VAR(struct t_config_file, file, POINTER, NULL); - HDATA_VAR(struct t_config_file, callback_reload, POINTER, NULL); - HDATA_VAR(struct t_config_file, callback_reload_data, POINTER, NULL); - HDATA_VAR(struct t_config_file, sections, POINTER, "config_section"); - HDATA_VAR(struct t_config_file, last_section, POINTER, "config_section"); - HDATA_VAR(struct t_config_file, prev_config, POINTER, hdata_name); - HDATA_VAR(struct t_config_file, next_config, POINTER, hdata_name); + HDATA_VAR(struct t_config_file, plugin, POINTER, NULL, "plugin"); + HDATA_VAR(struct t_config_file, name, STRING, NULL, NULL); + HDATA_VAR(struct t_config_file, filename, STRING, NULL, NULL); + HDATA_VAR(struct t_config_file, file, POINTER, NULL, NULL); + HDATA_VAR(struct t_config_file, callback_reload, POINTER, NULL, NULL); + HDATA_VAR(struct t_config_file, callback_reload_data, POINTER, NULL, NULL); + HDATA_VAR(struct t_config_file, sections, POINTER, NULL, "config_section"); + HDATA_VAR(struct t_config_file, last_section, POINTER, NULL, "config_section"); + HDATA_VAR(struct t_config_file, prev_config, POINTER, NULL, hdata_name); + HDATA_VAR(struct t_config_file, next_config, POINTER, NULL, hdata_name); HDATA_LIST(config_files); HDATA_LIST(last_config_file); } @@ -2640,24 +2640,24 @@ config_file_hdata_config_section_cb (void *data, const char *hdata_name) hdata = hdata_new (NULL, hdata_name, "prev_section", "next_section"); if (hdata) { - HDATA_VAR(struct t_config_section, config_file, POINTER, "config_file"); - HDATA_VAR(struct t_config_section, name, STRING, NULL); - HDATA_VAR(struct t_config_section, user_can_add_options, INTEGER, NULL); - HDATA_VAR(struct t_config_section, user_can_delete_options, INTEGER, NULL); - HDATA_VAR(struct t_config_section, callback_read, POINTER, NULL); - HDATA_VAR(struct t_config_section, callback_read_data, POINTER, NULL); - HDATA_VAR(struct t_config_section, callback_write, POINTER, NULL); - HDATA_VAR(struct t_config_section, callback_write_data, POINTER, NULL); - HDATA_VAR(struct t_config_section, callback_write_default, POINTER, NULL); - HDATA_VAR(struct t_config_section, callback_write_default_data, POINTER, NULL); - HDATA_VAR(struct t_config_section, callback_create_option, POINTER, NULL); - HDATA_VAR(struct t_config_section, callback_create_option_data, POINTER, NULL); - HDATA_VAR(struct t_config_section, callback_delete_option, POINTER, NULL); - HDATA_VAR(struct t_config_section, callback_delete_option_data, POINTER, NULL); - HDATA_VAR(struct t_config_section, options, POINTER, "config_option"); - HDATA_VAR(struct t_config_section, last_option, POINTER, "config_option"); - HDATA_VAR(struct t_config_section, prev_section, POINTER, hdata_name); - HDATA_VAR(struct t_config_section, next_section, POINTER, hdata_name); + HDATA_VAR(struct t_config_section, config_file, POINTER, NULL, "config_file"); + HDATA_VAR(struct t_config_section, name, STRING, NULL, NULL); + HDATA_VAR(struct t_config_section, user_can_add_options, INTEGER, NULL, NULL); + HDATA_VAR(struct t_config_section, user_can_delete_options, INTEGER, NULL, NULL); + HDATA_VAR(struct t_config_section, callback_read, POINTER, NULL, NULL); + HDATA_VAR(struct t_config_section, callback_read_data, POINTER, NULL, NULL); + HDATA_VAR(struct t_config_section, callback_write, POINTER, NULL, NULL); + HDATA_VAR(struct t_config_section, callback_write_data, POINTER, NULL, NULL); + HDATA_VAR(struct t_config_section, callback_write_default, POINTER, NULL, NULL); + HDATA_VAR(struct t_config_section, callback_write_default_data, POINTER, NULL, NULL); + HDATA_VAR(struct t_config_section, callback_create_option, POINTER, NULL, NULL); + HDATA_VAR(struct t_config_section, callback_create_option_data, POINTER, NULL, NULL); + HDATA_VAR(struct t_config_section, callback_delete_option, POINTER, NULL, NULL); + HDATA_VAR(struct t_config_section, callback_delete_option_data, POINTER, NULL, NULL); + HDATA_VAR(struct t_config_section, options, POINTER, NULL, "config_option"); + HDATA_VAR(struct t_config_section, last_option, POINTER, NULL, "config_option"); + HDATA_VAR(struct t_config_section, prev_section, POINTER, NULL, hdata_name); + HDATA_VAR(struct t_config_section, next_section, POINTER, NULL, hdata_name); } return hdata; } @@ -2677,26 +2677,26 @@ config_file_hdata_config_option_cb (void *data, const char *hdata_name) hdata = hdata_new (NULL, hdata_name, "prev_option", "next_option"); if (hdata) { - HDATA_VAR(struct t_config_option, config_file, POINTER, "config_file"); - HDATA_VAR(struct t_config_option, section, POINTER, "config_section"); - HDATA_VAR(struct t_config_option, name, STRING, NULL); - HDATA_VAR(struct t_config_option, type, INTEGER, NULL); - HDATA_VAR(struct t_config_option, description, STRING, NULL); - HDATA_VAR(struct t_config_option, string_values, POINTER, NULL); - HDATA_VAR(struct t_config_option, min, INTEGER, NULL); - HDATA_VAR(struct t_config_option, max, INTEGER, NULL); - HDATA_VAR(struct t_config_option, default_value, POINTER, NULL); - HDATA_VAR(struct t_config_option, value, POINTER, NULL); - HDATA_VAR(struct t_config_option, null_value_allowed, INTEGER, NULL); - HDATA_VAR(struct t_config_option, callback_check_value, POINTER, NULL); - HDATA_VAR(struct t_config_option, callback_check_value_data, POINTER, NULL); - HDATA_VAR(struct t_config_option, callback_change, POINTER, NULL); - HDATA_VAR(struct t_config_option, callback_change_data, POINTER, NULL); - HDATA_VAR(struct t_config_option, callback_delete, POINTER, NULL); - HDATA_VAR(struct t_config_option, callback_delete_data, POINTER, NULL); - HDATA_VAR(struct t_config_option, loaded, INTEGER, NULL); - HDATA_VAR(struct t_config_option, prev_option, POINTER, hdata_name); - HDATA_VAR(struct t_config_option, next_option, POINTER, hdata_name); + HDATA_VAR(struct t_config_option, config_file, POINTER, NULL, "config_file"); + HDATA_VAR(struct t_config_option, section, POINTER, NULL, "config_section"); + HDATA_VAR(struct t_config_option, name, STRING, NULL, NULL); + HDATA_VAR(struct t_config_option, type, INTEGER, NULL, NULL); + HDATA_VAR(struct t_config_option, description, STRING, NULL, NULL); + HDATA_VAR(struct t_config_option, string_values, STRING, "*", NULL); + HDATA_VAR(struct t_config_option, min, INTEGER, NULL, NULL); + HDATA_VAR(struct t_config_option, max, INTEGER, NULL, NULL); + HDATA_VAR(struct t_config_option, default_value, POINTER, NULL, NULL); + HDATA_VAR(struct t_config_option, value, POINTER, NULL, NULL); + HDATA_VAR(struct t_config_option, null_value_allowed, INTEGER, NULL, NULL); + HDATA_VAR(struct t_config_option, callback_check_value, POINTER, NULL, NULL); + HDATA_VAR(struct t_config_option, callback_check_value_data, POINTER, NULL, NULL); + HDATA_VAR(struct t_config_option, callback_change, POINTER, NULL, NULL); + HDATA_VAR(struct t_config_option, callback_change_data, POINTER, NULL, NULL); + HDATA_VAR(struct t_config_option, callback_delete, POINTER, NULL, NULL); + HDATA_VAR(struct t_config_option, callback_delete_data, POINTER, NULL, NULL); + HDATA_VAR(struct t_config_option, loaded, INTEGER, NULL, NULL); + HDATA_VAR(struct t_config_option, prev_option, POINTER, NULL, hdata_name); + HDATA_VAR(struct t_config_option, next_option, POINTER, NULL, hdata_name); } return hdata; } diff --git a/src/core/wee-hdata.c b/src/core/wee-hdata.c index 512062993..0c0391063 100644 --- a/src/core/wee-hdata.c +++ b/src/core/wee-hdata.c @@ -18,7 +18,7 @@ */ /* - * wee-hdata.c: direct access to WeeChat data using hashtables (for C plugins) + * wee-hdata.c: direct access to WeeChat data using hashtables */ #ifdef HAVE_CONFIG_H @@ -60,13 +60,18 @@ hdata_new (struct t_weechat_plugin *plugin, const char *hdata_name, if (new_hdata) { new_hdata->plugin = plugin; + new_hdata->var_prev = (var_prev) ? strdup (var_prev) : NULL; + new_hdata->var_next = (var_next) ? strdup (var_next) : NULL; new_hdata->hash_var = hashtable_new (8, WEECHAT_HASHTABLE_STRING, WEECHAT_HASHTABLE_INTEGER, NULL, NULL); - new_hdata->var_prev = (var_prev) ? strdup (var_prev) : NULL; - new_hdata->var_next = (var_next) ? strdup (var_next) : NULL; + new_hdata->hash_var_array_size = hashtable_new (8, + WEECHAT_HASHTABLE_STRING, + WEECHAT_HASHTABLE_STRING, + NULL, + NULL); new_hdata->hash_var_hdata = hashtable_new (8, WEECHAT_HASHTABLE_STRING, WEECHAT_HASHTABLE_STRING, @@ -89,7 +94,7 @@ hdata_new (struct t_weechat_plugin *plugin, const char *hdata_name, void hdata_new_var (struct t_hdata *hdata, const char *name, int offset, int type, - const char *hdata_name) + const char *array_size, const char *hdata_name) { int value; @@ -97,6 +102,8 @@ hdata_new_var (struct t_hdata *hdata, const char *name, int offset, int type, { value = (type << 16) | (offset & 0xFFFF); hashtable_set (hdata->hash_var, name, &value); + if (array_size && array_size[0]) + hashtable_set (hdata->hash_var_array_size, name, array_size); if (hdata_name && hdata_name[0]) hashtable_set (hdata->hash_var_hdata, name, hdata_name); } @@ -171,6 +178,119 @@ hdata_get_var_type_string (struct t_hdata *hdata, const char *name) } /* + * hdata_get_var_array_size: get array size for variable (if variable is an + * array) + * return -1 if if variable is not an array + * (or if error) + */ + +int +hdata_get_var_array_size (struct t_hdata *hdata, void *pointer, + const char *name) +{ + const char *ptr_size; + char *error; + long value; + int i, type, offset; + void *ptr_value; + + if (hdata && name) + { + ptr_size = hashtable_get (hdata->hash_var_array_size, name); + if (ptr_size) + { + if (strcmp (ptr_size, "*") == 0) + { + /* + * automatic size: look for NULL in array + * (this automatic size is possible only with pointers, so with + * types: string, pointer, hashtable) + */ + type = hdata_get_var_type (hdata, name); + if ((type == WEECHAT_HDATA_STRING) + || (type == WEECHAT_HDATA_POINTER) + || (type == WEECHAT_HDATA_HASHTABLE)) + { + offset = hdata_get_var_offset (hdata, name); + if (offset >= 0) + { + if (!(*((void **)(pointer + offset)))) + return 0; + i = 0; + while (1) + { + switch (type) + { + case WEECHAT_HDATA_STRING: + ptr_value = (*((char ***)(pointer + offset)))[i]; + break; + case WEECHAT_HDATA_POINTER: + ptr_value = (*((void ***)(pointer + offset)))[i]; + break; + case WEECHAT_HDATA_HASHTABLE: + ptr_value = (*((struct t_hashtable ***)(pointer + offset)))[i]; + break; + } + if (!ptr_value) + break; + i++; + } + return i; + } + } + } + else + { + /* fixed size: the size can be a name of variable or integer */ + if (hdata_get_var_offset (hdata, ptr_size) >= 0) + { + /* size is the name of a variable in hdata, read it */ + offset = hdata_get_var_offset (hdata, ptr_size); + switch (hdata_get_var_type (hdata, ptr_size)) + { + case WEECHAT_HDATA_CHAR: + return (int)(*((char *)(pointer + offset))); + case WEECHAT_HDATA_INTEGER: + return *((int *)(pointer + offset)); + case WEECHAT_HDATA_LONG: + return (int)(*((long *)(pointer + offset))); + default: + break; + } + } + else + { + /* check if the size is a valid integer */ + error = NULL; + value = strtol (ptr_size, &error, 10); + if (error && !error[0]) + return (int)value; + } + } + } + } + + return -1; +} + +/* + * hdata_get_var_array_size_string: get array size for variable as string + */ + +const char * +hdata_get_var_array_size_string (struct t_hdata *hdata, void *pointer, + const char *name) +{ + /* make C compiler happy */ + (void) pointer; + + if (hdata && name) + return (const char *)hashtable_get (hdata->hash_var_array_size, name); + + return NULL; +} + +/* * hdata_get_var_hdata: get hdata name for a variable (NULL if variable has * no hdata) */ @@ -290,19 +410,71 @@ hdata_move (struct t_hdata *hdata, void *pointer, int count) } /* + * hdata_get_index_and_name: extract index from name of variable + * A name can contain index with this format: + * "N|name" (where N is an integer >= 0) + * "index" is set to N, "ptr_name" points to start + * of name in string (after the "|" if found) + */ + +void +hdata_get_index_and_name (const char *name, int *index, const char **ptr_name) +{ + char *pos, *str_index, *error; + long number; + + if (index) + *index = 0; + if (ptr_name) + *ptr_name = name; + + if (!name) + return; + + pos = strchr (name, '|'); + if (pos) + { + str_index = string_strndup (name, pos - name); + if (str_index) + { + error = NULL; + number = strtol (str_index, &error, 10); + if (error && !error[0]) + { + if (index) + *index = number; + if (ptr_name) + *ptr_name = pos + 1; + } + free (str_index); + } + } +} + +/* * hdata_char: get char value of a variable in structure using hdata */ char hdata_char (struct t_hdata *hdata, void *pointer, const char *name) { - int offset; + int offset, index; + const char *ptr_name; - if (hdata && pointer) + if (hdata && pointer && name) { - offset = hdata_get_var_offset (hdata, name); + hdata_get_index_and_name (name, &index, &ptr_name); + offset = hdata_get_var_offset (hdata, ptr_name); if (offset >= 0) - return *((char *)(pointer + offset)); + { + if (hdata_get_var_array_size_string (hdata, pointer, ptr_name)) + { + if (*((void **)(pointer + offset))) + return (*((char **)(pointer + offset)))[index]; + } + else + return *((char *)(pointer + offset)); + } } return '\0'; @@ -315,13 +487,23 @@ hdata_char (struct t_hdata *hdata, void *pointer, const char *name) int hdata_integer (struct t_hdata *hdata, void *pointer, const char *name) { - int offset; + int offset, index; + const char *ptr_name; - if (hdata && pointer) + if (hdata && pointer && name) { - offset = hdata_get_var_offset (hdata, name); + hdata_get_index_and_name (name, &index, &ptr_name); + offset = hdata_get_var_offset (hdata, ptr_name); if (offset >= 0) - return *((int *)(pointer + offset)); + { + if (hdata_get_var_array_size_string (hdata, pointer, ptr_name)) + { + if (*((void **)(pointer + offset))) + return (*((int **)(pointer + offset)))[index]; + } + else + return *((int *)(pointer + offset)); + } } return 0; @@ -334,13 +516,23 @@ hdata_integer (struct t_hdata *hdata, void *pointer, const char *name) long hdata_long (struct t_hdata *hdata, void *pointer, const char *name) { - int offset; + int offset, index; + const char *ptr_name; - if (hdata && pointer) + if (hdata && pointer && name) { - offset = hdata_get_var_offset (hdata, name); + hdata_get_index_and_name (name, &index, &ptr_name); + offset = hdata_get_var_offset (hdata, ptr_name); if (offset >= 0) - return *((long *)(pointer + offset)); + { + if (hdata_get_var_array_size_string (hdata, pointer, ptr_name)) + { + if (*((void **)(pointer + offset))) + return (*((long **)(pointer + offset)))[index]; + } + else + return *((long *)(pointer + offset)); + } } return 0; @@ -353,13 +545,23 @@ hdata_long (struct t_hdata *hdata, void *pointer, const char *name) const char * hdata_string (struct t_hdata *hdata, void *pointer, const char *name) { - int offset; + int offset, index; + const char *ptr_name; - if (hdata && pointer) + if (hdata && pointer && name) { - offset = hdata_get_var_offset (hdata, name); + hdata_get_index_and_name (name, &index, &ptr_name); + offset = hdata_get_var_offset (hdata, ptr_name); if (offset >= 0) - return *((char **)(pointer + offset)); + { + if (hdata_get_var_array_size_string (hdata, pointer, ptr_name)) + { + if (*((void **)(pointer + offset))) + return (*((char ***)(pointer + offset)))[index]; + } + else + return *((char **)(pointer + offset)); + } } return NULL; @@ -372,13 +574,23 @@ hdata_string (struct t_hdata *hdata, void *pointer, const char *name) void * hdata_pointer (struct t_hdata *hdata, void *pointer, const char *name) { - int offset; + int offset, index; + const char *ptr_name; - if (hdata && pointer) + if (hdata && pointer && name) { - offset = hdata_get_var_offset (hdata, name); + hdata_get_index_and_name (name, &index, &ptr_name); + offset = hdata_get_var_offset (hdata, ptr_name); if (offset >= 0) - return *((void **)(pointer + offset)); + { + if (hdata_get_var_array_size_string (hdata, pointer, ptr_name)) + { + if (*((void **)(pointer + offset))) + return (*((void ***)(pointer + offset)))[index]; + } + else + return *((void **)(pointer + offset)); + } } return NULL; @@ -391,13 +603,23 @@ hdata_pointer (struct t_hdata *hdata, void *pointer, const char *name) time_t hdata_time (struct t_hdata *hdata, void *pointer, const char *name) { - int offset; + int offset, index; + const char *ptr_name; - if (hdata && pointer) + if (hdata && pointer && name) { - offset = hdata_get_var_offset (hdata, name); + hdata_get_index_and_name (name, &index, &ptr_name); + offset = hdata_get_var_offset (hdata, ptr_name); if (offset >= 0) - return *((time_t *)(pointer + offset)); + { + if (hdata_get_var_array_size_string (hdata, pointer, ptr_name)) + { + if (*((void **)(pointer + offset))) + return (*((time_t **)(pointer + offset)))[index]; + } + else + return *((time_t *)(pointer + offset)); + } } return 0; @@ -410,13 +632,23 @@ 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) { - int offset; + int offset, index; + const char *ptr_name; - if (hdata && pointer) + if (hdata && pointer && name) { - offset = hdata_get_var_offset (hdata, name); + hdata_get_index_and_name (name, &index, &ptr_name); + offset = hdata_get_var_offset (hdata, ptr_name); if (offset >= 0) - return *((struct t_hashtable **)(pointer + offset)); + { + if (hdata_get_var_array_size_string (hdata, pointer, ptr_name)) + { + if (*((void **)(pointer + offset))) + return (*((struct t_hashtable ***)(pointer + offset)))[index]; + } + else + return *((struct t_hashtable **)(pointer + offset)); + } } return NULL; @@ -441,6 +673,12 @@ hdata_get_string (struct t_hdata *hdata, const char *property) return hdata->var_prev; else if (string_strcasecmp (property, "var_next") == 0) return hdata->var_next; + else if (string_strcasecmp (property, "var_array_size_keys") == 0) + return hashtable_get_string (hdata->hash_var_array_size, "keys"); + else if (string_strcasecmp (property, "var_array_size_values") == 0) + return hashtable_get_string (hdata->hash_var_array_size, "values"); + else if (string_strcasecmp (property, "var_array_size_keys_values") == 0) + return hashtable_get_string (hdata->hash_var_array_size, "keys_values"); else if (string_strcasecmp (property, "var_hdata_keys") == 0) return hashtable_get_string (hdata->hash_var_hdata, "keys"); else if (string_strcasecmp (property, "var_hdata_values") == 0) @@ -471,6 +709,8 @@ hdata_free (struct t_hdata *hdata) free (hdata->var_prev); if (hdata->var_next) free (hdata->var_next); + if (hdata->hash_var_array_size) + hashtable_free (hdata->hash_var_array_size); if (hdata->hash_var_hdata) hashtable_free (hdata->hash_var_hdata); if (hdata->hash_list) @@ -556,11 +796,14 @@ hdata_print_log_map_cb (void *data, struct t_hashtable *hashtable, log_printf (""); log_printf ("[hdata (addr:0x%lx, name:'%s')]", ptr_hdata, (const char *)key); log_printf (" plugin . . . . . . . . : 0x%lx", ptr_hdata->plugin); + log_printf (" var_prev . . . . . . . : '%s'", ptr_hdata->var_prev); + log_printf (" var_next . . . . . . . : '%s'", ptr_hdata->var_next); log_printf (" hash_var . . . . . . . : 0x%lx (hashtable: '%s')", ptr_hdata->hash_var, hashtable_get_string (ptr_hdata->hash_var, "keys_values")); - log_printf (" var_prev . . . . . . . : '%s'", ptr_hdata->var_prev); - log_printf (" var_next . . . . . . . : '%s'", ptr_hdata->var_next); + log_printf (" hash_var_array_size. . : 0x%lx (hashtable: '%s')", + ptr_hdata->hash_var_array_size, + hashtable_get_string (ptr_hdata->hash_var_array_size, "keys_values")); log_printf (" hash_var_hdata . . . . : 0x%lx (hashtable: '%s')", ptr_hdata->hash_var_hdata, hashtable_get_string (ptr_hdata->hash_var_hdata, "keys_values")); diff --git a/src/core/wee-hdata.h b/src/core/wee-hdata.h index 8707e1034..0eacf669e 100644 --- a/src/core/wee-hdata.h +++ b/src/core/wee-hdata.h @@ -20,20 +20,21 @@ #ifndef __WEECHAT_HDATA_H #define __WEECHAT_HDATA_H 1 -#define HDATA_VAR(__struct, __name, __type, __hdata_name) \ +#define HDATA_VAR(__struct, __name, __type, __array_size, __hdata_name) \ hdata_new_var (hdata, #__name, offsetof (__struct, __name), \ - WEECHAT_HDATA_##__type, __hdata_name) + WEECHAT_HDATA_##__type, __array_size, __hdata_name) #define HDATA_LIST(__name) hdata_new_list (hdata, #__name, &(__name)); struct t_hdata { struct t_weechat_plugin *plugin; /* plugin which created this hdata */ /* (NULL if created by WeeChat) */ - struct t_hashtable *hash_var; /* hashtable with offset of vars */ char *var_prev; /* name of var with pointer to */ /* previous element in list */ char *var_next; /* name of var with pointer to */ /* next element in list */ + struct t_hashtable *hash_var; /* hash with type & offset of vars */ + struct t_hashtable *hash_var_array_size; /* array size */ struct t_hashtable *hash_var_hdata; /* hashtable with hdata names */ struct t_hashtable *hash_list; /* hashtable with pointers on lists */ /* (used to search objects) */ @@ -47,13 +48,19 @@ extern struct t_hdata *hdata_new (struct t_weechat_plugin *plugin, const char *hdata_name, const char *var_prev, const char *var_next); extern void hdata_new_var (struct t_hdata *hdata, const char *name, int offset, - int type, const char *hdata_name); + int type, const char *array_size, + const char *hdata_name); extern void hdata_new_list (struct t_hdata *hdata, const char *name, void *pointer); 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, const char *name); +extern int hdata_get_var_array_size (struct t_hdata *hdata, void *pointer, + const char *name); +extern const char *hdata_get_var_array_size_string (struct t_hdata *hdata, + void *pointer, + const char *name); extern const char *hdata_get_var_hdata (struct t_hdata *hdata, const char *name); extern void *hdata_get_var (struct t_hdata *hdata, void *pointer, diff --git a/src/gui/gui-bar-item.c b/src/gui/gui-bar-item.c index 3d293a410..c647fa223 100644 --- a/src/gui/gui-bar-item.c +++ b/src/gui/gui-bar-item.c @@ -1829,12 +1829,12 @@ gui_bar_item_hdata_bar_item_cb (void *data, const char *hdata_name) hdata = hdata_new (NULL, hdata_name, "prev_item", "next_item"); if (hdata) { - HDATA_VAR(struct t_gui_bar_item, plugin, POINTER, "plugin"); - HDATA_VAR(struct t_gui_bar_item, name, STRING, NULL); - HDATA_VAR(struct t_gui_bar_item, build_callback, POINTER, NULL); - HDATA_VAR(struct t_gui_bar_item, build_callback_data, POINTER, NULL); - HDATA_VAR(struct t_gui_bar_item, prev_item, POINTER, hdata_name); - HDATA_VAR(struct t_gui_bar_item, next_item, POINTER, hdata_name); + HDATA_VAR(struct t_gui_bar_item, plugin, POINTER, NULL, "plugin"); + HDATA_VAR(struct t_gui_bar_item, name, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_bar_item, build_callback, POINTER, NULL, NULL); + HDATA_VAR(struct t_gui_bar_item, build_callback_data, POINTER, NULL, NULL); + HDATA_VAR(struct t_gui_bar_item, prev_item, POINTER, NULL, hdata_name); + HDATA_VAR(struct t_gui_bar_item, next_item, POINTER, NULL, hdata_name); HDATA_LIST(gui_bar_items); HDATA_LIST(last_gui_bar_item); } diff --git a/src/gui/gui-bar-window.c b/src/gui/gui-bar-window.c index 51e0f4b2b..a6479d7c9 100644 --- a/src/gui/gui-bar-window.c +++ b/src/gui/gui-bar-window.c @@ -1407,27 +1407,27 @@ gui_bar_window_hdata_bar_window_cb (void *data, const char *hdata_name) hdata = hdata_new (NULL, hdata_name, "prev_bar_window", "next_bar_window"); if (hdata) { - HDATA_VAR(struct t_gui_bar_window, bar, POINTER, "bar"); - HDATA_VAR(struct t_gui_bar_window, x, INTEGER, NULL); - HDATA_VAR(struct t_gui_bar_window, y, INTEGER, NULL); - HDATA_VAR(struct t_gui_bar_window, width, INTEGER, NULL); - HDATA_VAR(struct t_gui_bar_window, height, INTEGER, NULL); - HDATA_VAR(struct t_gui_bar_window, scroll_x, INTEGER, NULL); - HDATA_VAR(struct t_gui_bar_window, scroll_y, INTEGER, NULL); - HDATA_VAR(struct t_gui_bar_window, cursor_x, INTEGER, NULL); - HDATA_VAR(struct t_gui_bar_window, cursor_y, INTEGER, NULL); - HDATA_VAR(struct t_gui_bar_window, current_size, INTEGER, NULL); - HDATA_VAR(struct t_gui_bar_window, items_count, INTEGER, NULL); - HDATA_VAR(struct t_gui_bar_window, items_subcount, POINTER, NULL); - HDATA_VAR(struct t_gui_bar_window, items_content, POINTER, NULL); - HDATA_VAR(struct t_gui_bar_window, items_num_lines, POINTER, NULL); - HDATA_VAR(struct t_gui_bar_window, items_refresh_needed, POINTER, NULL); - HDATA_VAR(struct t_gui_bar_window, screen_col_size, INTEGER, NULL); - HDATA_VAR(struct t_gui_bar_window, coords_count, INTEGER, NULL); - HDATA_VAR(struct t_gui_bar_window, coords, POINTER, NULL); - HDATA_VAR(struct t_gui_bar_window, gui_objects, POINTER, NULL); - HDATA_VAR(struct t_gui_bar_window, prev_bar_window, POINTER, hdata_name); - HDATA_VAR(struct t_gui_bar_window, next_bar_window, POINTER, hdata_name); + HDATA_VAR(struct t_gui_bar_window, bar, POINTER, NULL, "bar"); + HDATA_VAR(struct t_gui_bar_window, x, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_bar_window, y, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_bar_window, width, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_bar_window, height, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_bar_window, scroll_x, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_bar_window, scroll_y, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_bar_window, cursor_x, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_bar_window, cursor_y, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_bar_window, current_size, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_bar_window, items_count, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_bar_window, items_subcount, POINTER, NULL, NULL); + HDATA_VAR(struct t_gui_bar_window, items_content, POINTER, NULL, NULL); + HDATA_VAR(struct t_gui_bar_window, items_num_lines, POINTER, NULL, NULL); + HDATA_VAR(struct t_gui_bar_window, items_refresh_needed, POINTER, NULL, NULL); + HDATA_VAR(struct t_gui_bar_window, screen_col_size, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_bar_window, coords_count, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_bar_window, coords, POINTER, NULL, NULL); + HDATA_VAR(struct t_gui_bar_window, gui_objects, POINTER, NULL, NULL); + HDATA_VAR(struct t_gui_bar_window, prev_bar_window, POINTER, NULL, hdata_name); + HDATA_VAR(struct t_gui_bar_window, next_bar_window, POINTER, NULL, hdata_name); } return hdata; } diff --git a/src/gui/gui-bar.c b/src/gui/gui-bar.c index 5946fe37f..2c7718f8e 100644 --- a/src/gui/gui-bar.c +++ b/src/gui/gui-bar.c @@ -2246,20 +2246,20 @@ gui_bar_hdata_bar_cb (void *data, const char *hdata_name) hdata = hdata_new (NULL, hdata_name, "prev_bar", "next_bar"); if (hdata) { - HDATA_VAR(struct t_gui_bar, name, STRING, NULL); - HDATA_VAR(struct t_gui_bar, options, POINTER, NULL); - HDATA_VAR(struct t_gui_bar, conditions_count, INTEGER, NULL); - HDATA_VAR(struct t_gui_bar, conditions_array, POINTER, NULL); - HDATA_VAR(struct t_gui_bar, items_count, INTEGER, NULL); - HDATA_VAR(struct t_gui_bar, items_subcount, POINTER, NULL); - HDATA_VAR(struct t_gui_bar, items_array, POINTER, NULL); - HDATA_VAR(struct t_gui_bar, items_prefix, POINTER, NULL); - HDATA_VAR(struct t_gui_bar, items_name, POINTER, NULL); - HDATA_VAR(struct t_gui_bar, items_suffix, POINTER, NULL); - HDATA_VAR(struct t_gui_bar, bar_window, POINTER, "bar_window"); - HDATA_VAR(struct t_gui_bar, bar_refresh_needed, INTEGER, NULL); - HDATA_VAR(struct t_gui_bar, prev_bar, POINTER, hdata_name); - HDATA_VAR(struct t_gui_bar, next_bar, POINTER, hdata_name); + HDATA_VAR(struct t_gui_bar, name, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_bar, options, POINTER, NULL, NULL); + HDATA_VAR(struct t_gui_bar, conditions_count, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_bar, conditions_array, STRING, "conditions_count", NULL); + HDATA_VAR(struct t_gui_bar, items_count, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_bar, items_subcount, POINTER, NULL, NULL); + HDATA_VAR(struct t_gui_bar, items_array, POINTER, NULL, NULL); + HDATA_VAR(struct t_gui_bar, items_prefix, POINTER, NULL, NULL); + HDATA_VAR(struct t_gui_bar, items_name, POINTER, NULL, NULL); + HDATA_VAR(struct t_gui_bar, items_suffix, POINTER, NULL, NULL); + HDATA_VAR(struct t_gui_bar, bar_window, POINTER, NULL, "bar_window"); + HDATA_VAR(struct t_gui_bar, bar_refresh_needed, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_bar, prev_bar, POINTER, NULL, hdata_name); + HDATA_VAR(struct t_gui_bar, next_bar, POINTER, NULL, hdata_name); HDATA_LIST(gui_bars); HDATA_LIST(last_gui_bar); } diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index 5d6e0cf57..be418cc5a 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -3097,72 +3097,72 @@ gui_buffer_hdata_buffer_cb (void *data, const char *hdata_name) hdata = hdata_new (NULL, hdata_name, "prev_buffer", "next_buffer"); if (hdata) { - HDATA_VAR(struct t_gui_buffer, plugin, POINTER, "plugin"); - HDATA_VAR(struct t_gui_buffer, plugin_name_for_upgrade, STRING, NULL); - HDATA_VAR(struct t_gui_buffer, number, INTEGER, NULL); - HDATA_VAR(struct t_gui_buffer, layout_number, INTEGER, NULL); - HDATA_VAR(struct t_gui_buffer, layout_number_merge_order, INTEGER, NULL); - HDATA_VAR(struct t_gui_buffer, name, STRING, NULL); - HDATA_VAR(struct t_gui_buffer, full_name, STRING, NULL); - HDATA_VAR(struct t_gui_buffer, short_name, STRING, NULL); - HDATA_VAR(struct t_gui_buffer, type, INTEGER, NULL); - HDATA_VAR(struct t_gui_buffer, notify, INTEGER, NULL); - HDATA_VAR(struct t_gui_buffer, num_displayed, INTEGER, NULL); - HDATA_VAR(struct t_gui_buffer, active, INTEGER, NULL); - HDATA_VAR(struct t_gui_buffer, print_hooks_enabled, INTEGER, NULL); - HDATA_VAR(struct t_gui_buffer, close_callback, POINTER, NULL); - HDATA_VAR(struct t_gui_buffer, close_callback_data, POINTER, NULL); - HDATA_VAR(struct t_gui_buffer, title, STRING, NULL); - HDATA_VAR(struct t_gui_buffer, own_lines, POINTER, "lines"); - HDATA_VAR(struct t_gui_buffer, mixed_lines, POINTER, "lines"); - HDATA_VAR(struct t_gui_buffer, lines, POINTER, "lines"); - HDATA_VAR(struct t_gui_buffer, time_for_each_line, INTEGER, NULL); - HDATA_VAR(struct t_gui_buffer, chat_refresh_needed, INTEGER, NULL); - HDATA_VAR(struct t_gui_buffer, nicklist, INTEGER, NULL); - HDATA_VAR(struct t_gui_buffer, nicklist_case_sensitive, INTEGER, NULL); - HDATA_VAR(struct t_gui_buffer, nicklist_root, POINTER, "nick_group"); - HDATA_VAR(struct t_gui_buffer, nicklist_max_length, INTEGER, NULL); - HDATA_VAR(struct t_gui_buffer, nicklist_display_groups, INTEGER, NULL); - HDATA_VAR(struct t_gui_buffer, nicklist_visible_count, INTEGER, NULL); - HDATA_VAR(struct t_gui_buffer, nickcmp_callback, POINTER, NULL); - HDATA_VAR(struct t_gui_buffer, nickcmp_callback_data, POINTER, NULL); - HDATA_VAR(struct t_gui_buffer, input, INTEGER, NULL); - HDATA_VAR(struct t_gui_buffer, input_callback, POINTER, NULL); - HDATA_VAR(struct t_gui_buffer, input_callback_data, POINTER, NULL); - HDATA_VAR(struct t_gui_buffer, input_get_unknown_commands, INTEGER, NULL); - HDATA_VAR(struct t_gui_buffer, input_buffer, STRING, NULL); - HDATA_VAR(struct t_gui_buffer, input_buffer_alloc, INTEGER, NULL); - HDATA_VAR(struct t_gui_buffer, input_buffer_size, INTEGER, NULL); - HDATA_VAR(struct t_gui_buffer, input_buffer_length, INTEGER, NULL); - HDATA_VAR(struct t_gui_buffer, input_buffer_pos, INTEGER, NULL); - HDATA_VAR(struct t_gui_buffer, input_buffer_1st_display, INTEGER, NULL); - HDATA_VAR(struct t_gui_buffer, input_undo_snap, POINTER, "input_undo"); - HDATA_VAR(struct t_gui_buffer, input_undo, POINTER, "input_undo"); - HDATA_VAR(struct t_gui_buffer, last_input_undo, POINTER, "input_undo"); - HDATA_VAR(struct t_gui_buffer, ptr_input_undo, POINTER, "input_undo"); - HDATA_VAR(struct t_gui_buffer, input_undo_count, INTEGER, NULL); - HDATA_VAR(struct t_gui_buffer, completion, POINTER, "completion"); - HDATA_VAR(struct t_gui_buffer, history, POINTER, "history"); - HDATA_VAR(struct t_gui_buffer, last_history, POINTER, "history"); - HDATA_VAR(struct t_gui_buffer, ptr_history, POINTER, "history"); - HDATA_VAR(struct t_gui_buffer, num_history, INTEGER, NULL); - HDATA_VAR(struct t_gui_buffer, text_search, INTEGER, NULL); - HDATA_VAR(struct t_gui_buffer, text_search_exact, INTEGER, NULL); - HDATA_VAR(struct t_gui_buffer, text_search_found, INTEGER, NULL); - HDATA_VAR(struct t_gui_buffer, text_search_input, STRING, NULL); - HDATA_VAR(struct t_gui_buffer, highlight_words, STRING, NULL); - HDATA_VAR(struct t_gui_buffer, highlight_regex, STRING, NULL); - HDATA_VAR(struct t_gui_buffer, highlight_regex_compiled, POINTER, NULL); - 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, 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, 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_VAR(struct t_gui_buffer, plugin, POINTER, NULL, "plugin"); + HDATA_VAR(struct t_gui_buffer, plugin_name_for_upgrade, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, number, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, layout_number, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, layout_number_merge_order, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, name, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, full_name, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, short_name, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, type, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, notify, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, num_displayed, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, active, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, print_hooks_enabled, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, close_callback, POINTER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, close_callback_data, POINTER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, title, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, own_lines, POINTER, NULL, "lines"); + HDATA_VAR(struct t_gui_buffer, mixed_lines, POINTER, NULL, "lines"); + HDATA_VAR(struct t_gui_buffer, lines, POINTER, NULL, "lines"); + HDATA_VAR(struct t_gui_buffer, time_for_each_line, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, chat_refresh_needed, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, nicklist, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, nicklist_case_sensitive, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, nicklist_root, POINTER, NULL, "nick_group"); + HDATA_VAR(struct t_gui_buffer, nicklist_max_length, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, nicklist_display_groups, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, nicklist_visible_count, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, nickcmp_callback, POINTER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, nickcmp_callback_data, POINTER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, input, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, input_callback, POINTER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, input_callback_data, POINTER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, input_get_unknown_commands, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, input_buffer, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, input_buffer_alloc, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, input_buffer_size, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, input_buffer_length, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, input_buffer_pos, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, input_buffer_1st_display, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, input_undo_snap, POINTER, NULL, "input_undo"); + HDATA_VAR(struct t_gui_buffer, input_undo, POINTER, NULL, "input_undo"); + HDATA_VAR(struct t_gui_buffer, last_input_undo, POINTER, NULL, "input_undo"); + HDATA_VAR(struct t_gui_buffer, ptr_input_undo, POINTER, NULL, "input_undo"); + HDATA_VAR(struct t_gui_buffer, input_undo_count, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, completion, POINTER, NULL, "completion"); + HDATA_VAR(struct t_gui_buffer, history, POINTER, NULL, "history"); + HDATA_VAR(struct t_gui_buffer, last_history, POINTER, NULL, "history"); + HDATA_VAR(struct t_gui_buffer, ptr_history, POINTER, NULL, "history"); + HDATA_VAR(struct t_gui_buffer, num_history, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, text_search, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, text_search_exact, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, text_search_found, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, text_search_input, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, highlight_words, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, highlight_regex, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, highlight_regex_compiled, POINTER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, highlight_tags, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, highlight_tags_count, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, highlight_tags_array, STRING, "highlight_tags_count", NULL); + HDATA_VAR(struct t_gui_buffer, hotlist_max_level_nicks, HASHTABLE, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, keys, POINTER, NULL, "key"); + HDATA_VAR(struct t_gui_buffer, last_key, POINTER, NULL, "key"); + HDATA_VAR(struct t_gui_buffer, keys_count, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, local_variables, HASHTABLE, NULL, NULL); + HDATA_VAR(struct t_gui_buffer, prev_buffer, POINTER, NULL, hdata_name); + HDATA_VAR(struct t_gui_buffer, next_buffer, POINTER, NULL, hdata_name); HDATA_LIST(gui_buffers); HDATA_LIST(last_gui_buffer); HDATA_LIST(gui_buffer_last_displayed); @@ -3185,10 +3185,10 @@ gui_buffer_hdata_input_undo_cb (void *data, const char *hdata_name) hdata = hdata_new (NULL, hdata_name, "prev_undo", "next_undo"); if (hdata) { - HDATA_VAR(struct t_gui_input_undo, data, STRING, NULL); - HDATA_VAR(struct t_gui_input_undo, pos, INTEGER, NULL); - HDATA_VAR(struct t_gui_input_undo, prev_undo, POINTER, hdata_name); - HDATA_VAR(struct t_gui_input_undo, next_undo, POINTER, hdata_name); + HDATA_VAR(struct t_gui_input_undo, data, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_input_undo, pos, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_input_undo, prev_undo, POINTER, NULL, hdata_name); + HDATA_VAR(struct t_gui_input_undo, next_undo, POINTER, NULL, hdata_name); } return hdata; } @@ -3208,9 +3208,9 @@ gui_buffer_hdata_buffer_visited_cb (void *data, const char *hdata_name) hdata = hdata_new (NULL, hdata_name, "prev_buffer", "next_buffer"); if (hdata) { - HDATA_VAR(struct t_gui_buffer_visited, buffer, POINTER, "buffer"); - HDATA_VAR(struct t_gui_buffer_visited, prev_buffer, POINTER, hdata_name); - HDATA_VAR(struct t_gui_buffer_visited, next_buffer, POINTER, hdata_name); + HDATA_VAR(struct t_gui_buffer_visited, buffer, POINTER, NULL, "buffer"); + HDATA_VAR(struct t_gui_buffer_visited, prev_buffer, POINTER, NULL, hdata_name); + HDATA_VAR(struct t_gui_buffer_visited, next_buffer, POINTER, NULL, hdata_name); HDATA_LIST(gui_buffers_visited); HDATA_LIST(last_gui_buffer_visited); } diff --git a/src/gui/gui-completion.c b/src/gui/gui-completion.c index 159290be2..9b7ef2fe2 100644 --- a/src/gui/gui-completion.c +++ b/src/gui/gui-completion.c @@ -1217,25 +1217,25 @@ gui_completion_hdata_completion_cb (void *data, const char *hdata_name) hdata = hdata_new (NULL, hdata_name, NULL, NULL); if (hdata) { - HDATA_VAR(struct t_gui_completion, buffer, POINTER, "buffer"); - HDATA_VAR(struct t_gui_completion, context, INTEGER, NULL); - HDATA_VAR(struct t_gui_completion, base_command, STRING, NULL); - HDATA_VAR(struct t_gui_completion, base_command_arg_index, INTEGER, NULL); - HDATA_VAR(struct t_gui_completion, base_word, STRING, NULL); - HDATA_VAR(struct t_gui_completion, base_word_pos, INTEGER, NULL); - HDATA_VAR(struct t_gui_completion, position, INTEGER, NULL); - HDATA_VAR(struct t_gui_completion, args, STRING, NULL); - HDATA_VAR(struct t_gui_completion, direction, INTEGER, NULL); - HDATA_VAR(struct t_gui_completion, add_space, INTEGER, NULL); - HDATA_VAR(struct t_gui_completion, force_partial_completion, INTEGER, NULL); - HDATA_VAR(struct t_gui_completion, completion_list, POINTER, NULL); - HDATA_VAR(struct t_gui_completion, word_found, STRING, NULL); - HDATA_VAR(struct t_gui_completion, word_found_is_nick, INTEGER, NULL); - HDATA_VAR(struct t_gui_completion, position_replace, INTEGER, NULL); - HDATA_VAR(struct t_gui_completion, diff_size, INTEGER, NULL); - HDATA_VAR(struct t_gui_completion, diff_length, INTEGER, NULL); - HDATA_VAR(struct t_gui_completion, partial_completion_list, POINTER, "completion_partial"); - HDATA_VAR(struct t_gui_completion, last_partial_completion, POINTER, "completion_partial"); + HDATA_VAR(struct t_gui_completion, buffer, POINTER, NULL, "buffer"); + HDATA_VAR(struct t_gui_completion, context, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_completion, base_command, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_completion, base_command_arg_index, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_completion, base_word, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_completion, base_word_pos, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_completion, position, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_completion, args, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_completion, direction, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_completion, add_space, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_completion, force_partial_completion, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_completion, completion_list, POINTER, NULL, NULL); + HDATA_VAR(struct t_gui_completion, word_found, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_completion, word_found_is_nick, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_completion, position_replace, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_completion, diff_size, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_completion, diff_length, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_completion, partial_completion_list, POINTER, NULL, "completion_partial"); + HDATA_VAR(struct t_gui_completion, last_partial_completion, POINTER, NULL, "completion_partial"); } return hdata; } @@ -1256,10 +1256,10 @@ gui_completion_hdata_completion_partial_cb (void *data, const char *hdata_name) hdata = hdata_new (NULL, hdata_name, "prev_item", "next_item"); if (hdata) { - HDATA_VAR(struct t_gui_completion_partial, word, STRING, NULL); - HDATA_VAR(struct t_gui_completion_partial, count, INTEGER, NULL); - HDATA_VAR(struct t_gui_completion_partial, prev_item, POINTER, hdata_name); - HDATA_VAR(struct t_gui_completion_partial, next_item, POINTER, hdata_name); + HDATA_VAR(struct t_gui_completion_partial, word, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_completion_partial, count, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_completion_partial, prev_item, POINTER, NULL, hdata_name); + HDATA_VAR(struct t_gui_completion_partial, next_item, POINTER, NULL, hdata_name); } return hdata; } diff --git a/src/gui/gui-filter.c b/src/gui/gui-filter.c index fa149b37b..6f4ea13f8 100644 --- a/src/gui/gui-filter.c +++ b/src/gui/gui-filter.c @@ -452,19 +452,19 @@ gui_filter_hdata_filter_cb (void *data, const char *hdata_name) hdata = hdata_new (NULL, hdata_name, "prev_filter", "next_filter"); if (hdata) { - HDATA_VAR(struct t_gui_filter, enabled, INTEGER, NULL); - HDATA_VAR(struct t_gui_filter, name, STRING, NULL); - HDATA_VAR(struct t_gui_filter, buffer_name, STRING, NULL); - HDATA_VAR(struct t_gui_filter, num_buffers, INTEGER, NULL); - HDATA_VAR(struct t_gui_filter, buffers, POINTER, NULL); - HDATA_VAR(struct t_gui_filter, tags, STRING, NULL); - HDATA_VAR(struct t_gui_filter, tags_count, INTEGER, NULL); - HDATA_VAR(struct t_gui_filter, tags_array, POINTER, NULL); - HDATA_VAR(struct t_gui_filter, regex, STRING, NULL); - HDATA_VAR(struct t_gui_filter, regex_prefix, POINTER, NULL); - HDATA_VAR(struct t_gui_filter, regex_message, POINTER, NULL); - HDATA_VAR(struct t_gui_filter, prev_filter, POINTER, hdata_name); - HDATA_VAR(struct t_gui_filter, next_filter, POINTER, hdata_name); + HDATA_VAR(struct t_gui_filter, enabled, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_filter, name, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_filter, buffer_name, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_filter, num_buffers, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_filter, buffers, POINTER, NULL, NULL); + HDATA_VAR(struct t_gui_filter, tags, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_filter, tags_count, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_filter, tags_array, STRING, "tags_count", NULL); + HDATA_VAR(struct t_gui_filter, regex, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_filter, regex_prefix, POINTER, NULL, NULL); + HDATA_VAR(struct t_gui_filter, regex_message, POINTER, NULL, NULL); + HDATA_VAR(struct t_gui_filter, prev_filter, POINTER, NULL, hdata_name); + HDATA_VAR(struct t_gui_filter, next_filter, POINTER, NULL, hdata_name); HDATA_LIST(gui_filters); HDATA_LIST(last_gui_filter); } diff --git a/src/gui/gui-history.c b/src/gui/gui-history.c index 8d2b52cfb..e122e9f08 100644 --- a/src/gui/gui-history.c +++ b/src/gui/gui-history.c @@ -230,9 +230,9 @@ gui_history_hdata_history_cb (void *data, const char *hdata_name) hdata = hdata_new (NULL, hdata_name, "prev_history", "next_history"); if (hdata) { - HDATA_VAR(struct t_gui_history, text, STRING, NULL); - HDATA_VAR(struct t_gui_history, prev_history, POINTER, hdata_name); - HDATA_VAR(struct t_gui_history, next_history, POINTER, hdata_name); + HDATA_VAR(struct t_gui_history, text, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_history, prev_history, POINTER, NULL, hdata_name); + HDATA_VAR(struct t_gui_history, next_history, POINTER, NULL, hdata_name); } return hdata; } diff --git a/src/gui/gui-key.c b/src/gui/gui-key.c index 8274b25f0..81abbd565 100644 --- a/src/gui/gui-key.c +++ b/src/gui/gui-key.c @@ -1718,14 +1718,14 @@ gui_key_hdata_key_cb (void *data, const char *hdata_name) hdata = hdata_new (NULL, hdata_name, "prev_key", "next_key"); if (hdata) { - HDATA_VAR(struct t_gui_key, key, STRING, NULL); - HDATA_VAR(struct t_gui_key, area_type, POINTER, NULL); - HDATA_VAR(struct t_gui_key, area_name, POINTER, NULL); - HDATA_VAR(struct t_gui_key, area_key, STRING, NULL); - HDATA_VAR(struct t_gui_key, command, STRING, NULL); - HDATA_VAR(struct t_gui_key, score, INTEGER, NULL); - HDATA_VAR(struct t_gui_key, prev_key, POINTER, hdata_name); - HDATA_VAR(struct t_gui_key, next_key, POINTER, hdata_name); + HDATA_VAR(struct t_gui_key, key, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_key, area_type, POINTER, NULL, NULL); + HDATA_VAR(struct t_gui_key, area_name, POINTER, NULL, NULL); + HDATA_VAR(struct t_gui_key, area_key, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_key, command, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_key, score, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_key, prev_key, POINTER, NULL, hdata_name); + HDATA_VAR(struct t_gui_key, next_key, POINTER, NULL, hdata_name); for (i = 0; i < GUI_KEY_NUM_CONTEXTS; i++) { snprintf (str_list, sizeof (str_list), diff --git a/src/gui/gui-line.c b/src/gui/gui-line.c index 50957d28c..eb9031747 100644 --- a/src/gui/gui-line.c +++ b/src/gui/gui-line.c @@ -1356,14 +1356,14 @@ gui_line_hdata_lines_cb (void *data, const char *hdata_name) hdata = hdata_new (NULL, hdata_name, NULL, NULL); if (hdata) { - HDATA_VAR(struct t_gui_lines, first_line, POINTER, "line"); - HDATA_VAR(struct t_gui_lines, last_line, POINTER, "line"); - HDATA_VAR(struct t_gui_lines, last_read_line, POINTER, "line"); - HDATA_VAR(struct t_gui_lines, lines_count, INTEGER, NULL); - HDATA_VAR(struct t_gui_lines, first_line_not_read, INTEGER, NULL); - HDATA_VAR(struct t_gui_lines, lines_hidden, INTEGER, NULL); - HDATA_VAR(struct t_gui_lines, buffer_max_length, INTEGER, NULL); - HDATA_VAR(struct t_gui_lines, prefix_max_length, INTEGER, NULL); + HDATA_VAR(struct t_gui_lines, first_line, POINTER, NULL, "line"); + HDATA_VAR(struct t_gui_lines, last_line, POINTER, NULL, "line"); + HDATA_VAR(struct t_gui_lines, last_read_line, POINTER, NULL, "line"); + HDATA_VAR(struct t_gui_lines, lines_count, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_lines, first_line_not_read, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_lines, lines_hidden, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_lines, buffer_max_length, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_lines, prefix_max_length, INTEGER, NULL, NULL); } return hdata; } @@ -1383,9 +1383,9 @@ gui_line_hdata_line_cb (void *data, const char *hdata_name) hdata = hdata_new (NULL, hdata_name, "prev_line", "next_line"); if (hdata) { - HDATA_VAR(struct t_gui_line, data, POINTER, "line_data"); - HDATA_VAR(struct t_gui_line, prev_line, POINTER, hdata_name); - HDATA_VAR(struct t_gui_line, next_line, POINTER, hdata_name); + HDATA_VAR(struct t_gui_line, data, POINTER, NULL, "line_data"); + HDATA_VAR(struct t_gui_line, prev_line, POINTER, NULL, hdata_name); + HDATA_VAR(struct t_gui_line, next_line, POINTER, NULL, hdata_name); } return hdata; } @@ -1405,19 +1405,19 @@ gui_line_hdata_line_data_cb (void *data, const char *hdata_name) hdata = hdata_new (NULL, hdata_name, NULL, NULL); if (hdata) { - HDATA_VAR(struct t_gui_line_data, buffer, POINTER, "buffer"); - HDATA_VAR(struct t_gui_line_data, y, INTEGER, NULL); - HDATA_VAR(struct t_gui_line_data, date, TIME, NULL); - HDATA_VAR(struct t_gui_line_data, date_printed, TIME, NULL); - HDATA_VAR(struct t_gui_line_data, str_time, STRING, NULL); - HDATA_VAR(struct t_gui_line_data, tags_count, INTEGER, NULL); - HDATA_VAR(struct t_gui_line_data, tags_array, POINTER, NULL); - HDATA_VAR(struct t_gui_line_data, displayed, CHAR, NULL); - HDATA_VAR(struct t_gui_line_data, highlight, CHAR, NULL); - HDATA_VAR(struct t_gui_line_data, refresh_needed, CHAR, NULL); - HDATA_VAR(struct t_gui_line_data, prefix, STRING, NULL); - HDATA_VAR(struct t_gui_line_data, prefix_length, INTEGER, NULL); - HDATA_VAR(struct t_gui_line_data, message, STRING, NULL); + HDATA_VAR(struct t_gui_line_data, buffer, POINTER, NULL, "buffer"); + HDATA_VAR(struct t_gui_line_data, y, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_line_data, date, TIME, NULL, NULL); + HDATA_VAR(struct t_gui_line_data, date_printed, TIME, NULL, NULL); + HDATA_VAR(struct t_gui_line_data, str_time, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_line_data, tags_count, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_line_data, tags_array, STRING, "tags_count", NULL); + HDATA_VAR(struct t_gui_line_data, displayed, CHAR, NULL, NULL); + HDATA_VAR(struct t_gui_line_data, highlight, CHAR, NULL, NULL); + HDATA_VAR(struct t_gui_line_data, refresh_needed, CHAR, NULL, NULL); + HDATA_VAR(struct t_gui_line_data, prefix, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_line_data, prefix_length, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_line_data, message, STRING, NULL, NULL); } return hdata; } diff --git a/src/gui/gui-nicklist.c b/src/gui/gui-nicklist.c index 5a0444cdd..879573b0c 100644 --- a/src/gui/gui-nicklist.c +++ b/src/gui/gui-nicklist.c @@ -974,17 +974,17 @@ gui_nicklist_hdata_nick_group_cb (void *data, const char *hdata_name) hdata = hdata_new (NULL, hdata_name, "prev_group", "next_group"); if (hdata) { - HDATA_VAR(struct t_gui_nick_group, name, STRING, NULL); - HDATA_VAR(struct t_gui_nick_group, color, STRING, NULL); - HDATA_VAR(struct t_gui_nick_group, visible, INTEGER, NULL); - HDATA_VAR(struct t_gui_nick_group, level, INTEGER, NULL); - HDATA_VAR(struct t_gui_nick_group, parent, POINTER, hdata_name); - HDATA_VAR(struct t_gui_nick_group, children, POINTER, hdata_name); - HDATA_VAR(struct t_gui_nick_group, last_child, POINTER, hdata_name); - HDATA_VAR(struct t_gui_nick_group, nicks, POINTER, "nick"); - HDATA_VAR(struct t_gui_nick_group, last_nick, POINTER, "nick"); - HDATA_VAR(struct t_gui_nick_group, prev_group, POINTER, hdata_name); - HDATA_VAR(struct t_gui_nick_group, next_group, POINTER, hdata_name); + HDATA_VAR(struct t_gui_nick_group, name, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_nick_group, color, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_nick_group, visible, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_nick_group, level, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_nick_group, parent, POINTER, NULL, hdata_name); + HDATA_VAR(struct t_gui_nick_group, children, POINTER, NULL, hdata_name); + HDATA_VAR(struct t_gui_nick_group, last_child, POINTER, NULL, hdata_name); + HDATA_VAR(struct t_gui_nick_group, nicks, POINTER, NULL, "nick"); + HDATA_VAR(struct t_gui_nick_group, last_nick, POINTER, NULL, "nick"); + HDATA_VAR(struct t_gui_nick_group, prev_group, POINTER, NULL, hdata_name); + HDATA_VAR(struct t_gui_nick_group, next_group, POINTER, NULL, hdata_name); } return hdata; } @@ -1004,14 +1004,14 @@ gui_nicklist_hdata_nick_cb (void *data, const char *hdata_name) hdata = hdata_new (NULL, hdata_name, "prev_nick", "next_nick"); if (hdata) { - HDATA_VAR(struct t_gui_nick, group, POINTER, "nick_group"); - HDATA_VAR(struct t_gui_nick, name, STRING, NULL); - HDATA_VAR(struct t_gui_nick, color, STRING, NULL); - HDATA_VAR(struct t_gui_nick, prefix, STRING, NULL); - HDATA_VAR(struct t_gui_nick, prefix_color, STRING, NULL); - HDATA_VAR(struct t_gui_nick, visible, INTEGER, NULL); - HDATA_VAR(struct t_gui_nick, prev_nick, POINTER, hdata_name); - HDATA_VAR(struct t_gui_nick, next_nick, POINTER, hdata_name); + HDATA_VAR(struct t_gui_nick, group, POINTER, NULL, "nick_group"); + HDATA_VAR(struct t_gui_nick, name, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_nick, color, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_nick, prefix, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_nick, prefix_color, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_nick, visible, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_nick, prev_nick, POINTER, NULL, hdata_name); + HDATA_VAR(struct t_gui_nick, next_nick, POINTER, NULL, hdata_name); } return hdata; } diff --git a/src/gui/gui-window.c b/src/gui/gui-window.c index 186c87039..8f8f51021 100644 --- a/src/gui/gui-window.c +++ b/src/gui/gui-window.c @@ -1608,30 +1608,30 @@ gui_window_hdata_window_cb (void *data, const char *hdata_name) hdata = hdata_new (NULL, hdata_name, "prev_window", "next_window"); if (hdata) { - HDATA_VAR(struct t_gui_window, number, INTEGER, NULL); - HDATA_VAR(struct t_gui_window, win_x, INTEGER, NULL); - HDATA_VAR(struct t_gui_window, win_y, INTEGER, NULL); - HDATA_VAR(struct t_gui_window, win_width, INTEGER, NULL); - HDATA_VAR(struct t_gui_window, win_height, INTEGER, NULL); - HDATA_VAR(struct t_gui_window, win_width_pct, INTEGER, NULL); - HDATA_VAR(struct t_gui_window, win_height_pct, INTEGER, NULL); - HDATA_VAR(struct t_gui_window, win_chat_x, INTEGER, NULL); - HDATA_VAR(struct t_gui_window, win_chat_y, INTEGER, NULL); - HDATA_VAR(struct t_gui_window, win_chat_width, INTEGER, NULL); - HDATA_VAR(struct t_gui_window, win_chat_height, INTEGER, NULL); - HDATA_VAR(struct t_gui_window, win_chat_cursor_x, INTEGER, NULL); - HDATA_VAR(struct t_gui_window, win_chat_cursor_y, INTEGER, NULL); - HDATA_VAR(struct t_gui_window, bar_windows, POINTER, "bar_window"); - HDATA_VAR(struct t_gui_window, last_bar_window, POINTER, "bar_window"); - HDATA_VAR(struct t_gui_window, refresh_needed, INTEGER, NULL); - HDATA_VAR(struct t_gui_window, gui_objects, POINTER, NULL); - HDATA_VAR(struct t_gui_window, buffer, POINTER, "buffer"); - HDATA_VAR(struct t_gui_window, layout_plugin_name, STRING, NULL); - HDATA_VAR(struct t_gui_window, layout_buffer_name, STRING, NULL); - HDATA_VAR(struct t_gui_window, scroll, POINTER, "window_scroll"); - HDATA_VAR(struct t_gui_window, ptr_tree, POINTER, "window_tree"); - HDATA_VAR(struct t_gui_window, prev_window, POINTER, hdata_name); - HDATA_VAR(struct t_gui_window, next_window, POINTER, hdata_name); + HDATA_VAR(struct t_gui_window, number, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_window, win_x, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_window, win_y, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_window, win_width, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_window, win_height, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_window, win_width_pct, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_window, win_height_pct, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_window, win_chat_x, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_window, win_chat_y, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_window, win_chat_width, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_window, win_chat_height, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_window, win_chat_cursor_x, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_window, win_chat_cursor_y, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_window, bar_windows, POINTER, NULL, "bar_window"); + HDATA_VAR(struct t_gui_window, last_bar_window, POINTER, NULL, "bar_window"); + HDATA_VAR(struct t_gui_window, refresh_needed, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_window, gui_objects, POINTER, NULL, NULL); + HDATA_VAR(struct t_gui_window, buffer, POINTER, NULL, "buffer"); + HDATA_VAR(struct t_gui_window, layout_plugin_name, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_window, layout_buffer_name, STRING, NULL, NULL); + HDATA_VAR(struct t_gui_window, scroll, POINTER, NULL, "window_scroll"); + HDATA_VAR(struct t_gui_window, ptr_tree, POINTER, NULL, "window_tree"); + HDATA_VAR(struct t_gui_window, prev_window, POINTER, NULL, hdata_name); + HDATA_VAR(struct t_gui_window, next_window, POINTER, NULL, hdata_name); HDATA_LIST(gui_windows); HDATA_LIST(last_gui_window); HDATA_LIST(gui_current_window); @@ -1654,16 +1654,16 @@ gui_window_hdata_window_scroll_cb (void *data, const char *hdata_name) hdata = hdata_new (NULL, hdata_name, "prev_scroll", "next_scroll"); if (hdata) { - HDATA_VAR(struct t_gui_window_scroll, buffer, POINTER, "buffer"); - HDATA_VAR(struct t_gui_window_scroll, first_line_displayed, INTEGER, NULL); - HDATA_VAR(struct t_gui_window_scroll, start_line, POINTER, "line"); - HDATA_VAR(struct t_gui_window_scroll, start_line_pos, INTEGER, NULL); - HDATA_VAR(struct t_gui_window_scroll, scrolling, INTEGER, NULL); - HDATA_VAR(struct t_gui_window_scroll, start_col, INTEGER, NULL); - HDATA_VAR(struct t_gui_window_scroll, lines_after, INTEGER, NULL); - HDATA_VAR(struct t_gui_window_scroll, reset_allowed, INTEGER, NULL); - HDATA_VAR(struct t_gui_window_scroll, prev_scroll, POINTER, hdata_name); - HDATA_VAR(struct t_gui_window_scroll, next_scroll, POINTER, hdata_name); + HDATA_VAR(struct t_gui_window_scroll, buffer, POINTER, NULL, "buffer"); + HDATA_VAR(struct t_gui_window_scroll, first_line_displayed, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_window_scroll, start_line, POINTER, NULL, "line"); + HDATA_VAR(struct t_gui_window_scroll, start_line_pos, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_window_scroll, scrolling, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_window_scroll, start_col, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_window_scroll, lines_after, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_window_scroll, reset_allowed, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_window_scroll, prev_scroll, POINTER, NULL, hdata_name); + HDATA_VAR(struct t_gui_window_scroll, next_scroll, POINTER, NULL, hdata_name); } return hdata; } @@ -1683,12 +1683,12 @@ gui_window_hdata_window_tree_cb (void *data, const char *hdata_name) hdata = hdata_new (NULL, hdata_name, NULL, NULL); if (hdata) { - HDATA_VAR(struct t_gui_window_tree, parent_node, POINTER, hdata_name); - HDATA_VAR(struct t_gui_window_tree, split_pct, INTEGER, NULL); - HDATA_VAR(struct t_gui_window_tree, split_horizontal, INTEGER, NULL); - HDATA_VAR(struct t_gui_window_tree, child1, POINTER, hdata_name); - HDATA_VAR(struct t_gui_window_tree, child2, POINTER, hdata_name); - HDATA_VAR(struct t_gui_window_tree, window, POINTER, "window"); + HDATA_VAR(struct t_gui_window_tree, parent_node, POINTER, NULL, hdata_name); + HDATA_VAR(struct t_gui_window_tree, split_pct, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_window_tree, split_horizontal, INTEGER, NULL, NULL); + HDATA_VAR(struct t_gui_window_tree, child1, POINTER, NULL, hdata_name); + HDATA_VAR(struct t_gui_window_tree, child2, POINTER, NULL, hdata_name); + HDATA_VAR(struct t_gui_window_tree, window, POINTER, NULL, "window"); HDATA_LIST(gui_windows_tree); } return hdata; diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c index ce2e33d5d..c1547e12c 100644 --- a/src/plugins/irc/irc-channel.c +++ b/src/plugins/irc/irc-channel.c @@ -879,31 +879,31 @@ irc_channel_hdata_channel_cb (void *data, const char *hdata_name) hdata = weechat_hdata_new (hdata_name, "prev_channel", "next_channel"); if (hdata) { - WEECHAT_HDATA_VAR(struct t_irc_channel, type, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_channel, name, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_channel, topic, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_channel, modes, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_channel, limit, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_channel, key, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_channel, names_received, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_channel, checking_away, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_channel, away_message, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_channel, has_quit_server, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_channel, cycle, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_channel, part, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_channel, nick_completion_reset, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_channel, pv_remote_nick_color, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_channel, hook_autorejoin, POINTER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_count, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_channel, nicks, POINTER, "irc_nick"); - WEECHAT_HDATA_VAR(struct t_irc_channel, last_nick, POINTER, "irc_nick"); - WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_speaking, POINTER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_speaking_time, POINTER, "irc_channel_speaking"); - WEECHAT_HDATA_VAR(struct t_irc_channel, last_nick_speaking_time, POINTER, "irc_channel_speaking"); - WEECHAT_HDATA_VAR(struct t_irc_channel, buffer, POINTER, "buffer"); - WEECHAT_HDATA_VAR(struct t_irc_channel, buffer_as_string, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_channel, prev_channel, POINTER, hdata_name); - WEECHAT_HDATA_VAR(struct t_irc_channel, next_channel, POINTER, hdata_name); + WEECHAT_HDATA_VAR(struct t_irc_channel, type, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_channel, name, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_channel, topic, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_channel, modes, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_channel, limit, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_channel, key, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_channel, names_received, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_channel, checking_away, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_channel, away_message, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_channel, has_quit_server, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_channel, cycle, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_channel, part, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_channel, nick_completion_reset, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_channel, pv_remote_nick_color, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_channel, hook_autorejoin, POINTER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_count, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_channel, nicks, POINTER, NULL, "irc_nick"); + WEECHAT_HDATA_VAR(struct t_irc_channel, last_nick, POINTER, NULL, "irc_nick"); + WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_speaking, POINTER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_speaking_time, POINTER, NULL, "irc_channel_speaking"); + WEECHAT_HDATA_VAR(struct t_irc_channel, last_nick_speaking_time, POINTER, NULL, "irc_channel_speaking"); + WEECHAT_HDATA_VAR(struct t_irc_channel, buffer, POINTER, NULL, "buffer"); + WEECHAT_HDATA_VAR(struct t_irc_channel, buffer_as_string, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_channel, prev_channel, POINTER, NULL, hdata_name); + WEECHAT_HDATA_VAR(struct t_irc_channel, next_channel, POINTER, NULL, hdata_name); } return hdata; } @@ -923,10 +923,10 @@ irc_channel_hdata_channel_speaking_cb (void *data, const char *hdata_name) hdata = weechat_hdata_new (hdata_name, "prev_nick", "next_nick"); if (hdata) { - WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, nick, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, time_last_message, TIME, NULL); - WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, prev_nick, POINTER, hdata_name); - WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, next_nick, POINTER, hdata_name); + WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, nick, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, time_last_message, TIME, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, prev_nick, POINTER, NULL, hdata_name); + WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, next_nick, POINTER, NULL, hdata_name); } return hdata; } diff --git a/src/plugins/irc/irc-ignore.c b/src/plugins/irc/irc-ignore.c index d375abea3..fa756fa50 100644 --- a/src/plugins/irc/irc-ignore.c +++ b/src/plugins/irc/irc-ignore.c @@ -321,13 +321,13 @@ irc_ignore_hdata_ignore_cb (void *data, const char *hdata_name) hdata = weechat_hdata_new (hdata_name, "prev_ignore", "next_ignore"); if (hdata) { - WEECHAT_HDATA_VAR(struct t_irc_ignore, number, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_ignore, mask, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_ignore, regex_mask, POINTER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_ignore, server, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_ignore, channel, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_ignore, prev_ignore, POINTER, hdata_name); - WEECHAT_HDATA_VAR(struct t_irc_ignore, next_ignore, POINTER, hdata_name); + WEECHAT_HDATA_VAR(struct t_irc_ignore, number, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_ignore, mask, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_ignore, regex_mask, POINTER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_ignore, server, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_ignore, channel, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_ignore, prev_ignore, POINTER, NULL, hdata_name); + WEECHAT_HDATA_VAR(struct t_irc_ignore, next_ignore, POINTER, NULL, hdata_name); WEECHAT_HDATA_LIST(irc_ignore_list); WEECHAT_HDATA_LIST(last_irc_ignore); } diff --git a/src/plugins/irc/irc-nick.c b/src/plugins/irc/irc-nick.c index 249f98040..ab33b6f1d 100644 --- a/src/plugins/irc/irc-nick.c +++ b/src/plugins/irc/irc-nick.c @@ -1010,14 +1010,14 @@ irc_nick_hdata_nick_cb (void *data, const char *hdata_name) hdata = weechat_hdata_new (hdata_name, "prev_nick", "next_nick"); if (hdata) { - WEECHAT_HDATA_VAR(struct t_irc_nick, name, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_nick, host, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_nick, prefixes, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_nick, prefix, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_nick, away, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_nick, color, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_nick, prev_nick, POINTER, hdata_name); - WEECHAT_HDATA_VAR(struct t_irc_nick, next_nick, POINTER, hdata_name); + WEECHAT_HDATA_VAR(struct t_irc_nick, name, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_nick, host, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_nick, prefixes, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_nick, prefix, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_nick, away, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_nick, color, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_nick, prev_nick, POINTER, NULL, hdata_name); + WEECHAT_HDATA_VAR(struct t_irc_nick, next_nick, POINTER, NULL, hdata_name); } return hdata; } diff --git a/src/plugins/irc/irc-notify.c b/src/plugins/irc/irc-notify.c index 30c7f77d1..442add9d4 100644 --- a/src/plugins/irc/irc-notify.c +++ b/src/plugins/irc/irc-notify.c @@ -966,14 +966,14 @@ irc_notify_hdata_notify_cb (void *data, const char *hdata_name) hdata = weechat_hdata_new (hdata_name, "prev_notify", "next_notify"); if (hdata) { - WEECHAT_HDATA_VAR(struct t_irc_notify, server, POINTER, "irc_server"); - WEECHAT_HDATA_VAR(struct t_irc_notify, nick, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_notify, check_away, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_notify, is_on_server, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_notify, away_message, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_notify, ison_received, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_notify, prev_notify, POINTER, hdata_name); - WEECHAT_HDATA_VAR(struct t_irc_notify, next_notify, POINTER, hdata_name); + WEECHAT_HDATA_VAR(struct t_irc_notify, server, POINTER, NULL, "irc_server"); + WEECHAT_HDATA_VAR(struct t_irc_notify, nick, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_notify, check_away, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_notify, is_on_server, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_notify, away_message, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_notify, ison_received, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_notify, prev_notify, POINTER, NULL, hdata_name); + WEECHAT_HDATA_VAR(struct t_irc_notify, next_notify, POINTER, NULL, hdata_name); } return hdata; } diff --git a/src/plugins/irc/irc-redirect.c b/src/plugins/irc/irc-redirect.c index 90a7ae1bf..2bad81e0b 100644 --- a/src/plugins/irc/irc-redirect.c +++ b/src/plugins/irc/irc-redirect.c @@ -978,14 +978,14 @@ irc_redirect_hdata_redirect_pattern_cb (void *data, const char *hdata_name) hdata = weechat_hdata_new (hdata_name, "prev_redirect", "next_redirect"); if (hdata) { - WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, name, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, temp_pattern, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, timeout, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_start, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_stop, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_extra, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, prev_redirect, POINTER, hdata_name); - WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, next_redirect, POINTER, hdata_name); + WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, name, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, temp_pattern, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, timeout, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_start, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_stop, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_extra, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, prev_redirect, POINTER, NULL, hdata_name); + WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, next_redirect, POINTER, NULL, hdata_name); WEECHAT_HDATA_LIST(irc_redirect_patterns); WEECHAT_HDATA_LIST(last_irc_redirect_pattern); } @@ -1007,26 +1007,26 @@ irc_redirect_hdata_redirect_cb (void *data, const char *hdata_name) hdata = weechat_hdata_new (hdata_name, "prev_redirect", "next_redirect"); if (hdata) { - WEECHAT_HDATA_VAR(struct t_irc_redirect, server, POINTER, "irc_server"); - WEECHAT_HDATA_VAR(struct t_irc_redirect, pattern, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_redirect, signal, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_redirect, count, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_redirect, current_count, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_redirect, string, STRING, NULL); - 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, assigned_to_command, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_redirect, start_time, TIME, 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, 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); - WEECHAT_HDATA_VAR(struct t_irc_redirect, next_redirect, POINTER, hdata_name); + WEECHAT_HDATA_VAR(struct t_irc_redirect, server, POINTER, NULL, "irc_server"); + WEECHAT_HDATA_VAR(struct t_irc_redirect, pattern, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_redirect, signal, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_redirect, count, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_redirect, current_count, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_redirect, string, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_redirect, timeout, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_redirect, command, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_redirect, assigned_to_command, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_redirect, start_time, TIME, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_start, HASHTABLE, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_stop, HASHTABLE, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_extra, HASHTABLE, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_start_received, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_stop_received, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_filter, HASHTABLE, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_redirect, output, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_redirect, output_size, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_redirect, prev_redirect, POINTER, NULL, hdata_name); + WEECHAT_HDATA_VAR(struct t_irc_redirect, next_redirect, POINTER, NULL, hdata_name); } return hdata; } diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index f6972142d..1aefc0056 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -4263,71 +4263,71 @@ irc_server_hdata_server_cb (void *data, const char *hdata_name) hdata = weechat_hdata_new (hdata_name, "prev_server", "next_server"); if (hdata) { - WEECHAT_HDATA_VAR(struct t_irc_server, name, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, options, POINTER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, temp_server, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, reloading_from_config, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, reloaded_from_config, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, addresses_count, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, addresses_array, POINTER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, ports_array, POINTER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, index_current_address, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, current_address, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, current_ip, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, current_port, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, sock, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, hook_connect, POINTER, "hook"); - WEECHAT_HDATA_VAR(struct t_irc_server, hook_fd, POINTER, "hook"); - WEECHAT_HDATA_VAR(struct t_irc_server, hook_timer_connection, POINTER, "hook"); - WEECHAT_HDATA_VAR(struct t_irc_server, hook_timer_sasl, POINTER, "hook"); - WEECHAT_HDATA_VAR(struct t_irc_server, is_connected, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, ssl_connected, INTEGER, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, name, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, options, POINTER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, temp_server, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, reloading_from_config, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, reloaded_from_config, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, addresses_count, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, addresses_array, STRING, "addresses_count", NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, ports_array, INTEGER, "addresses_count", NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, index_current_address, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, current_address, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, current_ip, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, current_port, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, sock, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, hook_connect, POINTER, NULL, "hook"); + WEECHAT_HDATA_VAR(struct t_irc_server, hook_fd, POINTER, NULL, "hook"); + WEECHAT_HDATA_VAR(struct t_irc_server, hook_timer_connection, POINTER, NULL, "hook"); + WEECHAT_HDATA_VAR(struct t_irc_server, hook_timer_sasl, POINTER, NULL, "hook"); + WEECHAT_HDATA_VAR(struct t_irc_server, is_connected, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, ssl_connected, INTEGER, NULL, NULL); #ifdef HAVE_GNUTLS - WEECHAT_HDATA_VAR(struct t_irc_server, gnutls_sess, OTHER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, tls_cert, OTHER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, tls_cert_key, OTHER, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, gnutls_sess, OTHER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, tls_cert, OTHER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, tls_cert_key, OTHER, NULL, NULL); #endif - WEECHAT_HDATA_VAR(struct t_irc_server, unterminated_message, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, nicks_count, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, nicks_array, POINTER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, nick_first_tried, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, nick, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, nick_modes, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, isupport, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, prefix_modes, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, prefix_chars, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, nick_max_length, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, casemapping, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, chantypes, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, chanmodes, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, reconnect_delay, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, reconnect_start, TIME, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, command_time, TIME, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, reconnect_join, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, disable_autojoin, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, is_away, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, away_message, STRING, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, away_time, TIME, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, lag, INTEGER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, lag_check_time, OTHER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, lag_next_check, TIME, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, lag_last_refresh, TIME, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, cmd_list_regexp, POINTER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, last_user_message, TIME, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, last_away_check, TIME, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, outqueue, POINTER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, last_outqueue, POINTER, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, redirects, POINTER, "irc_redirect"); - 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, 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"); - WEECHAT_HDATA_VAR(struct t_irc_server, last_channel, POINTER, "irc_channel"); - WEECHAT_HDATA_VAR(struct t_irc_server, prev_server, POINTER, hdata_name); - WEECHAT_HDATA_VAR(struct t_irc_server, next_server, POINTER, hdata_name); + WEECHAT_HDATA_VAR(struct t_irc_server, unterminated_message, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, nicks_count, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, nicks_array, STRING, "nicks_count", NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, nick_first_tried, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, nick, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, nick_modes, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, isupport, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, prefix_modes, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, prefix_chars, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, nick_max_length, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, casemapping, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, chantypes, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, chanmodes, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, reconnect_delay, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, reconnect_start, TIME, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, command_time, TIME, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, reconnect_join, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, disable_autojoin, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, is_away, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, away_message, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, away_time, TIME, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, lag, INTEGER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, lag_check_time, OTHER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, lag_next_check, TIME, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, lag_last_refresh, TIME, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, cmd_list_regexp, POINTER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, last_user_message, TIME, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, last_away_check, TIME, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, outqueue, POINTER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, last_outqueue, POINTER, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, redirects, POINTER, NULL, "irc_redirect"); + WEECHAT_HDATA_VAR(struct t_irc_server, last_redirect, POINTER, NULL, "irc_redirect"); + WEECHAT_HDATA_VAR(struct t_irc_server, notify_list, POINTER, NULL, "irc_notify"); + WEECHAT_HDATA_VAR(struct t_irc_server, last_notify, POINTER, NULL, "irc_notify"); + WEECHAT_HDATA_VAR(struct t_irc_server, manual_joins, HASHTABLE, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, buffer, POINTER, NULL, "buffer"); + WEECHAT_HDATA_VAR(struct t_irc_server, buffer_as_string, STRING, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, channels, POINTER, NULL, "irc_channel"); + WEECHAT_HDATA_VAR(struct t_irc_server, last_channel, POINTER, NULL, "irc_channel"); + WEECHAT_HDATA_VAR(struct t_irc_server, prev_server, POINTER, NULL, hdata_name); + WEECHAT_HDATA_VAR(struct t_irc_server, next_server, POINTER, NULL, hdata_name); WEECHAT_HDATA_LIST(irc_servers); WEECHAT_HDATA_LIST(last_irc_server); } diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index 97bbe94b9..824f33bef 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -740,6 +740,8 @@ plugin_load (const char *filename, int argc, char **argv) new_plugin->hdata_get_var_offset = &hdata_get_var_offset; new_plugin->hdata_get_var_type = &hdata_get_var_type; new_plugin->hdata_get_var_type_string = &hdata_get_var_type_string; + new_plugin->hdata_get_var_array_size = &hdata_get_var_array_size; + new_plugin->hdata_get_var_array_size_string = &hdata_get_var_array_size_string; new_plugin->hdata_get_var_hdata = &hdata_get_var_hdata; new_plugin->hdata_get_var = &hdata_get_var; new_plugin->hdata_get_var_at_offset = &hdata_get_var_at_offset; @@ -1211,17 +1213,17 @@ plugin_hdata_plugin_cb (void *data, const char *hdata_name) hdata = hdata_new (NULL, hdata_name, "prev_plugin", "next_plugin"); if (hdata) { - HDATA_VAR(struct t_weechat_plugin, filename, STRING, NULL); - HDATA_VAR(struct t_weechat_plugin, handle, POINTER, NULL); - HDATA_VAR(struct t_weechat_plugin, name, STRING, NULL); - HDATA_VAR(struct t_weechat_plugin, description, STRING, NULL); - HDATA_VAR(struct t_weechat_plugin, author, STRING, NULL); - HDATA_VAR(struct t_weechat_plugin, version, STRING, NULL); - HDATA_VAR(struct t_weechat_plugin, license, STRING, NULL); - HDATA_VAR(struct t_weechat_plugin, charset, STRING, NULL); - HDATA_VAR(struct t_weechat_plugin, debug, INTEGER, NULL); - HDATA_VAR(struct t_weechat_plugin, prev_plugin, POINTER, hdata_name); - HDATA_VAR(struct t_weechat_plugin, next_plugin, POINTER, hdata_name); + HDATA_VAR(struct t_weechat_plugin, filename, STRING, NULL, NULL); + HDATA_VAR(struct t_weechat_plugin, handle, POINTER, NULL, NULL); + HDATA_VAR(struct t_weechat_plugin, name, STRING, NULL, NULL); + HDATA_VAR(struct t_weechat_plugin, description, STRING, NULL, NULL); + HDATA_VAR(struct t_weechat_plugin, author, STRING, NULL, NULL); + HDATA_VAR(struct t_weechat_plugin, version, STRING, NULL, NULL); + HDATA_VAR(struct t_weechat_plugin, license, STRING, NULL, NULL); + HDATA_VAR(struct t_weechat_plugin, charset, STRING, NULL, NULL); + HDATA_VAR(struct t_weechat_plugin, debug, INTEGER, NULL, NULL); + HDATA_VAR(struct t_weechat_plugin, prev_plugin, POINTER, NULL, hdata_name); + HDATA_VAR(struct t_weechat_plugin, next_plugin, POINTER, NULL, hdata_name); HDATA_LIST(weechat_plugins); HDATA_LIST(last_weechat_plugin); } diff --git a/src/plugins/scripts/guile/weechat-guile-api.c b/src/plugins/scripts/guile/weechat-guile-api.c index fe5e3c49e..789d5d89f 100644 --- a/src/plugins/scripts/guile/weechat-guile-api.c +++ b/src/plugins/scripts/guile/weechat-guile-api.c @@ -4852,6 +4852,51 @@ weechat_guile_api_hdata_get_var_type_string (SCM hdata, SCM name) } /* + * weechat_guile_api_hdata_get_var_array_size: get array size for variable in + * hdata + */ + +SCM +weechat_guile_api_hdata_get_var_array_size (SCM hdata, SCM pointer, SCM name) +{ + int value; + + API_FUNC(1, "hdata_get_var_array_size", API_RETURN_INT(-1)); + if (!scm_is_string (hdata) || !scm_is_string (pointer) + || !scm_is_string (name)) + API_WRONG_ARGS(API_RETURN_INT(-1)); + + value = weechat_hdata_get_var_array_size (API_STR2PTR(scm_i_string_chars (hdata)), + API_STR2PTR(scm_i_string_chars (pointer)), + scm_i_string_chars (name)); + + API_RETURN_INT(value); +} + +/* + * weechat_guile_api_hdata_get_var_array_size_string: get array size for variable + * in hdata (as string) + */ + +SCM +weechat_guile_api_hdata_get_var_array_size_string (SCM hdata, SCM pointer, + SCM name) +{ + const char *result; + + API_FUNC(1, "hdata_get_var_array_size_string", API_RETURN_EMPTY); + if (!scm_is_string (hdata) || !scm_is_string (pointer) + || !scm_is_string (name)) + API_WRONG_ARGS(API_RETURN_EMPTY); + + result = weechat_hdata_get_var_array_size_string (API_STR2PTR(scm_i_string_chars (hdata)), + API_STR2PTR(scm_i_string_chars (pointer)), + scm_i_string_chars (name)); + + API_RETURN_STRING(result); +} + +/* * weechat_guile_api_hdata_get_var_hdata: get hdata for variable in hdata */ @@ -5433,6 +5478,8 @@ weechat_guile_api_module_init (void *data) 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_array_size, 3); + API_DEF_FUNC(hdata_get_var_array_size_string, 3); API_DEF_FUNC(hdata_get_var_hdata, 2); API_DEF_FUNC(hdata_get_list, 2); API_DEF_FUNC(hdata_check_pointer, 3); diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c index 8a07c4e2d..11df83064 100644 --- a/src/plugins/scripts/lua/weechat-lua-api.c +++ b/src/plugins/scripts/lua/weechat-lua-api.c @@ -5340,6 +5340,57 @@ weechat_lua_api_hdata_get_var_type_string (lua_State *L) } /* + * weechat_lua_api_hdata_get_var_array_size: get array size for variable in + * hdata + */ + +static int +weechat_lua_api_hdata_get_var_array_size (lua_State *L) +{ + const char *hdata, *pointer, *name; + int value; + + API_FUNC(1, "hdata_get_var_array_size", API_RETURN_INT(-1)); + if (lua_gettop (lua_current_interpreter) < 3) + API_WRONG_ARGS(API_RETURN_INT(-1)); + + hdata = lua_tostring (lua_current_interpreter, -3); + pointer = lua_tostring (lua_current_interpreter, -2); + name = lua_tostring (lua_current_interpreter, -1); + + value = weechat_hdata_get_var_array_size (API_STR2PTR(hdata), + API_STR2PTR(pointer), + name); + + API_RETURN_INT(value); +} + +/* + * weechat_lua_api_hdata_get_var_array_size_string: get array size for variable + * in hdata (as string) + */ + +static int +weechat_lua_api_hdata_get_var_array_size_string (lua_State *L) +{ + const char *hdata, *pointer, *name, *result; + + API_FUNC(1, "hdata_get_var_array_size_string", 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); + + result = weechat_hdata_get_var_array_size_string (API_STR2PTR(hdata), + API_STR2PTR(pointer), + name); + + API_RETURN_STRING(result); +} + +/* * weechat_lua_api_hdata_get_var_hdata: get hdata for variable in hdata */ @@ -6352,6 +6403,8 @@ const struct luaL_Reg weechat_lua_api_funcs[] = { 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_array_size), + API_DEF_FUNC(hdata_get_var_array_size_string), API_DEF_FUNC(hdata_get_var_hdata), API_DEF_FUNC(hdata_get_list), API_DEF_FUNC(hdata_check_pointer), diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c index ccd1a6a2d..8a51ecbcc 100644 --- a/src/plugins/scripts/perl/weechat-perl-api.c +++ b/src/plugins/scripts/perl/weechat-perl-api.c @@ -5075,6 +5075,57 @@ XS (XS_weechat_api_hdata_get_var_type_string) } /* + * weechat::hdata_get_var_array_size: get array size for variable in hdata + */ + +XS (XS_weechat_api_hdata_get_var_array_size) +{ + char *hdata, *pointer, *name; + int value; + dXSARGS; + + API_FUNC(1, "hdata_get_var_array_size", API_RETURN_INT(-1)); + if (items < 3) + API_WRONG_ARGS(API_RETURN_INT(-1)); + + hdata = SvPV_nolen (ST (0)); + pointer = SvPV_nolen (ST (1)); + name = SvPV_nolen (ST (2)); + + value = weechat_hdata_get_var_array_size (API_STR2PTR(hdata), + API_STR2PTR(pointer), + name); + + API_RETURN_INT(value); +} + +/* + * weechat::hdata_get_var_array_size_string: get array size for variable in + * hdata (as string) + */ + +XS (XS_weechat_api_hdata_get_var_array_size_string) +{ + const char *result; + char *hdata, *pointer, *name; + dXSARGS; + + API_FUNC(1, "hdata_get_var_array_size_string", 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 = weechat_hdata_get_var_array_size_string (API_STR2PTR(hdata), + API_STR2PTR(pointer), + name); + + API_RETURN_STRING(result); +} + +/* * weechat::hdata_get_var_hdata: get hdata for variable in hdata */ @@ -5696,6 +5747,8 @@ weechat_perl_api_init (pTHX) 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_array_size); + API_DEF_FUNC(hdata_get_var_array_size_string); API_DEF_FUNC(hdata_get_var_hdata); API_DEF_FUNC(hdata_get_list); API_DEF_FUNC(hdata_check_pointer); diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c index a382ef062..15584d518 100644 --- a/src/plugins/scripts/python/weechat-python-api.c +++ b/src/plugins/scripts/python/weechat-python-api.c @@ -5265,6 +5265,57 @@ weechat_python_api_hdata_get_var_type_string (PyObject *self, PyObject *args) } /* + * weechat_python_api_hdata_get_var_array_size: get array size for variable in + * hdata + */ + +static PyObject * +weechat_python_api_hdata_get_var_array_size (PyObject *self, PyObject *args) +{ + char *hdata, *pointer, *name; + int value; + + API_FUNC(1, "hdata_get_var_array_size", API_RETURN_INT(-1)); + hdata = NULL; + pointer = NULL; + name = NULL; + if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name)) + API_WRONG_ARGS(API_RETURN_INT(-1)); + + value = weechat_hdata_get_var_array_size (API_STR2PTR(hdata), + API_STR2PTR(pointer), + name); + + API_RETURN_INT(value); +} + +/* + * weechat_python_api_hdata_get_var_array_size_string: get array size for variable + * in hdata (as string) + */ + +static PyObject * +weechat_python_api_hdata_get_var_array_size_string (PyObject *self, + PyObject *args) +{ + char *hdata, *pointer, *name; + const char *result; + + API_FUNC(1, "hdata_get_var_array_size_string", API_RETURN_EMPTY); + hdata = NULL; + pointer = NULL; + name = NULL; + if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name)) + API_WRONG_ARGS(API_RETURN_EMPTY); + + result = weechat_hdata_get_var_array_size_string (API_STR2PTR(hdata), + API_STR2PTR(pointer), + name); + + API_RETURN_STRING(result); +} + +/* * weechat_python_api_hdata_get_var_hdata: get hdata for variable in hdata */ @@ -5872,6 +5923,8 @@ PyMethodDef weechat_python_funcs[] = 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_array_size), + API_DEF_FUNC(hdata_get_var_array_size_string), API_DEF_FUNC(hdata_get_var_hdata), API_DEF_FUNC(hdata_get_list), API_DEF_FUNC(hdata_check_pointer), diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c index 3cef992ae..6d7f2eff0 100644 --- a/src/plugins/scripts/ruby/weechat-ruby-api.c +++ b/src/plugins/scripts/ruby/weechat-ruby-api.c @@ -6041,6 +6041,67 @@ weechat_ruby_api_hdata_get_var_type_string (VALUE class, VALUE hdata, } /* + * weechat_ruby_api_hdata_get_var_array_size: get array size for variable in hdata + */ + +static VALUE +weechat_ruby_api_hdata_get_var_array_size (VALUE class, VALUE hdata, VALUE pointer, + VALUE name) +{ + char *c_hdata, *c_pointer, *c_name; + int value; + + API_FUNC(1, "hdata_get_var_array_size", API_RETURN_INT(-1)); + if (NIL_P (hdata) || NIL_P (pointer) || NIL_P (name)) + API_WRONG_ARGS(API_RETURN_INT(-1)); + + 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); + + value = weechat_hdata_get_var_array_size (API_STR2PTR(c_hdata), + API_STR2PTR(c_pointer), + c_name); + + API_RETURN_INT(value); +} + +/* + * weechat_ruby_api_hdata_get_var_array_size_string: get array size for variable + * in hdata (as string) + */ + +static VALUE +weechat_ruby_api_hdata_get_var_array_size_string (VALUE class, VALUE hdata, + VALUE pointer, VALUE name) +{ + char *c_hdata, *c_pointer, *c_name; + const char *result; + + API_FUNC(1, "hdata_get_var_array_size_string", 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 = weechat_hdata_get_var_array_size_string (API_STR2PTR(c_hdata), + API_STR2PTR(c_pointer), + c_name); + + API_RETURN_STRING(result); +} + +/* * weechat_ruby_api_hdata_get_var_hdata: get hdata for variable in hdata */ @@ -6782,6 +6843,8 @@ weechat_ruby_api_init (VALUE ruby_mWeechat) 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_array_size, 3); + API_DEF_FUNC(hdata_get_var_array_size_string, 3); API_DEF_FUNC(hdata_get_var_hdata, 2); API_DEF_FUNC(hdata_get_list, 2); API_DEF_FUNC(hdata_check_pointer, 3); diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c index 6762516b5..785a0261f 100644 --- a/src/plugins/scripts/tcl/weechat-tcl-api.c +++ b/src/plugins/scripts/tcl/weechat-tcl-api.c @@ -5784,6 +5784,65 @@ weechat_tcl_api_hdata_get_var_type_string (ClientData clientData, } /* + * weechat_tcl_api_hdata_get_var_array_size: get array_size for variable in + * hdata + */ + +static int +weechat_tcl_api_hdata_get_var_array_size (ClientData clientData, + Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) +{ + Tcl_Obj *objp; + char *hdata, *pointer, *name; + int result, i; + + API_FUNC(1, "hdata_get_var_array_size", API_RETURN_INT(-1)); + if (objc < 4) + API_WRONG_ARGS(API_RETURN_INT(-1)); + + hdata = Tcl_GetStringFromObj (objv[1], &i); + pointer = Tcl_GetStringFromObj (objv[2], &i); + name = Tcl_GetStringFromObj (objv[3], &i); + + result = weechat_hdata_get_var_array_size (API_STR2PTR(hdata), + API_STR2PTR(pointer), + name); + + API_RETURN_INT(result); +} + +/* + * weechat_tcl_api_hdata_get_var_array_size_string: get array size for variable + * in hdata (as string) + */ + +static int +weechat_tcl_api_hdata_get_var_array_size_string (ClientData clientData, + Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) +{ + Tcl_Obj *objp; + char *hdata, *pointer, *name; + const char *result; + int i; + + API_FUNC(1, "hdata_get_var_array_size_string", 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 = weechat_hdata_get_var_array_size_string (API_STR2PTR(hdata), + API_STR2PTR(pointer), + name); + + API_RETURN_STRING(result); +} + +/* * weechat_tcl_api_hdata_get_var_hdata: get hdata for variable in hdata */ @@ -6549,6 +6608,8 @@ void weechat_tcl_api_init (Tcl_Interp *interp) 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_array_size); + API_DEF_FUNC(hdata_get_var_array_size_string); API_DEF_FUNC(hdata_get_var_hdata); API_DEF_FUNC(hdata_get_list); API_DEF_FUNC(hdata_check_pointer); diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index 15666c571..2d5b53816 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 "20120709-01" +#define WEECHAT_PLUGIN_API_VERSION "20120720-01" /* macros for defining plugin infos */ #define WEECHAT_PLUGIN_NAME(__name) \ @@ -834,7 +834,8 @@ struct t_weechat_plugin const char *hdata_name, const char *var_prev, const char *var_next); void (*hdata_new_var) (struct t_hdata *hdata, const char *name, int offset, - int type, const char *hdata_name); + int type, const char *array_size, + const char *hdata_name); void (*hdata_new_list) (struct t_hdata *hdata, const char *name, void *pointer); struct t_hdata *(*hdata_get) (struct t_weechat_plugin *plugin, @@ -843,6 +844,11 @@ struct t_weechat_plugin int (*hdata_get_var_type) (struct t_hdata *hdata, const char *name); const char *(*hdata_get_var_type_string) (struct t_hdata *hdata, const char *name); + int (*hdata_get_var_array_size) (struct t_hdata *hdata, void *pointer, + const char *name); + const char *(*hdata_get_var_array_size_string) (struct t_hdata *hdata, + void *pointer, + const char *name); const char *(*hdata_get_var_hdata) (struct t_hdata *hdata, const char *name); void *(*hdata_get_var) (struct t_hdata *hdata, void *pointer, @@ -1589,12 +1595,14 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin); weechat_plugin->hdata_new(weechat_plugin, __hdata_name, __var_prev, \ __var_next) #define weechat_hdata_new_var(__hdata, __name, __offset, __type, \ - __hdata_name) \ + __array_size, __hdata_name) \ weechat_plugin->hdata_new_var(__hdata, __name, __offset, __type, \ - __hdata_name) -#define WEECHAT_HDATA_VAR(__struct, __name, __type, __hdata_name) \ + __array_size, __hdata_name) +#define WEECHAT_HDATA_VAR(__struct, __name, __type, __array_size, \ + __hdata_name) \ weechat_hdata_new_var (hdata, #__name, offsetof (__struct, __name), \ - WEECHAT_HDATA_##__type, __hdata_name) + WEECHAT_HDATA_##__type, __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) \ @@ -1607,6 +1615,13 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin); weechat_plugin->hdata_get_var_type(__hdata, __name) #define weechat_hdata_get_var_type_string(__hdata, __name) \ weechat_plugin->hdata_get_var_type_string(__hdata, __name) +#define weechat_hdata_get_var_array_size(__hdata, __pointer, __name) \ + weechat_plugin->hdata_get_var_array_size(__hdata, __pointer, \ + __name) +#define weechat_hdata_get_var_array_size_string(__hdata, __pointer, \ + __name) \ + weechat_plugin->hdata_get_var_array_size_string(__hdata, __pointer, \ + __name) #define weechat_hdata_get_var_hdata(__hdata, __name) \ weechat_plugin->hdata_get_var_hdata(__hdata, __name) #define weechat_hdata_get_var(__hdata, __pointer, __name) \ |