diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/plugin.c | 1 | ||||
-rw-r--r-- | src/plugins/scripts/guile/weechat-guile-api.c | 23 | ||||
-rw-r--r-- | src/plugins/scripts/lua/weechat-lua-api.c | 27 | ||||
-rw-r--r-- | src/plugins/scripts/perl/weechat-perl-api.c | 26 | ||||
-rw-r--r-- | src/plugins/scripts/python/weechat-python-api.c | 26 | ||||
-rw-r--r-- | src/plugins/scripts/ruby/weechat-ruby-api.c | 32 | ||||
-rw-r--r-- | src/plugins/weechat-plugin.h | 17 |
7 files changed, 146 insertions, 6 deletions
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index d256fe0e4..fe9b13e0c 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -739,6 +739,7 @@ plugin_load (const char *filename, int argc, char **argv) new_plugin->hdata_get_var_at_offset = &hdata_get_var_at_offset; new_plugin->hdata_get_list = &hdata_get_list; new_plugin->hdata_move = &hdata_move; + new_plugin->hdata_char = &hdata_char; new_plugin->hdata_integer = &hdata_integer; new_plugin->hdata_long = &hdata_long; new_plugin->hdata_string = &hdata_string; diff --git a/src/plugins/scripts/guile/weechat-guile-api.c b/src/plugins/scripts/guile/weechat-guile-api.c index b0211c143..7467dec7b 100644 --- a/src/plugins/scripts/guile/weechat-guile-api.c +++ b/src/plugins/scripts/guile/weechat-guile-api.c @@ -4856,6 +4856,28 @@ weechat_guile_api_hdata_move (SCM hdata, SCM pointer, SCM count) } /* + * weechat_guile_api_hdata_char: get char value of a variable in structure + * using hdata + */ + +SCM +weechat_guile_api_hdata_char (SCM hdata, SCM pointer, SCM name) +{ + int value; + + API_FUNC(1, "hdata_char", API_RETURN_INT(0)); + if (!scm_is_string (hdata) || !scm_is_string (pointer) + || !scm_is_string (name)) + API_WRONG_ARGS(API_RETURN_INT(0)); + + value = (int)weechat_hdata_char (script_str2ptr (scm_i_string_chars (hdata)), + script_str2ptr (scm_i_string_chars (pointer)), + scm_i_string_chars (name)); + + API_RETURN_INT(value); +} + +/* * weechat_guile_api_hdata_integer: get integer value of a variable in structure * using hdata */ @@ -5312,6 +5334,7 @@ weechat_guile_api_module_init (void *data) scm_c_define_gsubr ("weechat:hdata_get_var_hdata", 2, 0, 0, &weechat_guile_api_hdata_get_var_hdata); scm_c_define_gsubr ("weechat:hdata_get_list", 2, 0, 0, &weechat_guile_api_hdata_get_list); scm_c_define_gsubr ("weechat:hdata_move", 3, 0, 0, &weechat_guile_api_hdata_move); + scm_c_define_gsubr ("weechat:hdata_char", 3, 0, 0, &weechat_guile_api_hdata_char); scm_c_define_gsubr ("weechat:hdata_integer", 3, 0, 0, &weechat_guile_api_hdata_integer); scm_c_define_gsubr ("weechat:hdata_long", 3, 0, 0, &weechat_guile_api_hdata_long); scm_c_define_gsubr ("weechat:hdata_string", 3, 0, 0, &weechat_guile_api_hdata_string); diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c index 1f2a79db6..24ccbce6d 100644 --- a/src/plugins/scripts/lua/weechat-lua-api.c +++ b/src/plugins/scripts/lua/weechat-lua-api.c @@ -5352,6 +5352,32 @@ weechat_lua_api_hdata_move (lua_State *L) } /* + * weechat_lua_api_hdata_char: get char value of a variable in structure using + * hdata + */ + +static int +weechat_lua_api_hdata_char (lua_State *L) +{ + const char *hdata, *pointer, *name; + int value; + + API_FUNC(1, "hdata_char", API_RETURN_INT(0)); + if (lua_gettop (lua_current_interpreter) < 3) + API_WRONG_ARGS(API_RETURN_INT(0)); + + hdata = lua_tostring (lua_current_interpreter, -3); + pointer = lua_tostring (lua_current_interpreter, -2); + name = lua_tostring (lua_current_interpreter, -1); + + value = (int)weechat_hdata_char (script_str2ptr (hdata), + script_str2ptr (pointer), + name); + + API_RETURN_INT(value); +} + +/* * weechat_lua_api_hdata_integer: get integer value of a variable in structure * using hdata */ @@ -6205,6 +6231,7 @@ const struct luaL_reg weechat_lua_api_funcs[] = { { "hdata_get_var_hdata", &weechat_lua_api_hdata_get_var_hdata }, { "hdata_get_list", &weechat_lua_api_hdata_get_list }, { "hdata_move", &weechat_lua_api_hdata_move }, + { "hdata_char", &weechat_lua_api_hdata_char }, { "hdata_integer", &weechat_lua_api_hdata_integer }, { "hdata_long", &weechat_lua_api_hdata_long }, { "hdata_string", &weechat_lua_api_hdata_string }, diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c index 85f87e2d6..d02ee2d75 100644 --- a/src/plugins/scripts/perl/weechat-perl-api.c +++ b/src/plugins/scripts/perl/weechat-perl-api.c @@ -5090,6 +5090,31 @@ XS (XS_weechat_api_hdata_move) } /* + * weechat::hdata_char: get char value of a variable in structure using hdata + */ + +XS (XS_weechat_api_hdata_char) +{ + char *hdata, *pointer, *name; + int value; + dXSARGS; + + API_FUNC(1, "hdata_char", API_RETURN_INT(0)); + if (items < 3) + API_WRONG_ARGS(API_RETURN_INT(0)); + + hdata = SvPV_nolen (ST (0)); + pointer = SvPV_nolen (ST (1)); + name = SvPV_nolen (ST (2)); + + value = (int)weechat_hdata_char (script_str2ptr (hdata), + script_str2ptr (pointer), + name); + + API_RETURN_INT(value); +} + +/* * weechat::hdata_integer: get integer value of a variable in structure using * hdata */ @@ -5562,6 +5587,7 @@ weechat_perl_api_init (pTHX) newXS ("weechat::hdata_get_var_hdata", XS_weechat_api_hdata_get_var_hdata, "weechat"); newXS ("weechat::hdata_get_list", XS_weechat_api_hdata_get_list, "weechat"); newXS ("weechat::hdata_move", XS_weechat_api_hdata_move, "weechat"); + newXS ("weechat::hdata_char", XS_weechat_api_hdata_char, "weechat"); newXS ("weechat::hdata_integer", XS_weechat_api_hdata_integer, "weechat"); newXS ("weechat::hdata_long", XS_weechat_api_hdata_long, "weechat"); newXS ("weechat::hdata_string", XS_weechat_api_hdata_string, "weechat"); diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c index 83bfde802..18b826ee6 100644 --- a/src/plugins/scripts/python/weechat-python-api.c +++ b/src/plugins/scripts/python/weechat-python-api.c @@ -5271,6 +5271,31 @@ weechat_python_api_hdata_move (PyObject *self, PyObject *args) } /* + * weechat_python_api_hdata_char: get char value of a variable in structure + * using hdata + */ + +static PyObject * +weechat_python_api_hdata_char (PyObject *self, PyObject *args) +{ + char *hdata, *pointer, *name; + int value; + + API_FUNC(1, "hdata_char", API_RETURN_INT(0)); + hdata = NULL; + pointer = NULL; + name = NULL; + if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name)) + API_WRONG_ARGS(API_RETURN_INT(0)); + + value = (int)weechat_hdata_char (script_str2ptr (hdata), + script_str2ptr (pointer), + name); + + API_RETURN_INT(value); +} + +/* * weechat_python_api_hdata_integer: get integer value of a variable in * structure using hdata */ @@ -5733,6 +5758,7 @@ PyMethodDef weechat_python_funcs[] = { "hdata_get_var_hdata", &weechat_python_api_hdata_get_var_hdata, METH_VARARGS, "" }, { "hdata_get_list", &weechat_python_api_hdata_get_list, METH_VARARGS, "" }, { "hdata_move", &weechat_python_api_hdata_move, METH_VARARGS, "" }, + { "hdata_char", &weechat_python_api_hdata_char, METH_VARARGS, "" }, { "hdata_integer", &weechat_python_api_hdata_integer, METH_VARARGS, "" }, { "hdata_long", &weechat_python_api_hdata_long, METH_VARARGS, "" }, { "hdata_string", &weechat_python_api_hdata_string, METH_VARARGS, "" }, diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c index 970e0d3c0..5d9b0478b 100644 --- a/src/plugins/scripts/ruby/weechat-ruby-api.c +++ b/src/plugins/scripts/ruby/weechat-ruby-api.c @@ -6056,6 +6056,37 @@ weechat_ruby_api_hdata_move (VALUE class, VALUE hdata, VALUE pointer, } /* + * weechat_ruby_api_hdata_char: get char value of a variable in structure using + * hdata + */ + +static VALUE +weechat_ruby_api_hdata_char (VALUE class, VALUE hdata, VALUE pointer, + VALUE name) +{ + char *c_hdata, *c_pointer, *c_name; + int value; + + API_FUNC(1, "hdata_char", API_RETURN_INT(0)); + if (NIL_P (hdata) || NIL_P (pointer) || NIL_P (name)) + API_WRONG_ARGS(API_RETURN_INT(0)); + + 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 = (int)weechat_hdata_char (script_str2ptr (c_hdata), + script_str2ptr (c_pointer), + c_name); + + API_RETURN_INT(value); +} + +/* * weechat_ruby_api_hdata_integer: get integer value of a variable in structure * using hdata */ @@ -6619,6 +6650,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat) rb_define_module_function (ruby_mWeechat, "hdata_get_var_hdata", &weechat_ruby_api_hdata_get_var_hdata, 2); rb_define_module_function (ruby_mWeechat, "hdata_get_list", &weechat_ruby_api_hdata_get_list, 2); rb_define_module_function (ruby_mWeechat, "hdata_move", &weechat_ruby_api_hdata_move, 3); + rb_define_module_function (ruby_mWeechat, "hdata_char", &weechat_ruby_api_hdata_char, 3); rb_define_module_function (ruby_mWeechat, "hdata_integer", &weechat_ruby_api_hdata_integer, 3); rb_define_module_function (ruby_mWeechat, "hdata_long", &weechat_ruby_api_hdata_long, 3); rb_define_module_function (ruby_mWeechat, "hdata_string", &weechat_ruby_api_hdata_string, 3); diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index bed5d3c9c..8cbc1ae9b 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 "20111112-01" +#define WEECHAT_PLUGIN_API_VERSION "20111125-01" /* macros for defining plugin infos */ #define WEECHAT_PLUGIN_NAME(__name) \ @@ -105,11 +105,12 @@ struct timeval; /* types for hdata */ #define WEECHAT_HDATA_OTHER 0 -#define WEECHAT_HDATA_INTEGER 1 -#define WEECHAT_HDATA_LONG 2 -#define WEECHAT_HDATA_STRING 3 -#define WEECHAT_HDATA_POINTER 4 -#define WEECHAT_HDATA_TIME 5 +#define WEECHAT_HDATA_CHAR 1 +#define WEECHAT_HDATA_INTEGER 2 +#define WEECHAT_HDATA_LONG 3 +#define WEECHAT_HDATA_STRING 4 +#define WEECHAT_HDATA_POINTER 5 +#define WEECHAT_HDATA_TIME 6 /* buffer hotlist */ #define WEECHAT_HOTLIST_LOW "0" @@ -824,6 +825,8 @@ struct t_weechat_plugin int offset); void *(*hdata_get_list) (struct t_hdata *hdata, const char *name); void *(*hdata_move) (struct t_hdata *hdata, void *pointer, int count); + char (*hdata_char) (struct t_hdata *hdata, void *pointer, + const char *name); int (*hdata_integer) (struct t_hdata *hdata, void *pointer, const char *name); long (*hdata_long) (struct t_hdata *hdata, void *pointer, @@ -1567,6 +1570,8 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin); weechat_plugin->hdata_get_list(__hdata, __name) #define weechat_hdata_move(__hdata, __pointer, __count) \ weechat_plugin->hdata_move(__hdata, __pointer, __count) +#define weechat_hdata_char(__hdata, __pointer, __name) \ + weechat_plugin->hdata_char(__hdata, __pointer, __name) #define weechat_hdata_integer(__hdata, __pointer, __name) \ weechat_plugin->hdata_integer(__hdata, __pointer, __name) #define weechat_hdata_long(__hdata, __pointer, __name) \ |