diff options
Diffstat (limited to 'doc/en/weechat_plugin_api.en.txt')
-rw-r--r-- | doc/en/weechat_plugin_api.en.txt | 78 |
1 files changed, 60 insertions, 18 deletions
diff --git a/doc/en/weechat_plugin_api.en.txt b/doc/en/weechat_plugin_api.en.txt index 8628b6e46..c6e77ce8c 100644 --- a/doc/en/weechat_plugin_api.en.txt +++ b/doc/en/weechat_plugin_api.en.txt @@ -11686,7 +11686,8 @@ Prototype: [source,C] ---------------------------------------- -void weechat_hdata_new_var (struct t_hdata *hdata, const char *name, int offset, int type); +void weechat_hdata_new_var (struct t_hdata *hdata, const char *name, int offset, int type, + const char *hdata_name); ---------------------------------------- Arguments: @@ -11701,6 +11702,7 @@ Arguments: ** WEECHAT_HDATA_POINTER ** WEECHAT_HDATA_TIME ** WEECHAT_HDATA_OTHER +* 'hdata_name': name of a hdata (if it's a pointer to a structure with hdata) C example: @@ -11718,22 +11720,22 @@ 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); -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); +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"); ---------------------------------------- The macro "WEECHAT_HDATA_VAR" can be used to shorten code: [source,C] ---------------------------------------- -WEECHAT_HDATA_VAR(struct t_myplugin_list, name, STRING); -WEECHAT_HDATA_VAR(struct t_myplugin_list, buffer, POINTER); -WEECHAT_HDATA_VAR(struct t_myplugin_list, count, INTEGER); -WEECHAT_HDATA_VAR(struct t_myplugin_list, prev, POINTER); -WEECHAT_HDATA_VAR(struct t_myplugin_list, next, POINTER); +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"); ---------------------------------------- [NOTE] @@ -11778,11 +11780,11 @@ 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); +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_list (hdata, "buffers", &buffers); weechat_hdata_new_list (hdata, "last_buffer", &last_buffer); ---------------------------------------- @@ -11961,8 +11963,7 @@ C example: [source,C] ---------------------------------------- -weechat_printf (NULL, "type = %s", - weechat_hdata_get_var_type_string (hdata, "name")); +weechat_printf (NULL, "type = %s", weechat_hdata_get_var_type_string (hdata, "name")); ---------------------------------------- Script (Python): @@ -11976,6 +11977,47 @@ type = weechat.hdata_get_var_type_string(hdata, name) weechat.prnt("", "type = %s" % weechat.hdata_get_var_type_string("name")) ---------------------------------------- +weechat_hdata_get_var_hdata +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_New in version 0.3.6._ + +Return hdata for a variable in hdata. + +Prototype: + +[source,C] +---------------------------------------- +const char *weechat_hdata_get_var_hdata (struct t_hdata *hdata, const char *name); +---------------------------------------- + +Arguments: + +* 'hdata': hdata pointer +* 'name': variable name + +Return value: + +* hdata for variable, NULL if no hdata or if an error occured + +C example: + +[source,C] +---------------------------------------- +weechat_printf (NULL, "hdata = %s", weechat_hdata_get_var_hdata (hdata, "name")); +---------------------------------------- + +Script (Python): + +[source,python] +---------------------------------------- +# prototype +hdata_name = weechat.hdata_get_var_hdata(hdata, name) + +# example +weechat.prnt("", "hdata = %s" % weechat.hdata_get_var_hdata(hdata, "name")) +---------------------------------------- + weechat_hdata_get_var ^^^^^^^^^^^^^^^^^^^^^ |