mirror of
https://github.com/weechat/weechat.git
synced 2026-07-04 16:53:14 +02:00
api: add function hdata_compare
This commit is contained in:
@@ -4631,6 +4631,27 @@ weechat_guile_api_hdata_hashtable (SCM hdata, SCM pointer, SCM name)
|
||||
API_RETURN_OTHER(result_alist);
|
||||
}
|
||||
|
||||
SCM
|
||||
weechat_guile_api_hdata_compare (SCM hdata, SCM pointer1, SCM pointer2,
|
||||
SCM name, SCM case_sensitive)
|
||||
{
|
||||
int rc;
|
||||
|
||||
API_INIT_FUNC(1, "hdata_compare", API_RETURN_INT(0));
|
||||
if (!scm_is_string (hdata) || !scm_is_string (pointer1)
|
||||
|| !scm_is_string (pointer2) || !scm_is_string (name)
|
||||
|| !scm_is_integer (case_sensitive))
|
||||
API_WRONG_ARGS(API_RETURN_INT(0));
|
||||
|
||||
rc = weechat_hdata_compare (API_STR2PTR(API_SCM_TO_STRING(hdata)),
|
||||
API_STR2PTR(API_SCM_TO_STRING(pointer1)),
|
||||
API_STR2PTR(API_SCM_TO_STRING(pointer2)),
|
||||
API_SCM_TO_STRING(name),
|
||||
scm_to_int (case_sensitive));
|
||||
|
||||
API_RETURN_INT(rc);
|
||||
}
|
||||
|
||||
SCM
|
||||
weechat_guile_api_hdata_update (SCM hdata, SCM pointer, SCM hashtable)
|
||||
{
|
||||
@@ -4991,6 +5012,7 @@ weechat_guile_api_module_init (void *data)
|
||||
API_DEF_FUNC(hdata_pointer, 3);
|
||||
API_DEF_FUNC(hdata_time, 3);
|
||||
API_DEF_FUNC(hdata_hashtable, 3);
|
||||
API_DEF_FUNC(hdata_compare, 5);
|
||||
API_DEF_FUNC(hdata_update, 3);
|
||||
API_DEF_FUNC(hdata_get_string, 2);
|
||||
API_DEF_FUNC(upgrade_new, 3);
|
||||
|
||||
@@ -4572,6 +4572,28 @@ API_FUNC(hdata_hashtable)
|
||||
return result_obj;
|
||||
}
|
||||
|
||||
API_FUNC(hdata_compare)
|
||||
{
|
||||
int case_sensitive, rc;
|
||||
|
||||
API_INIT_FUNC(1, "hdata_compare", "ssssi", API_RETURN_INT(0));
|
||||
|
||||
v8::String::Utf8Value hdata(args[0]);
|
||||
v8::String::Utf8Value pointer1(args[1]);
|
||||
v8::String::Utf8Value pointer2(args[2]);
|
||||
v8::String::Utf8Value name(args[3]);
|
||||
case_sensitive = args[4]->IntegerValue();
|
||||
|
||||
rc = weechat_hdata_compare (
|
||||
(struct t_hdata *)API_STR2PTR(*hdata),
|
||||
API_STR2PTR(*pointer1),
|
||||
API_STR2PTR(*pointer2),
|
||||
*name,
|
||||
case_sensitive);
|
||||
|
||||
API_RETURN_INT(rc);
|
||||
}
|
||||
|
||||
API_FUNC(hdata_update)
|
||||
{
|
||||
struct t_hashtable *hashtable;
|
||||
@@ -4966,6 +4988,7 @@ WeechatJsV8::loadLibs()
|
||||
API_DEF_FUNC(hdata_pointer);
|
||||
API_DEF_FUNC(hdata_time);
|
||||
API_DEF_FUNC(hdata_hashtable);
|
||||
API_DEF_FUNC(hdata_compare);
|
||||
API_DEF_FUNC(hdata_update);
|
||||
API_DEF_FUNC(hdata_get_string);
|
||||
API_DEF_FUNC(upgrade_new);
|
||||
|
||||
@@ -4933,6 +4933,30 @@ API_FUNC(hdata_hashtable)
|
||||
return 1;
|
||||
}
|
||||
|
||||
API_FUNC(hdata_compare)
|
||||
{
|
||||
const char *hdata, *pointer1, *pointer2, *name;
|
||||
int case_sensitive, rc;
|
||||
|
||||
API_INIT_FUNC(1, "hdata_compare", API_RETURN_INT(0));
|
||||
if (lua_gettop (L) < 5)
|
||||
API_WRONG_ARGS(API_RETURN_INT(0));
|
||||
|
||||
hdata = lua_tostring (L, -5);
|
||||
pointer1 = lua_tostring (L, -4);
|
||||
pointer2 = lua_tostring (L, -3);
|
||||
name = lua_tostring (L, -2);
|
||||
case_sensitive = lua_tonumber (L, -1);
|
||||
|
||||
rc = weechat_hdata_compare (API_STR2PTR(hdata),
|
||||
API_STR2PTR(pointer1),
|
||||
API_STR2PTR(pointer2),
|
||||
name,
|
||||
case_sensitive);
|
||||
|
||||
API_RETURN_INT(rc);
|
||||
}
|
||||
|
||||
API_FUNC(hdata_update)
|
||||
{
|
||||
const char *hdata, *pointer;
|
||||
@@ -5289,6 +5313,7 @@ const struct luaL_Reg weechat_lua_api_funcs[] = {
|
||||
API_DEF_FUNC(hdata_pointer),
|
||||
API_DEF_FUNC(hdata_time),
|
||||
API_DEF_FUNC(hdata_hashtable),
|
||||
API_DEF_FUNC(hdata_compare),
|
||||
API_DEF_FUNC(hdata_update),
|
||||
API_DEF_FUNC(hdata_get_string),
|
||||
API_DEF_FUNC(upgrade_new),
|
||||
|
||||
@@ -4861,6 +4861,31 @@ API_FUNC(hdata_hashtable)
|
||||
API_RETURN_OBJ(result_hash);
|
||||
}
|
||||
|
||||
API_FUNC(hdata_compare)
|
||||
{
|
||||
char *hdata, *pointer1, *pointer2, *name;
|
||||
int case_sensitive, rc;
|
||||
dXSARGS;
|
||||
|
||||
API_INIT_FUNC(1, "hdata_compare", API_RETURN_INT(0));
|
||||
if (items < 5)
|
||||
API_WRONG_ARGS(API_RETURN_INT(0));
|
||||
|
||||
hdata = SvPV_nolen (ST (0));
|
||||
pointer1 = SvPV_nolen (ST (1));
|
||||
pointer2 = SvPV_nolen (ST (2));
|
||||
name = SvPV_nolen (ST (3));
|
||||
case_sensitive = SvIV(ST (4));
|
||||
|
||||
rc = weechat_hdata_compare (API_STR2PTR(hdata),
|
||||
API_STR2PTR(pointer1),
|
||||
API_STR2PTR(pointer2),
|
||||
name,
|
||||
case_sensitive);
|
||||
|
||||
API_RETURN_INT(rc);
|
||||
}
|
||||
|
||||
API_FUNC(hdata_update)
|
||||
{
|
||||
char *hdata, *pointer;
|
||||
@@ -5229,6 +5254,7 @@ weechat_perl_api_init (pTHX)
|
||||
API_DEF_FUNC(hdata_pointer);
|
||||
API_DEF_FUNC(hdata_time);
|
||||
API_DEF_FUNC(hdata_hashtable);
|
||||
API_DEF_FUNC(hdata_compare);
|
||||
API_DEF_FUNC(hdata_update);
|
||||
API_DEF_FUNC(hdata_get_string);
|
||||
API_DEF_FUNC(upgrade_new);
|
||||
|
||||
@@ -891,6 +891,7 @@ plugin_load (const char *filename, int init_plugin, int argc, char **argv)
|
||||
new_plugin->hdata_pointer = &hdata_pointer;
|
||||
new_plugin->hdata_time = &hdata_time;
|
||||
new_plugin->hdata_hashtable = &hdata_hashtable;
|
||||
new_plugin->hdata_compare = &hdata_compare;
|
||||
new_plugin->hdata_set = &hdata_set;
|
||||
new_plugin->hdata_update = &hdata_update;
|
||||
new_plugin->hdata_get_string = &hdata_get_string;
|
||||
|
||||
@@ -4851,6 +4851,30 @@ API_FUNC(hdata_hashtable)
|
||||
return result_dict;
|
||||
}
|
||||
|
||||
API_FUNC(hdata_compare)
|
||||
{
|
||||
char *hdata, *pointer1, *pointer2, *name;
|
||||
int case_sensitive, rc;
|
||||
|
||||
API_INIT_FUNC(1, "hdata_compare", API_RETURN_INT(0));
|
||||
hdata = NULL;
|
||||
pointer1 = NULL;
|
||||
pointer2 = NULL;
|
||||
name = NULL;
|
||||
case_sensitive = 0;
|
||||
if (!PyArg_ParseTuple (args, "ssssi", &hdata, &pointer1, &pointer2, &name,
|
||||
&case_sensitive))
|
||||
API_WRONG_ARGS(API_RETURN_INT(0));
|
||||
|
||||
rc = weechat_hdata_compare (API_STR2PTR(hdata),
|
||||
API_STR2PTR(pointer1),
|
||||
API_STR2PTR(pointer2),
|
||||
name,
|
||||
case_sensitive);
|
||||
|
||||
API_RETURN_INT(rc);
|
||||
}
|
||||
|
||||
API_FUNC(hdata_update)
|
||||
{
|
||||
char *hdata, *pointer;
|
||||
@@ -5205,6 +5229,7 @@ PyMethodDef weechat_python_funcs[] =
|
||||
API_DEF_FUNC(hdata_pointer),
|
||||
API_DEF_FUNC(hdata_time),
|
||||
API_DEF_FUNC(hdata_hashtable),
|
||||
API_DEF_FUNC(hdata_compare),
|
||||
API_DEF_FUNC(hdata_update),
|
||||
API_DEF_FUNC(hdata_get_string),
|
||||
API_DEF_FUNC(upgrade_new),
|
||||
|
||||
@@ -5916,6 +5916,40 @@ weechat_ruby_api_hdata_hashtable (VALUE class, VALUE hdata, VALUE pointer,
|
||||
return result_hash;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_api_hdata_compare (VALUE class, VALUE hdata,
|
||||
VALUE pointer1, VALUE pointer2, VALUE name,
|
||||
VALUE case_sensitive)
|
||||
{
|
||||
char *c_hdata, *c_pointer1, *c_pointer2, *c_name;
|
||||
int c_case_sensitive, rc;
|
||||
|
||||
API_INIT_FUNC(1, "hdata_compare", API_RETURN_INT(0));
|
||||
if (NIL_P (hdata) || NIL_P (pointer1) || NIL_P (pointer2) || NIL_P (name)
|
||||
|| NIL_P (case_sensitive))
|
||||
API_WRONG_ARGS(API_RETURN_INT(0));
|
||||
|
||||
Check_Type (hdata, T_STRING);
|
||||
Check_Type (pointer1, T_STRING);
|
||||
Check_Type (pointer2, T_STRING);
|
||||
Check_Type (name, T_STRING);
|
||||
Check_Type (case_sensitive, T_FIXNUM);
|
||||
|
||||
c_hdata = StringValuePtr (hdata);
|
||||
c_pointer1 = StringValuePtr (pointer1);
|
||||
c_pointer2 = StringValuePtr (pointer2);
|
||||
c_name = StringValuePtr (name);
|
||||
c_case_sensitive = FIX2INT (case_sensitive);
|
||||
|
||||
rc = weechat_hdata_compare (API_STR2PTR(c_hdata),
|
||||
API_STR2PTR(c_pointer1),
|
||||
API_STR2PTR(c_pointer2),
|
||||
c_name,
|
||||
c_case_sensitive);
|
||||
|
||||
API_RETURN_INT(rc);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_api_hdata_update (VALUE class, VALUE hdata, VALUE pointer,
|
||||
VALUE hashtable)
|
||||
@@ -6351,6 +6385,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
|
||||
API_DEF_FUNC(hdata_pointer, 3);
|
||||
API_DEF_FUNC(hdata_time, 3);
|
||||
API_DEF_FUNC(hdata_hashtable, 3);
|
||||
API_DEF_FUNC(hdata_compare, 5);
|
||||
API_DEF_FUNC(hdata_update, 3);
|
||||
API_DEF_FUNC(hdata_get_string, 2);
|
||||
API_DEF_FUNC(upgrade_new, 3);
|
||||
|
||||
@@ -5221,6 +5221,33 @@ API_FUNC(hdata_hashtable)
|
||||
API_RETURN_OBJ(result_dict);
|
||||
}
|
||||
|
||||
API_FUNC(hdata_compare)
|
||||
{
|
||||
Tcl_Obj *objp;
|
||||
char *hdata, *pointer1, *pointer2, *name;
|
||||
int case_sensitive, rc, i;
|
||||
|
||||
API_INIT_FUNC(1, "hdata_compare", API_RETURN_INT(0));
|
||||
if (objc < 6)
|
||||
API_WRONG_ARGS(API_RETURN_INT(0));
|
||||
|
||||
hdata = Tcl_GetStringFromObj (objv[1], &i);
|
||||
pointer1 = Tcl_GetStringFromObj (objv[2], &i);
|
||||
pointer2 = Tcl_GetStringFromObj (objv[3], &i);
|
||||
name = Tcl_GetStringFromObj (objv[4], &i);
|
||||
|
||||
if (Tcl_GetIntFromObj (interp, objv[5], &case_sensitive) != TCL_OK)
|
||||
API_WRONG_ARGS(API_RETURN_INT(0));
|
||||
|
||||
rc = weechat_hdata_compare (API_STR2PTR(hdata),
|
||||
API_STR2PTR(pointer1),
|
||||
API_STR2PTR(pointer2),
|
||||
name,
|
||||
case_sensitive);
|
||||
|
||||
API_RETURN_INT(rc);
|
||||
}
|
||||
|
||||
API_FUNC(hdata_update)
|
||||
{
|
||||
Tcl_Obj *objp;
|
||||
@@ -5692,6 +5719,7 @@ void weechat_tcl_api_init (Tcl_Interp *interp)
|
||||
API_DEF_FUNC(hdata_pointer);
|
||||
API_DEF_FUNC(hdata_time);
|
||||
API_DEF_FUNC(hdata_hashtable);
|
||||
API_DEF_FUNC(hdata_compare);
|
||||
API_DEF_FUNC(hdata_update);
|
||||
API_DEF_FUNC(hdata_get_string);
|
||||
API_DEF_FUNC(upgrade_new);
|
||||
|
||||
@@ -59,7 +59,7 @@ struct timeval;
|
||||
* please change the date with current one; for a second change at same
|
||||
* date, increment the 01, otherwise please keep 01.
|
||||
*/
|
||||
#define WEECHAT_PLUGIN_API_VERSION "20170530-01"
|
||||
#define WEECHAT_PLUGIN_API_VERSION "20170530-02"
|
||||
|
||||
/* macros for defining plugin infos */
|
||||
#define WEECHAT_PLUGIN_NAME(__name) \
|
||||
@@ -1065,6 +1065,9 @@ struct t_weechat_plugin
|
||||
const char *name);
|
||||
struct t_hashtable *(*hdata_hashtable) (struct t_hdata *hdata,
|
||||
void *pointer, const char *name);
|
||||
int (*hdata_compare) (struct t_hdata *hdata,
|
||||
void *pointer1, void *pointer2, const char *name,
|
||||
int case_sensitive);
|
||||
int (*hdata_set) (struct t_hdata *hdata, void *pointer, const char *name,
|
||||
const char *value);
|
||||
int (*hdata_update) (struct t_hdata *hdata, void *pointer,
|
||||
@@ -1988,6 +1991,10 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
|
||||
(weechat_plugin->hdata_time)(__hdata, __pointer, __name)
|
||||
#define weechat_hdata_hashtable(__hdata, __pointer, __name) \
|
||||
(weechat_plugin->hdata_hashtable)(__hdata, __pointer, __name)
|
||||
#define weechat_hdata_compare(__hdata, __pointer1, __pointer2, __name, \
|
||||
__case_sensitive) \
|
||||
(weechat_plugin->hdata_compare)(__hdata, __pointer1, __pointer2, \
|
||||
__name, __case_sensitive)
|
||||
#define weechat_hdata_set(__hdata, __pointer, __name, __value) \
|
||||
(weechat_plugin->hdata_set)(__hdata, __pointer, __name, __value)
|
||||
#define weechat_hdata_update(__hdata, __pointer, __hashtable) \
|
||||
|
||||
Reference in New Issue
Block a user