1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-29 22:36:38 +02:00

core: add type char for hdata and function hdata_char in plugin/script API

This commit is contained in:
Sebastien Helleu
2011-11-25 15:09:44 +01:00
parent 96940af8c3
commit bfc010df2f
13 changed files with 311 additions and 10 deletions
@@ -6055,6 +6055,37 @@ weechat_ruby_api_hdata_move (VALUE class, VALUE hdata, VALUE pointer,
API_RETURN_STRING_FREE(result);
}
/*
* 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);