1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-27 13:26:38 +02:00

Add new argument "value" to function config_new_option

This commit is contained in:
Sebastien Helleu
2008-10-18 19:31:40 +02:00
parent 8511f9a77e
commit 3b81a4746a
27 changed files with 354 additions and 374 deletions
+14 -11
View File
@@ -1369,7 +1369,7 @@ static int
weechat_lua_api_config_new_option (lua_State *L)
{
const char *config_file, *section, *name, *type, *description;
const char *string_values, *default_value;
const char *string_values, *default_value, *value;
const char *function_check_value, *function_change, *function_delete;
char *result;
int n, min, max;
@@ -1392,27 +1392,29 @@ weechat_lua_api_config_new_option (lua_State *L)
min = 0;
max = 0;
default_value = NULL;
value = NULL;
function_check_value = NULL;
function_change = NULL;
function_delete = NULL;
n = lua_gettop (lua_current_interpreter);
if (n < 12)
if (n < 13)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_new_option");
LUA_RETURN_EMPTY;
}
config_file = lua_tostring (lua_current_interpreter, -12);
section = lua_tostring (lua_current_interpreter, -11);
name = lua_tostring (lua_current_interpreter, -10);
type = lua_tostring (lua_current_interpreter, -9);
description = lua_tostring (lua_current_interpreter, -8);
string_values = lua_tostring (lua_current_interpreter, -7);
min = lua_tonumber (lua_current_interpreter, -6);
max = lua_tonumber (lua_current_interpreter, -5);
default_value = lua_tostring (lua_current_interpreter, -4);
config_file = lua_tostring (lua_current_interpreter, -13);
section = lua_tostring (lua_current_interpreter, -12);
name = lua_tostring (lua_current_interpreter, -11);
type = lua_tostring (lua_current_interpreter, -10);
description = lua_tostring (lua_current_interpreter, -9);
string_values = lua_tostring (lua_current_interpreter, -8);
min = lua_tonumber (lua_current_interpreter, -7);
max = lua_tonumber (lua_current_interpreter, -6);
default_value = lua_tostring (lua_current_interpreter, -5);
value = lua_tostring (lua_current_interpreter, -4);
function_check_value = lua_tostring (lua_current_interpreter, -3);
function_change = lua_tostring (lua_current_interpreter, -2);
function_delete = lua_tostring (lua_current_interpreter, -1);
@@ -1428,6 +1430,7 @@ weechat_lua_api_config_new_option (lua_State *L)
min,
max,
default_value,
value,
&weechat_lua_api_config_option_check_value_cb,
function_check_value,
&weechat_lua_api_config_option_change_cb,
+6 -4
View File
@@ -1163,7 +1163,7 @@ weechat_perl_api_config_option_delete_cb (void *data,
static XS (XS_weechat_api_config_new_option)
{
char *result, *config_file, *section, *name, *type;
char *description, *string_values, *default_value;
char *description, *string_values, *default_value, *value;
char *function_check_value, *function_change, *function_delete;
dXSARGS;
@@ -1176,7 +1176,7 @@ static XS (XS_weechat_api_config_new_option)
PERL_RETURN_EMPTY;
}
if (items < 12)
if (items < 13)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_new_option");
PERL_RETURN_EMPTY;
@@ -1189,8 +1189,9 @@ static XS (XS_weechat_api_config_new_option)
description = SvPV (ST (4), PL_na);
string_values = SvPV (ST (5), PL_na);
default_value = SvPV (ST (8), PL_na);
function_check_value = SvPV (ST (9), PL_na);
function_change = SvPV (ST (10), PL_na);
value = SvPV (ST (9), PL_na);
function_check_value = SvPV (ST (10), PL_na);
function_change = SvPV (ST (11), PL_na);
function_delete = SvPV (ST (12), PL_na);
result = script_ptr2str (script_api_config_new_option (weechat_perl_plugin,
perl_current_script,
@@ -1203,6 +1204,7 @@ static XS (XS_weechat_api_config_new_option)
SvIV (ST (6)), /* min */
SvIV (ST (7)), /* max */
default_value,
value,
&weechat_perl_api_config_option_check_value_cb,
function_check_value,
&weechat_perl_api_config_option_change_cb,
@@ -1222,7 +1222,7 @@ static PyObject *
weechat_python_api_config_new_option (PyObject *self, PyObject *args)
{
char *config_file, *section, *name, *type, *description, *string_values;
char *default_value, *result;
char *default_value, *value, *result;
char *function_check_value, *function_change, *function_delete;
int min, max;
PyObject *object;
@@ -1243,13 +1243,14 @@ weechat_python_api_config_new_option (PyObject *self, PyObject *args)
description = NULL;
string_values = NULL;
default_value = NULL;
value = NULL;
function_check_value = NULL;
function_change = NULL;
function_delete = NULL;
if (!PyArg_ParseTuple (args, "ssssssiissss", &config_file, &section, &name,
if (!PyArg_ParseTuple (args, "ssssssiisssss", &config_file, &section, &name,
&type, &description, &string_values, &min, &max,
&default_value, &function_check_value,
&default_value, &value, &function_check_value,
&function_change, &function_delete))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_new_option");
@@ -1267,6 +1268,7 @@ weechat_python_api_config_new_option (PyObject *self, PyObject *args)
min,
max,
default_value,
value,
&weechat_python_api_config_option_check_value_cb,
function_check_value,
&weechat_python_api_config_option_change_cb,
+10 -4
View File
@@ -1377,12 +1377,13 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file,
VALUE section, VALUE name, VALUE type,
VALUE description, VALUE string_values,
VALUE min, VALUE max, VALUE default_value,
VALUE value,
VALUE function_check_value,
VALUE function_change,
VALUE function_delete)
{
char *c_config_file, *c_section, *c_name, *c_type, *c_description;
char *c_string_values, *c_default_value, *result;
char *c_string_values, *c_default_value, *c_value, *result;
char *c_function_check_value, *c_function_change, *c_function_delete;
int c_min, c_max;
VALUE return_value;
@@ -1405,14 +1406,16 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file,
c_min = 0;
c_max = 0;
c_default_value = NULL;
c_value = NULL;
c_function_check_value = NULL;
c_function_change = NULL;
c_function_delete = NULL;
if (NIL_P (config_file) || NIL_P (section) || NIL_P (name) || NIL_P (type)
|| NIL_P (description) || NIL_P (string_values)
|| NIL_P (default_value) || NIL_P (function_check_value)
|| NIL_P (function_change) || NIL_P (function_delete))
|| NIL_P (default_value) || NIL_P (value)
|| NIL_P (function_check_value) || NIL_P (function_change)
|| NIL_P (function_delete))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_new_option");
RUBY_RETURN_EMPTY;
@@ -1427,6 +1430,7 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file,
Check_Type (min, T_FIXNUM);
Check_Type (max, T_FIXNUM);
Check_Type (default_value, T_STRING);
Check_Type (value, T_STRING);
Check_Type (function_check_value, T_STRING);
Check_Type (function_change, T_STRING);
Check_Type (function_delete, T_STRING);
@@ -1440,6 +1444,7 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file,
c_min = FIX2INT (min);
c_max = FIX2INT (max);
c_default_value = STR2CSTR (default_value);
c_value = STR2CSTR (value);
c_function_check_value = STR2CSTR (function_check_value);
c_function_change = STR2CSTR (function_change);
c_function_delete = STR2CSTR (function_delete);
@@ -1455,6 +1460,7 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file,
c_min,
c_max,
c_default_value,
c_value,
&weechat_ruby_api_config_option_check_value_cb,
c_function_check_value,
&weechat_ruby_api_config_option_change_cb,
@@ -5354,7 +5360,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
rb_define_module_function (ruby_mWeechat, "config_new", &weechat_ruby_api_config_new, 2);
rb_define_module_function (ruby_mWeechat, "config_new_section", &weechat_ruby_api_config_new_section, 8);
rb_define_module_function (ruby_mWeechat, "config_search_section", &weechat_ruby_api_config_search_section, 2);
rb_define_module_function (ruby_mWeechat, "config_new_option", &weechat_ruby_api_config_new_option, 12);
rb_define_module_function (ruby_mWeechat, "config_new_option", &weechat_ruby_api_config_new_option, 13);
rb_define_module_function (ruby_mWeechat, "config_search_option", &weechat_ruby_api_config_search_option, 3);
rb_define_module_function (ruby_mWeechat, "config_string_to_boolean", &weechat_ruby_api_config_string_to_boolean, 1);
rb_define_module_function (ruby_mWeechat, "config_option_reset", &weechat_ruby_api_config_option_reset, 2);
+4 -2
View File
@@ -290,7 +290,9 @@ script_api_config_new_option (struct t_weechat_plugin *weechat_plugin,
struct t_config_section *section,
const char *name, const char *type,
const char *description, const char *string_values,
int min, int max, const char *default_value,
int min, int max,
const char *default_value,
const char *value,
void (*callback_check_value)(void *data,
struct t_config_option *option,
const char *value),
@@ -359,7 +361,7 @@ script_api_config_new_option (struct t_weechat_plugin *weechat_plugin,
new_option = weechat_config_new_option (config_file, section, name, type,
description, string_values, min,
max, default_value,
max, default_value, value,
callback1, new_script_callback1,
callback2, new_script_callback2,
callback3, new_script_callback3);
+3 -1
View File
@@ -60,7 +60,9 @@ extern struct t_config_option *script_api_config_new_option (struct t_weechat_pl
const char *type,
const char *description,
const char *string_values,
int min, int max, const char *default_value,
int min, int max,
const char *default_value,
const char *value,
void (*callback_check_value)(void *data,
struct t_config_option *option,
const char *value),
+12 -9
View File
@@ -1375,7 +1375,8 @@ weechat_tcl_api_config_new_option (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj* objp;
char *result, *config_file, *section, *name, *type;
char *description, *string_values, *default_value, *function_check_value, *function_change, *function_delete;
char *description, *string_values, *default_value, *value;
char *function_check_value, *function_change, *function_delete;
int i,min,max;
/* make C compiler happy */
@@ -1387,19 +1388,19 @@ weechat_tcl_api_config_new_option (ClientData clientData, Tcl_Interp *interp,
TCL_RETURN_EMPTY;
}
if (objc < 13)
if (objc < 14)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_new_option");
TCL_RETURN_EMPTY;
}
if ((Tcl_GetIntFromObj (interp, objv[7], &min) != TCL_OK)
|| (Tcl_GetIntFromObj (interp, objv[8], &max) != TCL_OK))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_new_option");
TCL_RETURN_EMPTY;
}
config_file = Tcl_GetStringFromObj (objv[1], &i);
section = Tcl_GetStringFromObj (objv[2], &i);
name = Tcl_GetStringFromObj (objv[3], &i);
@@ -1407,9 +1408,10 @@ weechat_tcl_api_config_new_option (ClientData clientData, Tcl_Interp *interp,
description = Tcl_GetStringFromObj (objv[5], &i);
string_values = Tcl_GetStringFromObj (objv[6], &i);
default_value = Tcl_GetStringFromObj (objv[9], &i);
function_check_value = Tcl_GetStringFromObj (objv[10], &i);
function_change = Tcl_GetStringFromObj (objv[11], &i);
function_delete = Tcl_GetStringFromObj (objv[12], &i);
value = Tcl_GetStringFromObj (objv[10], &i);
function_check_value = Tcl_GetStringFromObj (objv[11], &i);
function_change = Tcl_GetStringFromObj (objv[12], &i);
function_delete = Tcl_GetStringFromObj (objv[13], &i);
result = script_ptr2str (script_api_config_new_option (weechat_tcl_plugin,
tcl_current_script,
@@ -1419,9 +1421,10 @@ weechat_tcl_api_config_new_option (ClientData clientData, Tcl_Interp *interp,
type,
description,
string_values,
min, /* min */
max, /* max */
min,
max,
default_value,
value,
&weechat_tcl_api_config_option_check_value_cb,
function_check_value,
&weechat_tcl_api_config_option_change_cb,