diff options
Diffstat (limited to 'src/plugins/scripts')
-rw-r--r-- | src/plugins/scripts/guile/weechat-guile-api.c | 47 | ||||
-rw-r--r-- | src/plugins/scripts/lua/weechat-lua-api.c | 53 | ||||
-rw-r--r-- | src/plugins/scripts/perl/weechat-perl-api.c | 53 | ||||
-rw-r--r-- | src/plugins/scripts/python/weechat-python-api.c | 53 | ||||
-rw-r--r-- | src/plugins/scripts/ruby/weechat-ruby-api.c | 63 | ||||
-rw-r--r-- | src/plugins/scripts/tcl/weechat-tcl-api.c | 61 |
6 files changed, 330 insertions, 0 deletions
diff --git a/src/plugins/scripts/guile/weechat-guile-api.c b/src/plugins/scripts/guile/weechat-guile-api.c index fe5e3c49e..789d5d89f 100644 --- a/src/plugins/scripts/guile/weechat-guile-api.c +++ b/src/plugins/scripts/guile/weechat-guile-api.c @@ -4852,6 +4852,51 @@ weechat_guile_api_hdata_get_var_type_string (SCM hdata, SCM name) } /* + * weechat_guile_api_hdata_get_var_array_size: get array size for variable in + * hdata + */ + +SCM +weechat_guile_api_hdata_get_var_array_size (SCM hdata, SCM pointer, SCM name) +{ + int value; + + API_FUNC(1, "hdata_get_var_array_size", API_RETURN_INT(-1)); + if (!scm_is_string (hdata) || !scm_is_string (pointer) + || !scm_is_string (name)) + API_WRONG_ARGS(API_RETURN_INT(-1)); + + value = weechat_hdata_get_var_array_size (API_STR2PTR(scm_i_string_chars (hdata)), + API_STR2PTR(scm_i_string_chars (pointer)), + scm_i_string_chars (name)); + + API_RETURN_INT(value); +} + +/* + * weechat_guile_api_hdata_get_var_array_size_string: get array size for variable + * in hdata (as string) + */ + +SCM +weechat_guile_api_hdata_get_var_array_size_string (SCM hdata, SCM pointer, + SCM name) +{ + const char *result; + + API_FUNC(1, "hdata_get_var_array_size_string", API_RETURN_EMPTY); + if (!scm_is_string (hdata) || !scm_is_string (pointer) + || !scm_is_string (name)) + API_WRONG_ARGS(API_RETURN_EMPTY); + + result = weechat_hdata_get_var_array_size_string (API_STR2PTR(scm_i_string_chars (hdata)), + API_STR2PTR(scm_i_string_chars (pointer)), + scm_i_string_chars (name)); + + API_RETURN_STRING(result); +} + +/* * weechat_guile_api_hdata_get_var_hdata: get hdata for variable in hdata */ @@ -5433,6 +5478,8 @@ weechat_guile_api_module_init (void *data) API_DEF_FUNC(hdata_get, 1); API_DEF_FUNC(hdata_get_var_offset, 2); API_DEF_FUNC(hdata_get_var_type_string, 2); + API_DEF_FUNC(hdata_get_var_array_size, 3); + API_DEF_FUNC(hdata_get_var_array_size_string, 3); API_DEF_FUNC(hdata_get_var_hdata, 2); API_DEF_FUNC(hdata_get_list, 2); API_DEF_FUNC(hdata_check_pointer, 3); diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c index 8a07c4e2d..11df83064 100644 --- a/src/plugins/scripts/lua/weechat-lua-api.c +++ b/src/plugins/scripts/lua/weechat-lua-api.c @@ -5340,6 +5340,57 @@ weechat_lua_api_hdata_get_var_type_string (lua_State *L) } /* + * weechat_lua_api_hdata_get_var_array_size: get array size for variable in + * hdata + */ + +static int +weechat_lua_api_hdata_get_var_array_size (lua_State *L) +{ + const char *hdata, *pointer, *name; + int value; + + API_FUNC(1, "hdata_get_var_array_size", API_RETURN_INT(-1)); + if (lua_gettop (lua_current_interpreter) < 3) + API_WRONG_ARGS(API_RETURN_INT(-1)); + + hdata = lua_tostring (lua_current_interpreter, -3); + pointer = lua_tostring (lua_current_interpreter, -2); + name = lua_tostring (lua_current_interpreter, -1); + + value = weechat_hdata_get_var_array_size (API_STR2PTR(hdata), + API_STR2PTR(pointer), + name); + + API_RETURN_INT(value); +} + +/* + * weechat_lua_api_hdata_get_var_array_size_string: get array size for variable + * in hdata (as string) + */ + +static int +weechat_lua_api_hdata_get_var_array_size_string (lua_State *L) +{ + const char *hdata, *pointer, *name, *result; + + API_FUNC(1, "hdata_get_var_array_size_string", API_RETURN_EMPTY); + if (lua_gettop (lua_current_interpreter) < 3) + API_WRONG_ARGS(API_RETURN_EMPTY); + + hdata = lua_tostring (lua_current_interpreter, -3); + pointer = lua_tostring (lua_current_interpreter, -2); + name = lua_tostring (lua_current_interpreter, -1); + + result = weechat_hdata_get_var_array_size_string (API_STR2PTR(hdata), + API_STR2PTR(pointer), + name); + + API_RETURN_STRING(result); +} + +/* * weechat_lua_api_hdata_get_var_hdata: get hdata for variable in hdata */ @@ -6352,6 +6403,8 @@ const struct luaL_Reg weechat_lua_api_funcs[] = { API_DEF_FUNC(hdata_get), API_DEF_FUNC(hdata_get_var_offset), API_DEF_FUNC(hdata_get_var_type_string), + API_DEF_FUNC(hdata_get_var_array_size), + API_DEF_FUNC(hdata_get_var_array_size_string), API_DEF_FUNC(hdata_get_var_hdata), API_DEF_FUNC(hdata_get_list), API_DEF_FUNC(hdata_check_pointer), diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c index ccd1a6a2d..8a51ecbcc 100644 --- a/src/plugins/scripts/perl/weechat-perl-api.c +++ b/src/plugins/scripts/perl/weechat-perl-api.c @@ -5075,6 +5075,57 @@ XS (XS_weechat_api_hdata_get_var_type_string) } /* + * weechat::hdata_get_var_array_size: get array size for variable in hdata + */ + +XS (XS_weechat_api_hdata_get_var_array_size) +{ + char *hdata, *pointer, *name; + int value; + dXSARGS; + + API_FUNC(1, "hdata_get_var_array_size", API_RETURN_INT(-1)); + if (items < 3) + API_WRONG_ARGS(API_RETURN_INT(-1)); + + hdata = SvPV_nolen (ST (0)); + pointer = SvPV_nolen (ST (1)); + name = SvPV_nolen (ST (2)); + + value = weechat_hdata_get_var_array_size (API_STR2PTR(hdata), + API_STR2PTR(pointer), + name); + + API_RETURN_INT(value); +} + +/* + * weechat::hdata_get_var_array_size_string: get array size for variable in + * hdata (as string) + */ + +XS (XS_weechat_api_hdata_get_var_array_size_string) +{ + const char *result; + char *hdata, *pointer, *name; + dXSARGS; + + API_FUNC(1, "hdata_get_var_array_size_string", API_RETURN_EMPTY); + if (items < 3) + API_WRONG_ARGS(API_RETURN_EMPTY); + + hdata = SvPV_nolen (ST (0)); + pointer = SvPV_nolen (ST (1)); + name = SvPV_nolen (ST (2)); + + result = weechat_hdata_get_var_array_size_string (API_STR2PTR(hdata), + API_STR2PTR(pointer), + name); + + API_RETURN_STRING(result); +} + +/* * weechat::hdata_get_var_hdata: get hdata for variable in hdata */ @@ -5696,6 +5747,8 @@ weechat_perl_api_init (pTHX) API_DEF_FUNC(hdata_get); API_DEF_FUNC(hdata_get_var_offset); API_DEF_FUNC(hdata_get_var_type_string); + API_DEF_FUNC(hdata_get_var_array_size); + API_DEF_FUNC(hdata_get_var_array_size_string); API_DEF_FUNC(hdata_get_var_hdata); API_DEF_FUNC(hdata_get_list); API_DEF_FUNC(hdata_check_pointer); diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c index a382ef062..15584d518 100644 --- a/src/plugins/scripts/python/weechat-python-api.c +++ b/src/plugins/scripts/python/weechat-python-api.c @@ -5265,6 +5265,57 @@ weechat_python_api_hdata_get_var_type_string (PyObject *self, PyObject *args) } /* + * weechat_python_api_hdata_get_var_array_size: get array size for variable in + * hdata + */ + +static PyObject * +weechat_python_api_hdata_get_var_array_size (PyObject *self, PyObject *args) +{ + char *hdata, *pointer, *name; + int value; + + API_FUNC(1, "hdata_get_var_array_size", API_RETURN_INT(-1)); + hdata = NULL; + pointer = NULL; + name = NULL; + if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name)) + API_WRONG_ARGS(API_RETURN_INT(-1)); + + value = weechat_hdata_get_var_array_size (API_STR2PTR(hdata), + API_STR2PTR(pointer), + name); + + API_RETURN_INT(value); +} + +/* + * weechat_python_api_hdata_get_var_array_size_string: get array size for variable + * in hdata (as string) + */ + +static PyObject * +weechat_python_api_hdata_get_var_array_size_string (PyObject *self, + PyObject *args) +{ + char *hdata, *pointer, *name; + const char *result; + + API_FUNC(1, "hdata_get_var_array_size_string", API_RETURN_EMPTY); + hdata = NULL; + pointer = NULL; + name = NULL; + if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name)) + API_WRONG_ARGS(API_RETURN_EMPTY); + + result = weechat_hdata_get_var_array_size_string (API_STR2PTR(hdata), + API_STR2PTR(pointer), + name); + + API_RETURN_STRING(result); +} + +/* * weechat_python_api_hdata_get_var_hdata: get hdata for variable in hdata */ @@ -5872,6 +5923,8 @@ PyMethodDef weechat_python_funcs[] = API_DEF_FUNC(hdata_get), API_DEF_FUNC(hdata_get_var_offset), API_DEF_FUNC(hdata_get_var_type_string), + API_DEF_FUNC(hdata_get_var_array_size), + API_DEF_FUNC(hdata_get_var_array_size_string), API_DEF_FUNC(hdata_get_var_hdata), API_DEF_FUNC(hdata_get_list), API_DEF_FUNC(hdata_check_pointer), diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c index 3cef992ae..6d7f2eff0 100644 --- a/src/plugins/scripts/ruby/weechat-ruby-api.c +++ b/src/plugins/scripts/ruby/weechat-ruby-api.c @@ -6041,6 +6041,67 @@ weechat_ruby_api_hdata_get_var_type_string (VALUE class, VALUE hdata, } /* + * weechat_ruby_api_hdata_get_var_array_size: get array size for variable in hdata + */ + +static VALUE +weechat_ruby_api_hdata_get_var_array_size (VALUE class, VALUE hdata, VALUE pointer, + VALUE name) +{ + char *c_hdata, *c_pointer, *c_name; + int value; + + API_FUNC(1, "hdata_get_var_array_size", API_RETURN_INT(-1)); + if (NIL_P (hdata) || NIL_P (pointer) || NIL_P (name)) + API_WRONG_ARGS(API_RETURN_INT(-1)); + + 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 = weechat_hdata_get_var_array_size (API_STR2PTR(c_hdata), + API_STR2PTR(c_pointer), + c_name); + + API_RETURN_INT(value); +} + +/* + * weechat_ruby_api_hdata_get_var_array_size_string: get array size for variable + * in hdata (as string) + */ + +static VALUE +weechat_ruby_api_hdata_get_var_array_size_string (VALUE class, VALUE hdata, + VALUE pointer, VALUE name) +{ + char *c_hdata, *c_pointer, *c_name; + const char *result; + + API_FUNC(1, "hdata_get_var_array_size_string", API_RETURN_EMPTY); + if (NIL_P (hdata) || NIL_P (pointer) || NIL_P (name)) + API_WRONG_ARGS(API_RETURN_EMPTY); + + 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); + + result = weechat_hdata_get_var_array_size_string (API_STR2PTR(c_hdata), + API_STR2PTR(c_pointer), + c_name); + + API_RETURN_STRING(result); +} + +/* * weechat_ruby_api_hdata_get_var_hdata: get hdata for variable in hdata */ @@ -6782,6 +6843,8 @@ weechat_ruby_api_init (VALUE ruby_mWeechat) API_DEF_FUNC(hdata_get, 1); API_DEF_FUNC(hdata_get_var_offset, 2); API_DEF_FUNC(hdata_get_var_type_string, 2); + API_DEF_FUNC(hdata_get_var_array_size, 3); + API_DEF_FUNC(hdata_get_var_array_size_string, 3); API_DEF_FUNC(hdata_get_var_hdata, 2); API_DEF_FUNC(hdata_get_list, 2); API_DEF_FUNC(hdata_check_pointer, 3); diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c index 6762516b5..785a0261f 100644 --- a/src/plugins/scripts/tcl/weechat-tcl-api.c +++ b/src/plugins/scripts/tcl/weechat-tcl-api.c @@ -5784,6 +5784,65 @@ weechat_tcl_api_hdata_get_var_type_string (ClientData clientData, } /* + * weechat_tcl_api_hdata_get_var_array_size: get array_size for variable in + * hdata + */ + +static int +weechat_tcl_api_hdata_get_var_array_size (ClientData clientData, + Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) +{ + Tcl_Obj *objp; + char *hdata, *pointer, *name; + int result, i; + + API_FUNC(1, "hdata_get_var_array_size", API_RETURN_INT(-1)); + if (objc < 4) + API_WRONG_ARGS(API_RETURN_INT(-1)); + + hdata = Tcl_GetStringFromObj (objv[1], &i); + pointer = Tcl_GetStringFromObj (objv[2], &i); + name = Tcl_GetStringFromObj (objv[3], &i); + + result = weechat_hdata_get_var_array_size (API_STR2PTR(hdata), + API_STR2PTR(pointer), + name); + + API_RETURN_INT(result); +} + +/* + * weechat_tcl_api_hdata_get_var_array_size_string: get array size for variable + * in hdata (as string) + */ + +static int +weechat_tcl_api_hdata_get_var_array_size_string (ClientData clientData, + Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) +{ + Tcl_Obj *objp; + char *hdata, *pointer, *name; + const char *result; + int i; + + API_FUNC(1, "hdata_get_var_array_size_string", API_RETURN_EMPTY); + if (objc < 4) + API_WRONG_ARGS(API_RETURN_EMPTY); + + hdata = Tcl_GetStringFromObj (objv[1], &i); + pointer = Tcl_GetStringFromObj (objv[2], &i); + name = Tcl_GetStringFromObj (objv[3], &i); + + result = weechat_hdata_get_var_array_size_string (API_STR2PTR(hdata), + API_STR2PTR(pointer), + name); + + API_RETURN_STRING(result); +} + +/* * weechat_tcl_api_hdata_get_var_hdata: get hdata for variable in hdata */ @@ -6549,6 +6608,8 @@ void weechat_tcl_api_init (Tcl_Interp *interp) API_DEF_FUNC(hdata_get); API_DEF_FUNC(hdata_get_var_offset); API_DEF_FUNC(hdata_get_var_type_string); + API_DEF_FUNC(hdata_get_var_array_size); + API_DEF_FUNC(hdata_get_var_array_size_string); API_DEF_FUNC(hdata_get_var_hdata); API_DEF_FUNC(hdata_get_list); API_DEF_FUNC(hdata_check_pointer); |