mirror of
https://github.com/weechat/weechat.git
synced 2026-07-06 07:45:42 +02:00
api: add new function hdata_check_pointer
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -5329,6 +5329,31 @@ weechat_lua_api_hdata_get_list (lua_State *L)
|
||||
API_RETURN_STRING_FREE(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_lua_api_hdata_check_pointer: check pointer with hdata/list
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_api_hdata_check_pointer (lua_State *L)
|
||||
{
|
||||
const char *hdata, *list, *pointer;
|
||||
int value;
|
||||
|
||||
API_FUNC(1, "hdata_check_pointer", 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);
|
||||
list = lua_tostring (lua_current_interpreter, -2);
|
||||
pointer = lua_tostring (lua_current_interpreter, -1);
|
||||
|
||||
value = weechat_hdata_check_pointer (script_str2ptr (hdata),
|
||||
script_str2ptr (list),
|
||||
script_str2ptr (pointer));
|
||||
|
||||
API_RETURN_INT(value);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_lua_api_hdata_move: move pointer to another element in list
|
||||
*/
|
||||
@@ -6238,6 +6263,7 @@ const struct luaL_reg weechat_lua_api_funcs[] = {
|
||||
{ "hdata_get_var_type_string", &weechat_lua_api_hdata_get_var_type_string },
|
||||
{ "hdata_get_var_hdata", &weechat_lua_api_hdata_get_var_hdata },
|
||||
{ "hdata_get_list", &weechat_lua_api_hdata_get_list },
|
||||
{ "hdata_check_pointer", &weechat_lua_api_hdata_check_pointer },
|
||||
{ "hdata_move", &weechat_lua_api_hdata_move },
|
||||
{ "hdata_char", &weechat_lua_api_hdata_char },
|
||||
{ "hdata_integer", &weechat_lua_api_hdata_integer },
|
||||
|
||||
@@ -5069,6 +5069,31 @@ XS (XS_weechat_api_hdata_get_list)
|
||||
API_RETURN_STRING_FREE(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat::hdata_check_pointer: check pointer with hdata/list
|
||||
*/
|
||||
|
||||
XS (XS_weechat_api_hdata_check_pointer)
|
||||
{
|
||||
char *hdata, *list, *pointer;
|
||||
int value;
|
||||
dXSARGS;
|
||||
|
||||
API_FUNC(1, "hdata_check_pointer", API_RETURN_INT(0));
|
||||
if (items < 3)
|
||||
API_WRONG_ARGS(API_RETURN_INT(0));
|
||||
|
||||
hdata = SvPV_nolen (ST (0));
|
||||
list = SvPV_nolen (ST (1));
|
||||
pointer = SvPV_nolen (ST (2));
|
||||
|
||||
value = weechat_hdata_check_pointer (script_str2ptr (hdata),
|
||||
script_str2ptr (list),
|
||||
script_str2ptr (pointer));
|
||||
|
||||
API_RETURN_INT(value);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat::hdata_move: move pointer to another element in list
|
||||
*/
|
||||
@@ -5595,6 +5620,7 @@ weechat_perl_api_init (pTHX)
|
||||
newXS ("weechat::hdata_get_var_type_string", XS_weechat_api_hdata_get_var_type_string, "weechat");
|
||||
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_check_pointer", XS_weechat_api_hdata_check_pointer, "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");
|
||||
|
||||
@@ -5249,6 +5249,30 @@ weechat_python_api_hdata_get_list (PyObject *self, PyObject *args)
|
||||
API_RETURN_STRING_FREE(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_python_api_hdata_check_pointer: check pointer with hdata/list
|
||||
*/
|
||||
|
||||
static PyObject *
|
||||
weechat_python_api_hdata_check_pointer (PyObject *self, PyObject *args)
|
||||
{
|
||||
char *hdata, *list, *pointer;
|
||||
int value;
|
||||
|
||||
API_FUNC(1, "hdata_check_pointer", API_RETURN_INT(0));
|
||||
hdata = NULL;
|
||||
list = NULL;
|
||||
pointer = NULL;
|
||||
if (!PyArg_ParseTuple (args, "sss", &hdata, &list, &pointer))
|
||||
API_WRONG_ARGS(API_RETURN_INT(0));
|
||||
|
||||
value = weechat_hdata_check_pointer (script_str2ptr (hdata),
|
||||
script_str2ptr (list),
|
||||
script_str2ptr (pointer));
|
||||
|
||||
API_RETURN_INT(value);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_python_api_hdata_move: move pointer to another element in list
|
||||
*/
|
||||
@@ -5765,6 +5789,7 @@ PyMethodDef weechat_python_funcs[] =
|
||||
{ "hdata_get_var_type_string", &weechat_python_api_hdata_get_var_type_string, METH_VARARGS, "" },
|
||||
{ "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_check_pointer", &weechat_python_api_hdata_check_pointer, 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, "" },
|
||||
|
||||
@@ -6028,6 +6028,36 @@ weechat_ruby_api_hdata_get_list (VALUE class, VALUE hdata, VALUE name)
|
||||
API_RETURN_STRING_FREE(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_api_hdata_check_pointer: check pointer with hdata/list
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_api_hdata_check_pointer (VALUE class, VALUE hdata, VALUE list,
|
||||
VALUE pointer)
|
||||
{
|
||||
char *c_hdata, *c_list, *c_pointer;
|
||||
int value;
|
||||
|
||||
API_FUNC(1, "hdata_check_pointer", API_RETURN_INT(0));
|
||||
if (NIL_P (hdata) || NIL_P (list) || NIL_P (pointer))
|
||||
API_WRONG_ARGS(API_RETURN_INT(0));
|
||||
|
||||
Check_Type (hdata, T_STRING);
|
||||
Check_Type (list, T_STRING);
|
||||
Check_Type (pointer, T_STRING);
|
||||
|
||||
c_hdata = StringValuePtr (hdata);
|
||||
c_list = StringValuePtr (list);
|
||||
c_pointer = StringValuePtr (pointer);
|
||||
|
||||
value = weechat_hdata_check_pointer (script_str2ptr (c_hdata),
|
||||
script_str2ptr (c_list),
|
||||
script_str2ptr (c_pointer));
|
||||
|
||||
API_RETURN_INT(value);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_api_hdata_move: move pointer to another element in list
|
||||
*/
|
||||
@@ -6657,6 +6687,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
|
||||
rb_define_module_function (ruby_mWeechat, "hdata_get_var_type_string", &weechat_ruby_api_hdata_get_var_type_string, 2);
|
||||
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_check_pointer", &weechat_ruby_api_hdata_check_pointer, 3);
|
||||
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);
|
||||
|
||||
@@ -5772,6 +5772,33 @@ weechat_tcl_api_hdata_get_list (ClientData clientData, Tcl_Interp *interp,
|
||||
API_RETURN_STRING_FREE(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_tcl_api_hdata_check_pointer: check pointer with hdata/list
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_tcl_api_hdata_check_pointer (ClientData clientData, Tcl_Interp *interp,
|
||||
int objc, Tcl_Obj *CONST objv[])
|
||||
{
|
||||
Tcl_Obj *objp;
|
||||
char *hdata, *list, *pointer;
|
||||
int result, i;
|
||||
|
||||
API_FUNC(1, "hdata_check_pointer", API_RETURN_INT(0));
|
||||
if (objc < 4)
|
||||
API_WRONG_ARGS(API_RETURN_INT(0));
|
||||
|
||||
hdata = Tcl_GetStringFromObj (objv[1], &i);
|
||||
list = Tcl_GetStringFromObj (objv[2], &i);
|
||||
pointer = Tcl_GetStringFromObj (objv[3], &i);
|
||||
|
||||
result = weechat_hdata_check_pointer (script_str2ptr (hdata),
|
||||
script_str2ptr (list),
|
||||
script_str2ptr (pointer));
|
||||
|
||||
API_RETURN_INT(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_tcl_api_hdata_move: move pointer to another element in list
|
||||
*/
|
||||
@@ -6568,6 +6595,8 @@ void weechat_tcl_api_init (Tcl_Interp *interp)
|
||||
weechat_tcl_api_hdata_get_var_hdata, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
|
||||
Tcl_CreateObjCommand (interp, "weechat::hdata_get_list",
|
||||
weechat_tcl_api_hdata_get_list, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
|
||||
Tcl_CreateObjCommand (interp, "weechat::hdata_check_pointer",
|
||||
weechat_tcl_api_hdata_check_pointer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
|
||||
Tcl_CreateObjCommand (interp, "weechat::hdata_move",
|
||||
weechat_tcl_api_hdata_move, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
|
||||
Tcl_CreateObjCommand (interp, "weechat::hdata_integer",
|
||||
|
||||
Reference in New Issue
Block a user