1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-06 18:45:42 +02:00

Add description of arguments for API functions hook_info and hook_infolist

This commit is contained in:
Sebastien Helleu
2010-02-12 17:15:30 +01:00
parent 8d25a75200
commit 922e67cabd
42 changed files with 1697 additions and 294 deletions
+20 -8
View File
@@ -4291,7 +4291,7 @@ weechat_lua_api_hook_info_cb (void *data, const char *info_name,
static int
weechat_lua_api_hook_info (lua_State *L)
{
const char *info_name, *description, *function, *data;
const char *info_name, *description, *args_description, *function, *data;
char *result;
int n;
@@ -4305,19 +4305,22 @@ weechat_lua_api_hook_info (lua_State *L)
}
info_name = NULL;
description = NULL;
args_description = NULL;
function = NULL;
data = NULL;
n = lua_gettop (lua_current_interpreter);
if (n < 4)
if (n < 5)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hook_info");
LUA_RETURN_EMPTY;
}
info_name = lua_tostring (lua_current_interpreter, -4);
description = lua_tostring (lua_current_interpreter, -3);
info_name = lua_tostring (lua_current_interpreter, -5);
description = lua_tostring (lua_current_interpreter, -4);
args_description = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
@@ -4325,6 +4328,7 @@ weechat_lua_api_hook_info (lua_State *L)
lua_current_script,
info_name,
description,
args_description,
&weechat_lua_api_hook_info_cb,
function,
data));
@@ -4375,7 +4379,8 @@ weechat_lua_api_hook_infolist_cb (void *data, const char *info_name,
static int
weechat_lua_api_hook_infolist (lua_State *L)
{
const char *infolist_name, *description, *function, *data;
const char *infolist_name, *description, *pointer_description;
const char *args_description, *function, *data;
char *result;
int n;
@@ -4389,19 +4394,24 @@ weechat_lua_api_hook_infolist (lua_State *L)
}
infolist_name = NULL;
description = NULL;
pointer_description = NULL;
args_description = NULL;
function = NULL;
data = NULL;
n = lua_gettop (lua_current_interpreter);
if (n < 4)
if (n < 6)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hook_infolist");
LUA_RETURN_EMPTY;
}
infolist_name = lua_tostring (lua_current_interpreter, -4);
description = lua_tostring (lua_current_interpreter, -3);
infolist_name = lua_tostring (lua_current_interpreter, -6);
description = lua_tostring (lua_current_interpreter, -5);
pointer_description = lua_tostring (lua_current_interpreter, -4);
args_description = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
@@ -4409,6 +4419,8 @@ weechat_lua_api_hook_infolist (lua_State *L)
lua_current_script,
infolist_name,
description,
pointer_description,
args_description,
&weechat_lua_api_hook_infolist_cb,
function,
data));
+15 -8
View File
@@ -3650,7 +3650,7 @@ weechat_perl_api_hook_info_cb (void *data, const char *info_name,
XS (XS_weechat_api_hook_info)
{
char *result, *info_name, *description, *function, *data;
char *result, *info_name, *description, *args_description, *function, *data;
dXSARGS;
/* make C compiler happy */
@@ -3662,7 +3662,7 @@ XS (XS_weechat_api_hook_info)
PERL_RETURN_EMPTY;
}
if (items < 4)
if (items < 5)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hook_info");
PERL_RETURN_EMPTY;
@@ -3670,13 +3670,15 @@ XS (XS_weechat_api_hook_info)
info_name = SvPV (ST (0), PL_na);
description = SvPV (ST (1), PL_na);
function = SvPV (ST (2), PL_na);
data = SvPV (ST (3), PL_na);
args_description = SvPV (ST (2), PL_na);
function = SvPV (ST (3), PL_na);
data = SvPV (ST (4), PL_na);
result = script_ptr2str (script_api_hook_info (weechat_perl_plugin,
perl_current_script,
info_name,
description,
args_description,
&weechat_perl_api_hook_info_cb,
function,
data));
@@ -3726,7 +3728,8 @@ weechat_perl_api_hook_infolist_cb (void *data, const char *infolist_name,
XS (XS_weechat_api_hook_infolist)
{
char *result, *infolist_name, *description, *function, *data;
char *result, *infolist_name, *description, *pointer_description;
char *args_description, *function, *data;
dXSARGS;
/* make C compiler happy */
@@ -3738,7 +3741,7 @@ XS (XS_weechat_api_hook_infolist)
PERL_RETURN_EMPTY;
}
if (items < 4)
if (items < 6)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hook_infolist");
PERL_RETURN_EMPTY;
@@ -3746,13 +3749,17 @@ XS (XS_weechat_api_hook_infolist)
infolist_name = SvPV (ST (0), PL_na);
description = SvPV (ST (1), PL_na);
function = SvPV (ST (2), PL_na);
data = SvPV (ST (3), PL_na);
pointer_description = SvPV (ST (2), PL_na);
args_description = SvPV (ST (3), PL_na);
function = SvPV (ST (4), PL_na);
data = SvPV (ST (5), PL_na);
result = script_ptr2str (script_api_hook_infolist (weechat_perl_plugin,
perl_current_script,
infolist_name,
description,
pointer_description,
args_description,
&weechat_perl_api_hook_infolist_cb,
function,
data));
@@ -3838,7 +3838,7 @@ weechat_python_api_hook_info_cb (void *data, const char *info_name,
static PyObject *
weechat_python_api_hook_info (PyObject *self, PyObject *args)
{
char *info_name, *description, *function, *data, *result;
char *info_name, *description, *args_description, *function, *data, *result;
PyObject *object;
/* make C compiler happy */
@@ -3852,11 +3852,12 @@ weechat_python_api_hook_info (PyObject *self, PyObject *args)
info_name = NULL;
description = NULL;
args_description = NULL;
function = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "ssss", &info_name, &description, &function,
&data))
if (!PyArg_ParseTuple (args, "sssss", &info_name, &description,
&args_description, &function, &data))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_info");
PYTHON_RETURN_EMPTY;
@@ -3866,6 +3867,7 @@ weechat_python_api_hook_info (PyObject *self, PyObject *args)
python_current_script,
info_name,
description,
args_description,
&weechat_python_api_hook_info_cb,
function,
data));
@@ -3916,7 +3918,8 @@ weechat_python_api_hook_infolist_cb (void *data, const char *infolist_name,
static PyObject *
weechat_python_api_hook_infolist (PyObject *self, PyObject *args)
{
char *infolist_name, *description, *function, *data, *result;
char *infolist_name, *description, *pointer_description, *args_description;
char *function, *data, *result;
PyObject *object;
/* make C compiler happy */
@@ -3930,11 +3933,14 @@ weechat_python_api_hook_infolist (PyObject *self, PyObject *args)
infolist_name = NULL;
description = NULL;
pointer_description = NULL;
args_description = NULL;
function = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "ssss", &infolist_name, &description,
&function, &data))
if (!PyArg_ParseTuple (args, "ssssss", &infolist_name, &description,
&pointer_description, &args_description, &function,
&data))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_infolist");
PYTHON_RETURN_EMPTY;
@@ -3944,6 +3950,8 @@ weechat_python_api_hook_infolist (PyObject *self, PyObject *args)
python_current_script,
infolist_name,
description,
pointer_description,
args_description,
&weechat_python_api_hook_infolist_cb,
function,
data));
File diff suppressed because it is too large Load Diff
+5 -1
View File
@@ -1169,6 +1169,7 @@ script_api_hook_info (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *info_name,
const char *description,
const char *args_description,
const char *(*callback)(void *data,
const char *info_name,
const char *arguments),
@@ -1182,7 +1183,7 @@ script_api_hook_info (struct t_weechat_plugin *weechat_plugin,
if (!new_script_callback)
return NULL;
new_hook = weechat_hook_info (info_name, description,
new_hook = weechat_hook_info (info_name, description, args_description,
callback, new_script_callback);
if (!new_hook)
{
@@ -1209,6 +1210,8 @@ script_api_hook_infolist (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *infolist_name,
const char *description,
const char *pointer_description,
const char *args_description,
struct t_infolist *(*callback)(void *data,
const char *infolist_name,
void *pointer,
@@ -1224,6 +1227,7 @@ script_api_hook_infolist (struct t_weechat_plugin *weechat_plugin,
return NULL;
new_hook = weechat_hook_infolist (infolist_name, description,
pointer_description, args_description,
callback, new_script_callback);
if (!new_hook)
{
+3
View File
@@ -236,6 +236,7 @@ extern struct t_hook *script_api_hook_info (struct t_weechat_plugin *weechat_plu
struct t_plugin_script *script,
const char *info_name,
const char *description,
const char *args_description,
const char *(*callback)(void *data,
const char *info_name,
const char *arguments),
@@ -245,6 +246,8 @@ extern struct t_hook *script_api_hook_infolist (struct t_weechat_plugin *weechat
struct t_plugin_script *script,
const char *infolist_name,
const char *description,
const char *pointer_description,
const char *args_description,
struct t_infolist *(*callback)(void *data,
const char *infolist_name,
void *pointer,
+2
View File
@@ -278,6 +278,8 @@ script_init (struct t_weechat_plugin *weechat_plugin,
weechat_hook_completion (string, N_("list of scripts"),
callback_completion, NULL);
weechat_hook_infolist (string, N_("list of scripts"),
N_("script pointer (optional)"),
N_("script name (can start or end with \"*\" as joker) (optional)"),
callback_infolist, NULL);
free (string);
}
+15 -8
View File
@@ -4110,7 +4110,7 @@ weechat_tcl_api_hook_info (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
char *result, *info_name, *description, *function, *data;
char *result, *info_name, *description, *args_description, *function, *data;
int i;
/* make C compiler happy */
@@ -4122,7 +4122,7 @@ weechat_tcl_api_hook_info (ClientData clientData, Tcl_Interp *interp,
TCL_RETURN_EMPTY;
}
if (objc < 5)
if (objc < 6)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_info");
TCL_RETURN_EMPTY;
@@ -4130,13 +4130,15 @@ weechat_tcl_api_hook_info (ClientData clientData, Tcl_Interp *interp,
info_name = Tcl_GetStringFromObj (objv[1], &i);
description = Tcl_GetStringFromObj (objv[2], &i);
function = Tcl_GetStringFromObj (objv[3], &i);
data = Tcl_GetStringFromObj (objv[4], &i);
args_description = Tcl_GetStringFromObj (objv[3], &i);
function = Tcl_GetStringFromObj (objv[4], &i);
data = Tcl_GetStringFromObj (objv[5], &i);
result = script_ptr2str (script_api_hook_info (weechat_tcl_plugin,
tcl_current_script,
info_name,
description,
args_description,
&weechat_tcl_api_hook_info_cb,
function,
data));
@@ -4189,7 +4191,8 @@ weechat_tcl_api_hook_infolist (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
char *result, *infolist_name, *description, *function, *data;
char *result, *infolist_name, *description, *pointer_description;
char *args_description, *function, *data;
int i;
/* make C compiler happy */
@@ -4201,7 +4204,7 @@ weechat_tcl_api_hook_infolist (ClientData clientData, Tcl_Interp *interp,
TCL_RETURN_EMPTY;
}
if (objc < 5)
if (objc < 7)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_infolist");
TCL_RETURN_EMPTY;
@@ -4209,13 +4212,17 @@ weechat_tcl_api_hook_infolist (ClientData clientData, Tcl_Interp *interp,
infolist_name = Tcl_GetStringFromObj (objv[1], &i);
description = Tcl_GetStringFromObj (objv[2], &i);
function = Tcl_GetStringFromObj (objv[3], &i);
data = Tcl_GetStringFromObj (objv[4], &i);
pointer_description = Tcl_GetStringFromObj (objv[3], &i);
args_description = Tcl_GetStringFromObj (objv[4], &i);
function = Tcl_GetStringFromObj (objv[5], &i);
data = Tcl_GetStringFromObj (objv[6], &i);
result = script_ptr2str (script_api_hook_infolist (weechat_tcl_plugin,
tcl_current_script,
infolist_name,
description,
pointer_description,
args_description,
&weechat_tcl_api_hook_infolist_cb,
function,
data));