mirror of
https://github.com/weechat/weechat.git
synced 2026-06-26 21:06:38 +02:00
core: add type char for hdata and function hdata_char in plugin/script API
This commit is contained in:
@@ -4855,6 +4855,28 @@ weechat_guile_api_hdata_move (SCM hdata, SCM pointer, SCM count)
|
||||
API_RETURN_STRING_FREE(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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);
|
||||
|
||||
@@ -5351,6 +5351,32 @@ weechat_lua_api_hdata_move (lua_State *L)
|
||||
API_RETURN_STRING_FREE(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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 },
|
||||
|
||||
@@ -5089,6 +5089,31 @@ XS (XS_weechat_api_hdata_move)
|
||||
API_RETURN_STRING_FREE(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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");
|
||||
|
||||
@@ -5270,6 +5270,31 @@ weechat_python_api_hdata_move (PyObject *self, PyObject *args)
|
||||
API_RETURN_STRING_FREE(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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, "" },
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user