diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2011-12-17 17:03:39 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2011-12-17 17:03:39 +0100 |
commit | bd3f554e0228e5aec087b07a269596b487f3a60f (patch) | |
tree | 4861f8e07c16073791a44033450e729b62b64679 /src/plugins/scripts/tcl/weechat-tcl-api.c | |
parent | dc8807a4173ccabbe3bb03d3f1d02c8b11580056 (diff) | |
download | weechat-bd3f554e0228e5aec087b07a269596b487f3a60f.zip |
api: add new function hdata_check_pointer
Diffstat (limited to 'src/plugins/scripts/tcl/weechat-tcl-api.c')
-rw-r--r-- | src/plugins/scripts/tcl/weechat-tcl-api.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c index c8f797185..81b9cb5ce 100644 --- a/src/plugins/scripts/tcl/weechat-tcl-api.c +++ b/src/plugins/scripts/tcl/weechat-tcl-api.c @@ -5773,6 +5773,33 @@ weechat_tcl_api_hdata_get_list (ClientData clientData, Tcl_Interp *interp, } /* + * 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", |