diff options
Diffstat (limited to 'src/plugins/scripts')
-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 |
5 files changed, 134 insertions, 0 deletions
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); |