summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/scripts/lua/weechat-lua-api.c4348
-rw-r--r--src/plugins/scripts/lua/weechat-lua.c14
-rw-r--r--src/plugins/scripts/perl/weechat-perl-api.c3416
-rw-r--r--src/plugins/scripts/perl/weechat-perl.c8
-rw-r--r--src/plugins/scripts/python/weechat-python-api.c3759
-rw-r--r--src/plugins/scripts/python/weechat-python.c12
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby-api.c3485
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby.c10
-rw-r--r--src/plugins/scripts/tcl/weechat-tcl-api.c3656
-rw-r--r--src/plugins/scripts/tcl/weechat-tcl.c14
10 files changed, 4335 insertions, 14387 deletions
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c
index 88777479b..ffa50e769 100644
--- a/src/plugins/scripts/lua/weechat-lua-api.c
+++ b/src/plugins/scripts/lua/weechat-lua-api.c
@@ -38,25 +38,41 @@
#include "weechat-lua.h"
-#define LUA_RETURN_OK return 1
-#define LUA_RETURN_ERROR return 0
-#define LUA_RETURN_EMPTY \
+#define API_FUNC(__init, __name, __ret) \
+ char *lua_function_name = __name; \
+ (void) L; \
+ if (__init \
+ && (!lua_current_script || !lua_current_script->name)) \
+ { \
+ WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, \
+ lua_function_name); \
+ __ret; \
+ }
+#define API_WRONG_ARGS(__ret) \
+ { \
+ WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, \
+ lua_function_name); \
+ __ret; \
+ }
+#define API_RETURN_OK return 1
+#define API_RETURN_ERROR return 0
+#define API_RETURN_EMPTY \
lua_pushstring (lua_current_interpreter, ""); \
return 0
-#define LUA_RETURN_STRING(__string) \
+#define API_RETURN_STRING(__string) \
lua_pushstring (lua_current_interpreter, \
(__string) ? __string : ""); \
return 1;
-#define LUA_RETURN_STRING_FREE(__string) \
+#define API_RETURN_STRING_FREE(__string) \
lua_pushstring (lua_current_interpreter, \
(__string) ? __string : ""); \
if (__string) \
free (__string); \
return 1;
-#define LUA_RETURN_INT(__int) \
+#define API_RETURN_INT(__int) \
lua_pushnumber (lua_current_interpreter, __int); \
return 1;
-#define LUA_RETURN_LONG(__long) \
+#define API_RETURN_LONG(__long) \
lua_pushnumber (lua_current_interpreter, __long); \
return 1;
@@ -70,21 +86,12 @@ weechat_lua_api_register (lua_State *L)
{
const char *name, *author, *version, *license, *description;
const char *shutdown_func, *charset;
- int n;
-
- /* make C compiler happy */
- (void) L;
+ API_FUNC(0, "register", API_RETURN_ERROR);
lua_current_script = NULL;
lua_registered_script = NULL;
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 7)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(lua_current_script_filename, "register");
- LUA_RETURN_ERROR;
- }
+ if (lua_gettop (lua_current_interpreter) < 7)
+ API_WRONG_ARGS(API_RETURN_ERROR);
name = lua_tostring (lua_current_interpreter, -7);
author = lua_tostring (lua_current_interpreter, -6);
@@ -101,7 +108,7 @@ weechat_lua_api_register (lua_State *L)
"\"%s\" (another script already "
"exists with this name)"),
weechat_prefix ("error"), LUA_PLUGIN_NAME, name);
- LUA_RETURN_ERROR;
+ API_RETURN_ERROR;
}
/* register script */
@@ -129,10 +136,10 @@ weechat_lua_api_register (lua_State *L)
}
else
{
- LUA_RETURN_ERROR;
+ API_RETURN_ERROR;
}
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -144,30 +151,16 @@ static int
weechat_lua_api_plugin_get_name (lua_State *L)
{
const char *plugin, *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "plugin_get_name");
- LUA_RETURN_EMPTY;
- }
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "plugin_get_name");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "plugin_get_name", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
plugin = lua_tostring (lua_current_interpreter, -1);
result = weechat_plugin_get_name (script_str2ptr (plugin));
- LUA_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -178,31 +171,17 @@ static int
weechat_lua_api_charset_set (lua_State *L)
{
const char *charset;
- int n;
-
- /* make C compiler happy */
- (void) L;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "charset_set");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "charset_set");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "charset_set", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_ERROR);
charset = lua_tostring (lua_current_interpreter, -1);
script_api_charset_set (lua_current_script,
charset);
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -214,31 +193,17 @@ weechat_lua_api_iconv_to_internal (lua_State *L)
{
const char *charset, *string;
char *result;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "iconv_to_internal");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "iconv_to_internal");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "iconv_to_internal", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
charset = lua_tostring (lua_current_interpreter, -2);
string = lua_tostring (lua_current_interpreter, -1);
result = weechat_iconv_to_internal (charset, string);
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -251,31 +216,17 @@ weechat_lua_api_iconv_from_internal (lua_State *L)
{
const char *charset, *string;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "iconv_from_internal");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "iconv_from_internal");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "iconv_from_internal", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
charset = lua_tostring (lua_current_interpreter, -2);
string = lua_tostring (lua_current_interpreter, -1);
result = weechat_iconv_from_internal (charset, string);
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -286,30 +237,16 @@ static int
weechat_lua_api_gettext (lua_State *L)
{
const char *string, *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "gettext");
- LUA_RETURN_EMPTY;
- }
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "gettext");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "gettext", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
string = lua_tostring (lua_current_interpreter, -1);
result = weechat_gettext (string);
- LUA_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -320,24 +257,11 @@ static int
weechat_lua_api_ngettext (lua_State *L)
{
const char *single, *plural, *result;
- int n, count;
+ int count;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "ngettext");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "ngettext");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "ngettext", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
single = lua_tostring (lua_current_interpreter, -3);
plural = lua_tostring (lua_current_interpreter, -2);
@@ -345,7 +269,7 @@ weechat_lua_api_ngettext (lua_State *L)
result = weechat_ngettext (single, plural, count);
- LUA_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -358,24 +282,11 @@ static int
weechat_lua_api_string_match (lua_State *L)
{
const char *string, *mask;
- int n, case_sensitive, value;
+ int case_sensitive, value;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "string_match");
- LUA_RETURN_INT(0);
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "string_match");
- LUA_RETURN_INT(0);
- }
+ API_FUNC(1, "string_match", API_RETURN_INT(0));
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_INT(0));
string = lua_tostring (lua_current_interpreter, -3);
mask = lua_tostring (lua_current_interpreter, -2);
@@ -383,7 +294,7 @@ weechat_lua_api_string_match (lua_State *L)
value = weechat_string_match (string, mask, case_sensitive);
- LUA_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -398,31 +309,18 @@ static int
weechat_lua_api_string_has_highlight (lua_State *L)
{
const char *string, *highlight_words;
- int n, value;
+ int value;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "string_has_highlight");
- LUA_RETURN_INT(0);
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "string_has_highlight");
- LUA_RETURN_INT(0);
- }
+ API_FUNC(1, "string_has_highlight", API_RETURN_INT(0));
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_INT(0));
string = lua_tostring (lua_current_interpreter, -2);
highlight_words = lua_tostring (lua_current_interpreter, -1);
value = weechat_string_has_highlight (string, highlight_words);
- LUA_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -437,31 +335,18 @@ static int
weechat_lua_api_string_has_highlight_regex (lua_State *L)
{
const char *string, *regex;
- int n, value;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "string_has_highlight_regex");
- LUA_RETURN_INT(0);
- }
-
- n = lua_gettop (lua_current_interpreter);
+ int value;
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "string_has_highlight_regex");
- LUA_RETURN_INT(0);
- }
+ API_FUNC(1, "string_has_highlight_regex", API_RETURN_INT(0));
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_INT(0));
string = lua_tostring (lua_current_interpreter, -2);
regex = lua_tostring (lua_current_interpreter, -1);
value = weechat_string_has_highlight_regex (string, regex);
- LUA_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -476,30 +361,16 @@ weechat_lua_api_string_mask_to_regex (lua_State *L)
{
const char *mask;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "string_mask_to_regex");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "string_mask_to_regex");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "string_mask_to_regex", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
mask = lua_tostring (lua_current_interpreter, -1);
result = weechat_string_mask_to_regex (mask);
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -511,31 +382,17 @@ weechat_lua_api_string_remove_color (lua_State *L)
{
const char *string, *replacement;
char *result;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "string_remove_color");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "string_remove_color");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "string_remove_color", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
string = lua_tostring (lua_current_interpreter, -2);
replacement = lua_tostring (lua_current_interpreter, -1);
result = weechat_string_remove_color (string, replacement);
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -547,30 +404,17 @@ static int
weechat_lua_api_string_is_command_char (lua_State *L)
{
const char *string;
- int n, value;
-
- /* make C compiler happy */
- (void) L;
+ int value;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "string_is_command_char");
- LUA_RETURN_INT(0);
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "string_is_command_char");
- LUA_RETURN_INT(0);
- }
+ API_FUNC(1, "string_is_command_char", API_RETURN_INT(0));
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_INT(0));
string = lua_tostring (lua_current_interpreter, -1);
value = weechat_string_is_command_char (string);
- LUA_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -583,30 +427,16 @@ static int
weechat_lua_api_string_input_for_buffer (lua_State *L)
{
const char *string, *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "string_input_for_buffer");
- LUA_RETURN_EMPTY;
- }
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "string_input_for_buffer");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "string_input_for_buffer", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
string = lua_tostring (lua_current_interpreter, -1);
result = weechat_string_input_for_buffer (string);
- LUA_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -617,32 +447,19 @@ static int
weechat_lua_api_mkdir_home (lua_State *L)
{
const char *directory;
- int mode, n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "mkdir_home");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
+ int mode;
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "mkdir_home");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "mkdir_home", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_ERROR);
directory = lua_tostring (lua_current_interpreter, -2);
mode = lua_tonumber (lua_current_interpreter, -1);
if (weechat_mkdir_home (directory, mode))
- LUA_RETURN_OK;
+ API_RETURN_OK;
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -653,32 +470,19 @@ static int
weechat_lua_api_mkdir (lua_State *L)
{
const char *directory;
- int mode, n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "mkdir");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
+ int mode;
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "mkdir");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "mkdir", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_ERROR);
directory = lua_tostring (lua_current_interpreter, -2);
mode = lua_tonumber (lua_current_interpreter, -1);
if (weechat_mkdir (directory, mode))
- LUA_RETURN_OK;
+ API_RETURN_OK;
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -690,32 +494,19 @@ static int
weechat_lua_api_mkdir_parents (lua_State *L)
{
const char *directory;
- int mode, n;
-
- /* make C compiler happy */
- (void) L;
+ int mode;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "mkdir_parents");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "mkdir_parents");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "mkdir_parents", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_ERROR);
directory = lua_tostring (lua_current_interpreter, -2);
mode = lua_tonumber (lua_current_interpreter, -1);
if (weechat_mkdir_parents (directory, mode))
- LUA_RETURN_OK;
+ API_RETURN_OK;
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -727,18 +518,11 @@ weechat_lua_api_list_new (lua_State *L)
{
char *result;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "list_new");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "list_new", API_RETURN_EMPTY);
result = script_ptr2str (weechat_list_new ());
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -750,24 +534,10 @@ weechat_lua_api_list_add (lua_State *L)
{
const char *weelist, *data, *where, *user_data;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "list_add");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "list_add");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "list_add", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 4)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
weelist = lua_tostring (lua_current_interpreter, -4);
data = lua_tostring (lua_current_interpreter, -3);
@@ -779,7 +549,7 @@ weechat_lua_api_list_add (lua_State *L)
where,
script_str2ptr (user_data)));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -791,24 +561,10 @@ weechat_lua_api_list_search (lua_State *L)
{
const char *weelist, *data;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "list_search");
- LUA_RETURN_EMPTY;
- }
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "list_search");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "list_search", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
weelist = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
@@ -816,7 +572,7 @@ weechat_lua_api_list_search (lua_State *L)
result = script_ptr2str (weechat_list_search (script_str2ptr (weelist),
data));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -827,31 +583,18 @@ static int
weechat_lua_api_list_search_pos (lua_State *L)
{
const char *weelist, *data;
- int n, pos;
-
- /* make C compiler happy */
- (void) L;
+ int pos;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "list_search_pos");
- LUA_RETURN_INT(-1);
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "list_search_pos");
- LUA_RETURN_INT(-1);
- }
+ API_FUNC(1, "list_search_pos", API_RETURN_INT(-1));
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_INT(-1));
weelist = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
pos = weechat_list_search_pos (script_str2ptr (weelist), data);
- LUA_RETURN_INT(pos);
+ API_RETURN_INT(pos);
}
/*
@@ -863,24 +606,10 @@ weechat_lua_api_list_casesearch (lua_State *L)
{
const char *weelist, *data;
char *result;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "list_casesearch");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "list_casesearch");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "list_casesearch", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
weelist = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
@@ -888,7 +617,7 @@ weechat_lua_api_list_casesearch (lua_State *L)
result = script_ptr2str (weechat_list_casesearch (script_str2ptr (weelist),
data));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -900,31 +629,18 @@ static int
weechat_lua_api_list_casesearch_pos (lua_State *L)
{
const char *weelist, *data;
- int n, pos;
-
- /* make C compiler happy */
- (void) L;
+ int pos;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "list_casesearch_pos");
- LUA_RETURN_INT(-1);
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "list_casesearch_pos");
- LUA_RETURN_INT(-1);
- }
+ API_FUNC(1, "list_casesearch_pos", API_RETURN_INT(-1));
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_INT(-1));
weelist = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
pos = weechat_list_casesearch_pos (script_str2ptr (weelist), data);
- LUA_RETURN_INT(pos);
+ API_RETURN_INT(pos);
}
/*
@@ -936,24 +652,11 @@ weechat_lua_api_list_get (lua_State *L)
{
const char *weelist;
char *result;
- int position, n;
+ int position;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "list_get");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "list_get");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "list_get", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
weelist = lua_tostring (lua_current_interpreter, -2);
position = lua_tonumber (lua_current_interpreter, -1);
@@ -961,7 +664,7 @@ weechat_lua_api_list_get (lua_State *L)
result = script_ptr2str (weechat_list_get (script_str2ptr (weelist),
position));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -972,24 +675,10 @@ static int
weechat_lua_api_list_set (lua_State *L)
{
const char *item, *new_value;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "list_set");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "list_set");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "list_set", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_ERROR);
item = lua_tostring (lua_current_interpreter, -2);
new_value = lua_tostring (lua_current_interpreter, -1);
@@ -997,7 +686,7 @@ weechat_lua_api_list_set (lua_State *L)
weechat_list_set (script_str2ptr (item),
new_value);
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -1009,30 +698,16 @@ weechat_lua_api_list_next (lua_State *L)
{
const char *item;
char *result;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "list_next");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "list_next");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "list_next", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
item = lua_tostring (lua_current_interpreter, -1);
result = script_ptr2str (weechat_list_next (script_str2ptr (item)));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1044,30 +719,16 @@ weechat_lua_api_list_prev (lua_State *L)
{
const char *item;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "list_prev");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "list_prev");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "list_prev", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
item = lua_tostring (lua_current_interpreter, -1);
result = script_ptr2str (weechat_list_prev (script_str2ptr (item)));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1078,30 +739,16 @@ static int
weechat_lua_api_list_string (lua_State *L)
{
const char *item, *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "list_string");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "list_string");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "list_string", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
item = lua_tostring (lua_current_interpreter, -1);
result = weechat_list_string (script_str2ptr (item));
- LUA_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -1112,30 +759,17 @@ static int
weechat_lua_api_list_size (lua_State *L)
{
const char *weelist;
- int n, size;
+ int size;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "list_size");
- LUA_RETURN_INT(0);
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "list_size");
- LUA_RETURN_INT(0);
- }
+ API_FUNC(1, "list_size", API_RETURN_INT(0));
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_INT(0));
weelist = lua_tostring (lua_current_interpreter, -1);
size = weechat_list_size (script_str2ptr (weelist));
- LUA_RETURN_INT(size);
+ API_RETURN_INT(size);
}
/*
@@ -1146,24 +780,10 @@ static int
weechat_lua_api_list_remove (lua_State *L)
{
const char *weelist, *item;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "list_remove");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "list_remove");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "list_remove", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_ERROR);
weelist = lua_tostring (lua_current_interpreter, -2);
item = lua_tostring (lua_current_interpreter, -1);
@@ -1171,7 +791,7 @@ weechat_lua_api_list_remove (lua_State *L)
weechat_list_remove (script_str2ptr (weelist),
script_str2ptr (item));
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -1182,30 +802,16 @@ static int
weechat_lua_api_list_remove_all (lua_State *L)
{
const char *weelist;
- int n;
-
- /* make C compiler happy */
- (void) L;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "list_remove_all");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "list_remove_all");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "list_remove_all", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_ERROR);
weelist = lua_tostring (lua_current_interpreter, -1);
weechat_list_remove_all (script_str2ptr (weelist));
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -1216,30 +822,16 @@ static int
weechat_lua_api_list_free (lua_State *L)
{
const char *weelist;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "list_free");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "list_free");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "list_free", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_ERROR);
weelist = lua_tostring (lua_current_interpreter, -1);
weechat_list_free (script_str2ptr (weelist));
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -1251,7 +843,7 @@ weechat_lua_api_config_reload_cb (void *data,
struct t_config_file *config_file)
{
struct t_script_callback *script_callback;
- void *lua_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1259,13 +851,13 @@ weechat_lua_api_config_reload_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = script_ptr2str (config_file);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", lua_argv);
+ "ss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
@@ -1274,8 +866,8 @@ weechat_lua_api_config_reload_cb (void *data,
ret = *rc;
free (rc);
}
- if (lua_argv[1])
- free (lua_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -1292,24 +884,10 @@ weechat_lua_api_config_new (lua_State *L)
{
const char *name, *function, *data;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_new");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_new");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "config_new", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
name = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
@@ -1322,7 +900,7 @@ weechat_lua_api_config_new (lua_State *L)
function,
data));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1336,7 +914,7 @@ weechat_lua_api_config_read_cb (void *data,
const char *option_name, const char *value)
{
struct t_script_callback *script_callback;
- void *lua_argv[5];
+ void *func_argv[5];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1344,16 +922,16 @@ weechat_lua_api_config_read_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = script_ptr2str (config_file);
- lua_argv[2] = script_ptr2str (section);
- lua_argv[3] = (option_name) ? (char *)option_name : empty_arg;
- lua_argv[4] = (value) ? (char *)value : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
+ func_argv[2] = script_ptr2str (section);
+ func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
+ func_argv[4] = (value) ? (char *)value : empty_arg;
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sssss", lua_argv);
+ "sssss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
@@ -1362,10 +940,10 @@ weechat_lua_api_config_read_cb (void *data,
ret = *rc;
free (rc);
}
- if (lua_argv[1])
- free (lua_argv[1]);
- if (lua_argv[2])
- free (lua_argv[2]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[2])
+ free (func_argv[2]);
return ret;
}
@@ -1383,7 +961,7 @@ weechat_lua_api_config_section_write_cb (void *data,
const char *section_name)
{
struct t_script_callback *script_callback;
- void *lua_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1391,14 +969,14 @@ weechat_lua_api_config_section_write_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = script_ptr2str (config_file);
- lua_argv[2] = (section_name) ? (char *)section_name : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
+ func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", lua_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_WRITE_ERROR;
@@ -1407,8 +985,8 @@ weechat_lua_api_config_section_write_cb (void *data,
ret = *rc;
free (rc);
}
- if (lua_argv[1])
- free (lua_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -1427,7 +1005,7 @@ weechat_lua_api_config_section_write_default_cb (void *data,
const char *section_name)
{
struct t_script_callback *script_callback;
- void *lua_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1435,14 +1013,14 @@ weechat_lua_api_config_section_write_default_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = script_ptr2str (config_file);
- lua_argv[2] = (section_name) ? (char *)section_name : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
+ func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", lua_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_WRITE_ERROR;
@@ -1451,8 +1029,8 @@ weechat_lua_api_config_section_write_default_cb (void *data,
ret = *rc;
free (rc);
}
- if (lua_argv[1])
- free (lua_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -1472,7 +1050,7 @@ weechat_lua_api_config_section_create_option_cb (void *data,
const char *value)
{
struct t_script_callback *script_callback;
- void *lua_argv[5];
+ void *func_argv[5];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1480,16 +1058,16 @@ weechat_lua_api_config_section_create_option_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = script_ptr2str (config_file);
- lua_argv[2] = script_ptr2str (section);
- lua_argv[3] = (option_name) ? (char *)option_name : empty_arg;
- lua_argv[4] = (value) ? (char *)value : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
+ func_argv[2] = script_ptr2str (section);
+ func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
+ func_argv[4] = (value) ? (char *)value : empty_arg;
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sssss", lua_argv);
+ "sssss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
@@ -1498,10 +1076,10 @@ weechat_lua_api_config_section_create_option_cb (void *data,
ret = *rc;
free (rc);
}
- if (lua_argv[1])
- free (lua_argv[1]);
- if (lua_argv[2])
- free (lua_argv[2]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[2])
+ free (func_argv[2]);
return ret;
}
@@ -1520,7 +1098,7 @@ weechat_lua_api_config_section_delete_option_cb (void *data,
struct t_config_option *option)
{
struct t_script_callback *script_callback;
- void *lua_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1528,15 +1106,15 @@ weechat_lua_api_config_section_delete_option_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = script_ptr2str (config_file);
- lua_argv[2] = script_ptr2str (section);
- lua_argv[3] = script_ptr2str (option);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
+ func_argv[2] = script_ptr2str (section);
+ func_argv[3] = script_ptr2str (option);
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ssss", lua_argv);
+ "ssss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_OPTION_UNSET_ERROR;
@@ -1545,12 +1123,12 @@ weechat_lua_api_config_section_delete_option_cb (void *data,
ret = *rc;
free (rc);
}
- if (lua_argv[1])
- free (lua_argv[1]);
- if (lua_argv[2])
- free (lua_argv[2]);
- if (lua_argv[3])
- free (lua_argv[3]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[2])
+ free (func_argv[2]);
+ if (func_argv[3])
+ free (func_argv[3]);
return ret;
}
@@ -1571,24 +1149,11 @@ weechat_lua_api_config_new_section (lua_State *L)
const char *data_create_option, *function_delete_option;
const char *data_delete_option;
char *result;
- int n, user_can_add_options, user_can_delete_options;
+ int user_can_add_options, user_can_delete_options;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_new_section");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 14)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_new_section");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "config_new_section", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 14)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
config_file = lua_tostring (lua_current_interpreter, -14);
name = lua_tostring (lua_current_interpreter, -13);
@@ -1627,7 +1192,7 @@ weechat_lua_api_config_new_section (lua_State *L)
function_delete_option,
data_delete_option));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1639,24 +1204,10 @@ weechat_lua_api_config_search_section (lua_State *L)
{
const char *config_file, *section_name;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_search_section");
- LUA_RETURN_EMPTY;
- }
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_search_section");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "config_search_section", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
config_file = lua_tostring (lua_current_interpreter, -2);
section_name = lua_tostring (lua_current_interpreter, -1);
@@ -1664,7 +1215,7 @@ weechat_lua_api_config_search_section (lua_State *L)
result = script_ptr2str (weechat_config_search_section (script_str2ptr (config_file),
section_name));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1678,7 +1229,7 @@ weechat_lua_api_config_option_check_value_cb (void *data,
const char *value)
{
struct t_script_callback *script_callback;
- void *lua_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1686,14 +1237,14 @@ weechat_lua_api_config_option_check_value_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = script_ptr2str (option);
- lua_argv[2] = (value) ? (char *)value : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (option);
+ func_argv[2] = (value) ? (char *)value : empty_arg;
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", lua_argv);
+ "sss", func_argv);
if (!rc)
ret = 0;
@@ -1702,8 +1253,8 @@ weechat_lua_api_config_option_check_value_cb (void *data,
ret = *rc;
free (rc);
}
- if (lua_argv[1])
- free (lua_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -1720,7 +1271,7 @@ weechat_lua_api_config_option_change_cb (void *data,
struct t_config_option *option)
{
struct t_script_callback *script_callback;
- void *lua_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc;
@@ -1728,16 +1279,16 @@ weechat_lua_api_config_option_change_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = script_ptr2str (option);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (option);
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", lua_argv);
+ "ss", func_argv);
- if (lua_argv[1])
- free (lua_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
if (rc)
free (rc);
@@ -1753,7 +1304,7 @@ weechat_lua_api_config_option_delete_cb (void *data,
struct t_config_option *option)
{
struct t_script_callback *script_callback;
- void *lua_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc;
@@ -1761,16 +1312,16 @@ weechat_lua_api_config_option_delete_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = script_ptr2str (option);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (option);
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", lua_argv);
+ "ss", func_argv);
- if (lua_argv[1])
- free (lua_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
if (rc)
free (rc);
@@ -1789,24 +1340,11 @@ weechat_lua_api_config_new_option (lua_State *L)
const char *function_check_value, *data_check_value, *function_change;
const char *data_change, *function_delete, *data_delete;
char *result;
- int n, min, max, null_value_allowed;
-
- /* make C compiler happy */
- (void) L;
+ int min, max, null_value_allowed;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_new_option");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 17)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_new_option");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "config_new_option", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 17)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
config_file = lua_tostring (lua_current_interpreter, -17);
section = lua_tostring (lua_current_interpreter, -16);
@@ -1849,7 +1387,7 @@ weechat_lua_api_config_new_option (lua_State *L)
function_delete,
data_delete));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1861,24 +1399,10 @@ weechat_lua_api_config_search_option (lua_State *L)
{
const char *config_file, *section, *option_name;
char *result;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_search_option");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_search_option");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "config_search_option", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
config_file = lua_tostring (lua_current_interpreter, -3);
section = lua_tostring (lua_current_interpreter, -2);
@@ -1888,7 +1412,7 @@ weechat_lua_api_config_search_option (lua_State *L)
script_str2ptr (section),
option_name));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1899,30 +1423,17 @@ static int
weechat_lua_api_config_string_to_boolean (lua_State *L)
{
const char *text;
- int n, value;
-
- /* make C compiler happy */
- (void) L;
+ int value;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_string_to_boolean");
- LUA_RETURN_INT(0);
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_string_to_boolean");
- LUA_RETURN_INT(0);
- }
+ API_FUNC(1, "config_string_to_boolean", API_RETURN_INT(0));
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_INT(0));
text = lua_tostring (lua_current_interpreter, -1);
value = weechat_config_string_to_boolean (text);
- LUA_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -1933,24 +1444,11 @@ static int
weechat_lua_api_config_option_reset (lua_State *L)
{
const char *option;
- int n, run_callback, rc;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_option_reset");
- LUA_RETURN_INT(0);
- }
+ int run_callback, rc;
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_option_reset");
- LUA_RETURN_INT(0);
- }
+ API_FUNC(1, "config_option_reset", API_RETURN_INT(0));
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_INT(0));
option = lua_tostring (lua_current_interpreter, -2);
run_callback = lua_tonumber (lua_current_interpreter, -1);
@@ -1958,7 +1456,7 @@ weechat_lua_api_config_option_reset (lua_State *L)
rc = weechat_config_option_reset (script_str2ptr (option),
run_callback);
- LUA_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -1969,24 +1467,11 @@ static int
weechat_lua_api_config_option_set (lua_State *L)
{
const char *option, *new_value;
- int n, run_callback, rc;
-
- /* make C compiler happy */
- (void) L;
+ int run_callback, rc;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_option_set");
- LUA_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_option_set");
- LUA_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
+ API_FUNC(1, "config_option_set", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
option = lua_tostring (lua_current_interpreter, -3);
new_value = lua_tostring (lua_current_interpreter, -2);
@@ -1996,7 +1481,7 @@ weechat_lua_api_config_option_set (lua_State *L)
new_value,
run_callback);
- LUA_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2008,24 +1493,11 @@ static int
weechat_lua_api_config_option_set_null (lua_State *L)
{
const char *option;
- int n, run_callback, rc;
+ int run_callback, rc;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_option_set_null");
- LUA_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_option_set_null");
- LUA_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
+ API_FUNC(1, "config_option_set_null", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
option = lua_tostring (lua_current_interpreter, -2);
run_callback = lua_tonumber (lua_current_interpreter, -1);
@@ -2033,7 +1505,7 @@ weechat_lua_api_config_option_set_null (lua_State *L)
rc = weechat_config_option_set_null (script_str2ptr (option),
run_callback);
- LUA_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2044,30 +1516,17 @@ static int
weechat_lua_api_config_option_unset (lua_State *L)
{
const char *option;
- int n, rc;
-
- /* make C compiler happy */
- (void) L;
+ int rc;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_option_unset");
- LUA_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_option_unset");
- LUA_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
- }
+ API_FUNC(1, "config_option_unset", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
option = lua_tostring (lua_current_interpreter, -1);
rc = weechat_config_option_unset (script_str2ptr (option));
- LUA_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2078,24 +1537,10 @@ static int
weechat_lua_api_config_option_rename (lua_State *L)
{
const char *option, *new_name;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_option_rename");
- LUA_RETURN_ERROR;
- }
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_option_rename");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "config_option_rename", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_ERROR);
option = lua_tostring (lua_current_interpreter, -2);
new_name = lua_tostring (lua_current_interpreter, -1);
@@ -2103,7 +1548,7 @@ weechat_lua_api_config_option_rename (lua_State *L)
weechat_config_option_rename (script_str2ptr (option),
new_name);
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2114,30 +1559,17 @@ static int
weechat_lua_api_config_option_is_null (lua_State *L)
{
const char *option;
- int n, value;
-
- /* make C compiler happy */
- (void) L;
+ int value;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_option_is_null");
- LUA_RETURN_INT(1);
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_option_is_null");
- LUA_RETURN_INT(1);
- }
+ API_FUNC(1, "config_option_is_null", API_RETURN_INT(1));
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_INT(1));
option = lua_tostring (lua_current_interpreter, -1);
value = weechat_config_option_is_null (script_str2ptr (option));
- LUA_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2149,30 +1581,17 @@ static int
weechat_lua_api_config_option_default_is_null (lua_State *L)
{
const char *option;
- int n, value;
+ int value;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_option_default_is_null");
- LUA_RETURN_INT(1);
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_option_default_is_null");
- LUA_RETURN_INT(1);
- }
+ API_FUNC(1, "config_option_default_is_null", API_RETURN_INT(1));
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_INT(1));
option = lua_tostring (lua_current_interpreter, -1);
value = weechat_config_option_default_is_null (script_str2ptr (option));
- LUA_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2183,30 +1602,17 @@ static int
weechat_lua_api_config_boolean (lua_State *L)
{
const char *option;
- int n, value;
+ int value;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_boolean");
- LUA_RETURN_INT(0);
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_boolean");
- LUA_RETURN_INT(0);
- }
+ API_FUNC(1, "config_boolean", API_RETURN_INT(0));
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_INT(0));
option = lua_tostring (lua_current_interpreter, -1);
value = weechat_config_boolean (script_str2ptr (option));
- LUA_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2217,30 +1623,17 @@ static int
weechat_lua_api_config_boolean_default (lua_State *L)
{
const char *option;
- int n, value;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_boolean_default");
- LUA_RETURN_INT(0);
- }
+ int value;
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_boolean_default");
- LUA_RETURN_INT(0);
- }
+ API_FUNC(1, "config_boolean_default", API_RETURN_INT(0));
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_INT(0));
option = lua_tostring (lua_current_interpreter, -1);
value = weechat_config_boolean_default (script_str2ptr (option));
- LUA_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2251,30 +1644,17 @@ static int
weechat_lua_api_config_integer (lua_State *L)
{
const char *option;
- int n, value;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_integer");
- LUA_RETURN_INT(0);
- }
-
- n = lua_gettop (lua_current_interpreter);
+ int value;
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_integer");
- LUA_RETURN_INT(0);
- }
+ API_FUNC(1, "config_integer", API_RETURN_INT(0));
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_INT(0));
option = lua_tostring (lua_current_interpreter, -1);
value = weechat_config_integer (script_str2ptr (option));
- LUA_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2285,30 +1665,17 @@ static int
weechat_lua_api_config_integer_default (lua_State *L)
{
const char *option;
- int n, value;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_integer_default");
- LUA_RETURN_INT(0);
- }
-
- n = lua_gettop (lua_current_interpreter);
+ int value;
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_integer_default");
- LUA_RETURN_INT(0);
- }
+ API_FUNC(1, "config_integer_default", API_RETURN_INT(0));
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_INT(0));
option = lua_tostring (lua_current_interpreter, -1);
value = weechat_config_integer_default (script_str2ptr (option));
- LUA_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2319,30 +1686,16 @@ static int
weechat_lua_api_config_string (lua_State *L)
{
const char *option, *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_string");
- LUA_RETURN_EMPTY;
- }
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_string");
- LUA_RETURN_INT(0);
- }
+ API_FUNC(1, "config_string", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_INT(0));
option = lua_tostring (lua_current_interpreter, -1);
result = weechat_config_string (script_str2ptr (option));
- LUA_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2353,30 +1706,16 @@ static int
weechat_lua_api_config_string_default (lua_State *L)
{
const char *option, *result;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_string_default");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_string_default");
- LUA_RETURN_INT(0);
- }
+ API_FUNC(1, "config_string_default", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_INT(0));
option = lua_tostring (lua_current_interpreter, -1);
result = weechat_config_string_default (script_str2ptr (option));
- LUA_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2387,30 +1726,16 @@ static int
weechat_lua_api_config_color (lua_State *L)
{
const char *option, *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_color");
- LUA_RETURN_INT(0);
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_color");
- LUA_RETURN_INT(0);
- }
+ API_FUNC(1, "config_color", API_RETURN_INT(0));
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_INT(0));
option = lua_tostring (lua_current_interpreter, -1);
result = weechat_config_color (script_str2ptr (option));
- LUA_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2421,30 +1746,16 @@ static int
weechat_lua_api_config_color_default (lua_State *L)
{
const char *option, *result;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_color_default");
- LUA_RETURN_INT(0);
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_color_default");
- LUA_RETURN_INT(0);
- }
+ API_FUNC(1, "config_color_default", API_RETURN_INT(0));
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_INT(0));
option = lua_tostring (lua_current_interpreter, -1);
result = weechat_config_color_default (script_str2ptr (option));
- LUA_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2455,24 +1766,10 @@ static int
weechat_lua_api_config_write_option (lua_State *L)
{
const char *config_file, *option;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_write_option");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_write_option");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "config_write_option", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_ERROR);
config_file = lua_tostring (lua_current_interpreter, -2);
option = lua_tostring (lua_current_interpreter, -1);
@@ -2480,7 +1777,7 @@ weechat_lua_api_config_write_option (lua_State *L)
weechat_config_write_option (script_str2ptr (config_file),
script_str2ptr (option));
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2491,24 +1788,10 @@ static int
weechat_lua_api_config_write_line (lua_State *L)
{
const char *config_file, *option_name, *value;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_write_line");
- LUA_RETURN_ERROR;
- }
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_write_line");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "config_write_line", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_ERROR);
config_file = lua_tostring (lua_current_interpreter, -3);
option_name = lua_tostring (lua_current_interpreter, -2);
@@ -2519,7 +1802,7 @@ weechat_lua_api_config_write_line (lua_State *L)
"%s",
value);
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2530,30 +1813,17 @@ static int
weechat_lua_api_config_write (lua_State *L)
{
const char *config_file;
- int n, rc;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_write");
- LUA_RETURN_INT(-1);
- }
+ int rc;
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_write");
- LUA_RETURN_INT(-1);
- }
+ API_FUNC(1, "config_write", API_RETURN_INT(-1));
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_INT(-1));
config_file = lua_tostring (lua_current_interpreter, -1);
rc = weechat_config_write (script_str2ptr (config_file));
- LUA_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2564,30 +1834,17 @@ static int
weechat_lua_api_config_read (lua_State *L)
{
const char *config_file;
- int n, rc;
+ int rc;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_read");
- LUA_RETURN_INT(-1);
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_read");
- LUA_RETURN_INT(-1);
- }
+ API_FUNC(1, "config_read", API_RETURN_INT(-1));
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_INT(-1));
config_file = lua_tostring (lua_current_interpreter, -1);
rc = weechat_config_read (script_str2ptr (config_file));
- LUA_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2598,30 +1855,17 @@ static int
weechat_lua_api_config_reload (lua_State *L)
{
const char *config_file;
- int n, rc;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_reload");
- LUA_RETURN_INT(-1);
- }
+ int rc;
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_reload");
- LUA_RETURN_INT(-1);
- }
+ API_FUNC(1, "config_reload", API_RETURN_INT(-1));
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_INT(-1));
config_file = lua_tostring (lua_current_interpreter, -1);
rc = weechat_config_reload (script_str2ptr (config_file));
- LUA_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2632,24 +1876,10 @@ static int
weechat_lua_api_config_option_free (lua_State *L)
{
const char *option;
- int n;
-
- /* make C compiler happy */
- (void) L;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_option_free");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_option_free");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "config_option_free", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_ERROR);
option = lua_tostring (lua_current_interpreter, -1);
@@ -2657,7 +1887,7 @@ weechat_lua_api_config_option_free (lua_State *L)
lua_current_script,
script_str2ptr (option));
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2669,24 +1899,10 @@ static int
weechat_lua_api_config_section_free_options (lua_State *L)
{
const char *section;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_section_free_options");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_section_free_options");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "config_section_free_options", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_ERROR);
section = lua_tostring (lua_current_interpreter, -1);
@@ -2694,7 +1910,7 @@ weechat_lua_api_config_section_free_options (lua_State *L)
lua_current_script,
script_str2ptr (section));
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2705,24 +1921,10 @@ static int
weechat_lua_api_config_section_free (lua_State *L)
{
const char *section;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_section_free");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_section_free");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "config_section_free", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_ERROR);
section = lua_tostring (lua_current_interpreter, -1);
@@ -2730,7 +1932,7 @@ weechat_lua_api_config_section_free (lua_State *L)
lua_current_script,
script_str2ptr (section));
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2741,24 +1943,10 @@ static int
weechat_lua_api_config_free (lua_State *L)
{
const char *config_file;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_free");
- LUA_RETURN_ERROR;
- }
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_free");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "config_free", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_ERROR);
config_file = lua_tostring (lua_current_interpreter, -1);
@@ -2766,7 +1954,7 @@ weechat_lua_api_config_free (lua_State *L)
lua_current_script,
script_str2ptr (config_file));
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2778,30 +1966,16 @@ weechat_lua_api_config_get (lua_State *L)
{
const char *option;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_get");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_get");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "config_get", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
option = lua_tostring (lua_current_interpreter, -1);
result = script_ptr2str (weechat_config_get (option));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -2812,24 +1986,10 @@ static int
weechat_lua_api_config_get_plugin (lua_State *L)
{
const char *option, *result;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_get_plugin");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_get_plugin");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "config_get_plugin", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
option = lua_tostring (lua_current_interpreter, -1);
@@ -2837,7 +1997,7 @@ weechat_lua_api_config_get_plugin (lua_State *L)
lua_current_script,
option);
- LUA_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2848,24 +2008,11 @@ static int
weechat_lua_api_config_is_set_plugin (lua_State *L)
{
const char *option;
- int n, rc;
-
- /* make C compiler happy */
- (void) L;
+ int rc;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_is_set_plugin");
- LUA_RETURN_INT(0);
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_is_set_plugin");
- LUA_RETURN_INT(0);
- }
+ API_FUNC(1, "config_is_set_plugin", API_RETURN_INT(0));
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_INT(0));
option = lua_tostring (lua_current_interpreter, -1);
@@ -2873,7 +2020,7 @@ weechat_lua_api_config_is_set_plugin (lua_State *L)
lua_current_script,
option);
- LUA_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2884,24 +2031,11 @@ static int
weechat_lua_api_config_set_plugin (lua_State *L)
{
const char *option, *value;
- int n, rc;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_set_plugin");
- LUA_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
+ int rc;
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_set_plugin");
- LUA_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
+ API_FUNC(1, "config_set_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
option = lua_tostring (lua_current_interpreter, -2);
value = lua_tostring (lua_current_interpreter, -1);
@@ -2911,7 +2045,7 @@ weechat_lua_api_config_set_plugin (lua_State *L)
option,
value);
- LUA_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2922,24 +2056,10 @@ static int
weechat_lua_api_config_set_desc_plugin (lua_State *L)
{
const char *option, *description;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_set_desc_plugin");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_set_desc_plugin");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "config_set_desc_plugin", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_ERROR);
option = lua_tostring (lua_current_interpreter, -2);
description = lua_tostring (lua_current_interpreter, -1);
@@ -2949,7 +2069,7 @@ weechat_lua_api_config_set_desc_plugin (lua_State *L)
option,
description);
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2960,24 +2080,11 @@ static int
weechat_lua_api_config_unset_plugin (lua_State *L)
{
const char *option;
- int n, rc;
+ int rc;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_unset_plugin");
- LUA_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_unset_plugin");
- LUA_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
- }
+ API_FUNC(1, "config_unset_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
option = lua_tostring (lua_current_interpreter, -1);
@@ -2985,7 +2092,7 @@ weechat_lua_api_config_unset_plugin (lua_State *L)
lua_current_script,
option);
- LUA_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2997,24 +2104,11 @@ weechat_lua_api_key_bind (lua_State *L)
{
const char *context;
struct t_hashtable *hashtable;
- int n, num_keys;
+ int num_keys;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "key_bind");
- LUA_RETURN_INT(0);
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "key_bind");
- LUA_RETURN_INT(0);
- }
+ API_FUNC(1, "key_bind", API_RETURN_INT(0));
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_INT(0));
context = lua_tostring (lua_current_interpreter, -2);
hashtable = weechat_lua_tohashtable (lua_current_interpreter, -1,
@@ -3025,7 +2119,7 @@ weechat_lua_api_key_bind (lua_State *L)
if (hashtable)
weechat_hashtable_free (hashtable);
- LUA_RETURN_INT(num_keys);
+ API_RETURN_INT(num_keys);
}
/*
@@ -3036,31 +2130,18 @@ static int
weechat_lua_api_key_unbind (lua_State *L)
{
const char *context, *key;
- int n, num_keys;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "key_unbind");
- LUA_RETURN_INT(0);
- }
-
- n = lua_gettop (lua_current_interpreter);
+ int num_keys;
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "key_unbind");
- LUA_RETURN_INT(0);
- }
+ API_FUNC(1, "key_unbind", API_RETURN_INT(0));
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_INT(0));
context = lua_tostring (lua_current_interpreter, -2);
key = lua_tostring (lua_current_interpreter, -1);
num_keys = weechat_key_unbind (context, key);
- LUA_RETURN_INT(num_keys);
+ API_RETURN_INT(num_keys);
}
/*
@@ -3071,24 +2152,16 @@ static int
weechat_lua_api_prefix (lua_State *L)
{
const char *prefix, *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "prefix");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(0, "prefix", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
prefix = lua_tostring (lua_current_interpreter, -1);
result = weechat_prefix (prefix);
- LUA_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -3099,24 +2172,16 @@ static int
weechat_lua_api_color (lua_State *L)
{
const char *color, *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "color");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(0, "color", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
color = lua_tostring (lua_current_interpreter, -1);
result = weechat_color (color);
- LUA_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -3127,18 +2192,10 @@ static int
weechat_lua_api_print (lua_State *L)
{
const char *buffer, *message;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "print");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(0, "print", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = lua_tostring (lua_current_interpreter, -2);
message = lua_tostring (lua_current_interpreter, -1);
@@ -3148,7 +2205,7 @@ weechat_lua_api_print (lua_State *L)
script_str2ptr (buffer),
"%s", message);
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -3160,24 +2217,11 @@ static int
weechat_lua_api_print_date_tags (lua_State *L)
{
const char *buffer, *tags, *message;
- int n, date;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "print_date_tags");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
+ int date;
- if (n < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "print_date_tags");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "print_date_tags", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 4)
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = lua_tostring (lua_current_interpreter, -4);
date = lua_tonumber (lua_current_interpreter, -3);
@@ -3191,7 +2235,7 @@ weechat_lua_api_print_date_tags (lua_State *L)
tags,
"%s", message);
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -3202,24 +2246,11 @@ static int
weechat_lua_api_print_y (lua_State *L)
{
const char *buffer, *message;
- int n, y;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "print_y");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
+ int y;
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "print_y");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "print_y", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = lua_tostring (lua_current_interpreter, -3);
y = lua_tonumber (lua_current_interpreter, -2);
@@ -3231,7 +2262,7 @@ weechat_lua_api_print_y (lua_State *L)
y,
"%s", message);
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -3242,24 +2273,10 @@ static int
weechat_lua_api_log_print (lua_State *L)
{
const char *message;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "log_print");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "log_print");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "log_print", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_ERROR);
message = lua_tostring (lua_current_interpreter, -1);
@@ -3267,7 +2284,7 @@ weechat_lua_api_log_print (lua_State *L)
lua_current_script,
"%s", message);
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -3279,7 +2296,7 @@ weechat_lua_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
struct t_script_callback *script_callback;
- void *lua_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3290,14 +2307,14 @@ weechat_lua_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
if (script_callback && script_callback->function && script_callback->function[0])
{
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = script_ptr2str (buffer);
- lua_argv[2] = (argc > 1) ? argv_eol[1] : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (buffer);
+ func_argv[2] = (argc > 1) ? argv_eol[1] : empty_arg;
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", lua_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3306,8 +2323,8 @@ weechat_lua_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
ret = *rc;
free (rc);
}
- if (lua_argv[1])
- free (lua_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -3325,24 +2342,10 @@ weechat_lua_api_hook_command (lua_State *L)
const char *command, *description, *args, *args_description, *completion;
const char *function, *data;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_command");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 7)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hook_command");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "hook_command", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 7)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
command = lua_tostring (lua_current_interpreter, -7);
description = lua_tostring (lua_current_interpreter, -6);
@@ -3363,7 +2366,7 @@ weechat_lua_api_hook_command (lua_State *L)
function,
data));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3375,7 +2378,7 @@ weechat_lua_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
const char *command)
{
struct t_script_callback *script_callback;
- void *lua_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3383,14 +2386,14 @@ weechat_lua_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
if (script_callback && script_callback->function && script_callback->function[0])
{
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = script_ptr2str (buffer);
- lua_argv[2] = (command) ? (char *)command : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (buffer);
+ func_argv[2] = (command) ? (char *)command : empty_arg;
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", lua_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3399,8 +2402,8 @@ weechat_lua_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
ret = *rc;
free (rc);
}
- if (lua_argv[1])
- free (lua_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -3417,24 +2420,10 @@ weechat_lua_api_hook_command_run (lua_State *L)
{
const char *command, *function, *data;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_command_run");
- LUA_RETURN_EMPTY;
- }
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hook_command_run");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "hook_command_run", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
command = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
@@ -3447,7 +2436,7 @@ weechat_lua_api_hook_command_run (lua_State *L)
function,
data));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3458,7 +2447,7 @@ int
weechat_lua_api_hook_timer_cb (void *data, int remaining_calls)
{
struct t_script_callback *script_callback;
- void *lua_argv[2];
+ void *func_argv[2];
char str_remaining_calls[32], empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3469,13 +2458,13 @@ weechat_lua_api_hook_timer_cb (void *data, int remaining_calls)
snprintf (str_remaining_calls, sizeof (str_remaining_calls),
"%d", remaining_calls);
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = str_remaining_calls;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = str_remaining_calls;
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", lua_argv);
+ "ss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3498,26 +2487,13 @@ weechat_lua_api_hook_timer_cb (void *data, int remaining_calls)
static int
weechat_lua_api_hook_timer (lua_State *L)
{
- int n, interval, align_second, max_calls;
+ int interval, align_second, max_calls;
const char *function, *data;
char *result;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_timer");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 5)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hook_timer");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "hook_timer", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 5)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
interval = lua_tonumber (lua_current_interpreter, -5);
align_second = lua_tonumber (lua_current_interpreter, -4);
@@ -3534,7 +2510,7 @@ weechat_lua_api_hook_timer (lua_State *L)
function,
data));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3545,7 +2521,7 @@ int
weechat_lua_api_hook_fd_cb (void *data, int fd)
{
struct t_script_callback *script_callback;
- void *lua_argv[2];
+ void *func_argv[2];
char str_fd[32], empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3555,13 +2531,13 @@ weechat_lua_api_hook_fd_cb (void *data, int fd)
{
snprintf (str_fd, sizeof (str_fd), "%d", fd);
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = str_fd;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = str_fd;
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", lua_argv);
+ "ss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3584,26 +2560,13 @@ weechat_lua_api_hook_fd_cb (void *data, int fd)
static int
weechat_lua_api_hook_fd (lua_State *L)
{
- int n, fd, read, write, exception;
+ int fd, read, write, exception;
const char *function, *data;
char *result;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_fd");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 6)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hook_fd");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "hook_fd", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 6)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
fd = lua_tonumber (lua_current_interpreter, -6);
read = lua_tonumber (lua_current_interpreter, -5);
@@ -3622,7 +2585,7 @@ weechat_lua_api_hook_fd (lua_State *L)
function,
data));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3635,7 +2598,7 @@ weechat_lua_api_hook_process_cb (void *data,
const char *out, const char *err)
{
struct t_script_callback *script_callback;
- void *lua_argv[5];
+ void *func_argv[5];
char str_rc[32], empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3645,16 +2608,16 @@ weechat_lua_api_hook_process_cb (void *data,
{
snprintf (str_rc, sizeof (str_rc), "%d", return_code);
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = (command) ? (char *)command : empty_arg;
- lua_argv[2] = str_rc;
- lua_argv[3] = (out) ? (char *)out : empty_arg;
- lua_argv[4] = (err) ? (char *)err : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (command) ? (char *)command : empty_arg;
+ func_argv[2] = str_rc;
+ func_argv[3] = (out) ? (char *)out : empty_arg;
+ func_argv[4] = (err) ? (char *)err : empty_arg;
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sssss", lua_argv);
+ "sssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3678,25 +2641,12 @@ static int
weechat_lua_api_hook_process (lua_State *L)
{
const char *command, *function, *data;
- int n, timeout;
+ int timeout;
char *result;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_process");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hook_process");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "hook_process", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 4)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
command = lua_tostring (lua_current_interpreter, -4);
timeout = lua_tonumber (lua_current_interpreter, -3);
@@ -3711,7 +2661,7 @@ weechat_lua_api_hook_process (lua_State *L)
function,
data));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3723,7 +2673,7 @@ weechat_lua_api_hook_connect_cb (void *data, int status, int gnutls_rc,
const char *error, const char *ip_address)
{
struct t_script_callback *script_callback;
- void *lua_argv[5];
+ void *func_argv[5];
char str_status[32], str_gnutls_rc[32];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3735,16 +2685,16 @@ weechat_lua_api_hook_connect_cb (void *data, int status, int gnutls_rc,
snprintf (str_status, sizeof (str_status), "%d", status);
snprintf (str_gnutls_rc, sizeof (str_gnutls_rc), "%d", gnutls_rc);
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = str_status;
- lua_argv[2] = str_gnutls_rc;
- lua_argv[3] = (ip_address) ? (char *)ip_address : empty_arg;
- lua_argv[4] = (error) ? (char *)error : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = str_status;
+ func_argv[2] = str_gnutls_rc;
+ func_argv[3] = (ip_address) ? (char *)ip_address : empty_arg;
+ func_argv[4] = (error) ? (char *)error : empty_arg;
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sssss", lua_argv);
+ "sssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3768,25 +2718,12 @@ static int
weechat_lua_api_hook_connect (lua_State *L)
{
const char *proxy, *address, *local_hostname, *function, *data;
- int n, port, sock, ipv6;
+ int port, sock, ipv6;
char *result;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_connect");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 8)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hook_connect");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "hook_connect", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 8)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
proxy = lua_tostring (lua_current_interpreter, -8);
address = lua_tostring (lua_current_interpreter, -7);
@@ -3813,7 +2750,7 @@ weechat_lua_api_hook_connect (lua_State *L)
function,
data));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3828,7 +2765,7 @@ weechat_lua_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
const char *prefix, const char *message)
{
struct t_script_callback *script_callback;
- void *lua_argv[8];
+ void *func_argv[8];
char empty_arg[1] = { '\0' };
static char timebuffer[64];
int *rc, ret;
@@ -3842,21 +2779,21 @@ weechat_lua_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
{
snprintf (timebuffer, sizeof (timebuffer) - 1, "%ld", (long int)date);
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = script_ptr2str (buffer);
- lua_argv[2] = timebuffer;
- lua_argv[3] = weechat_string_build_with_split_string (tags, ",");
- if (!lua_argv[3])
- lua_argv[3] = strdup ("");
- lua_argv[4] = (displayed) ? strdup ("1") : strdup ("0");
- lua_argv[5] = (highlight) ? strdup ("1") : strdup ("0");
- lua_argv[6] = (prefix) ? (char *)prefix : empty_arg;
- lua_argv[7] = (message) ? (char *)message : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (buffer);
+ func_argv[2] = timebuffer;
+ func_argv[3] = weechat_string_build_with_split_string (tags, ",");
+ if (!func_argv[3])
+ func_argv[3] = strdup ("");
+ func_argv[4] = (displayed) ? strdup ("1") : strdup ("0");
+ func_argv[5] = (highlight) ? strdup ("1") : strdup ("0");
+ func_argv[6] = (prefix) ? (char *)prefix : empty_arg;
+ func_argv[7] = (message) ? (char *)message : empty_arg;
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ssssssss", lua_argv);
+ "ssssssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3865,14 +2802,14 @@ weechat_lua_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
ret = *rc;
free (rc);
}
- if (lua_argv[1])
- free (lua_argv[1]);
- if (lua_argv[3])
- free (lua_argv[3]);
- if (lua_argv[4])
- free (lua_argv[4]);
- if (lua_argv[5])
- free (lua_argv[5]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[3])
+ free (func_argv[3]);
+ if (func_argv[4])
+ free (func_argv[4]);
+ if (func_argv[5])
+ free (func_argv[5]);
return ret;
}
@@ -3889,24 +2826,11 @@ weechat_lua_api_hook_print (lua_State *L)
{
const char *buffer, *tags, *message, *function, *data;
char *result;
- int n, strip_colors;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_print");
- LUA_RETURN_EMPTY;
- }
+ int strip_colors;
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 6)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hook_print");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "hook_print", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 6)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = lua_tostring (lua_current_interpreter, -6);
tags = lua_tostring (lua_current_interpreter, -5);
@@ -3925,7 +2849,7 @@ weechat_lua_api_hook_print (lua_State *L)
function,
data));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3937,7 +2861,7 @@ weechat_lua_api_hook_signal_cb (void *data, const char *signal,
const char *type_data, void *signal_data)
{
struct t_script_callback *script_callback;
- void *lua_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
static char value_str[64];
int *rc, ret, free_needed;
@@ -3946,31 +2870,31 @@ weechat_lua_api_hook_signal_cb (void *data, const char *signal,
if (script_callback && script_callback->function && script_callback->function[0])
{
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = (signal) ? (char *)signal : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (signal) ? (char *)signal : empty_arg;
free_needed = 0;
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
{
- lua_argv[2] = (signal_data) ? (char *)signal_data : empty_arg;
+ func_argv[2] = (signal_data) ? (char *)signal_data : empty_arg;
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_INT) == 0)
{
snprintf (value_str, sizeof (value_str) - 1,
"%d", *((int *)signal_data));
- lua_argv[2] = value_str;
+ func_argv[2] = value_str;
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_POINTER) == 0)
{
- lua_argv[2] = script_ptr2str (signal_data);
+ func_argv[2] = script_ptr2str (signal_data);
free_needed = 1;
}
else
- lua_argv[2] = empty_arg;
+ func_argv[2] = empty_arg;
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", lua_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3979,8 +2903,8 @@ weechat_lua_api_hook_signal_cb (void *data, const char *signal,
ret = *rc;
free (rc);
}
- if (free_needed && lua_argv[2])
- free (lua_argv[2]);
+ if (free_needed && func_argv[2])
+ free (func_argv[2]);
return ret;
}
@@ -3997,24 +2921,10 @@ weechat_lua_api_hook_signal (lua_State *L)
{
const char *signal, *function, *data;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_signal");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hook_signal");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "hook_signal", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
signal = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
@@ -4027,7 +2937,7 @@ weechat_lua_api_hook_signal (lua_State *L)
function,
data));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4038,26 +2948,13 @@ static int
weechat_lua_api_hook_signal_send (lua_State *L)
{
const char *signal, *type_data, *signal_data;
- int n, number;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_signal_send");
- LUA_RETURN_ERROR;
- }
+ int number;
+ API_FUNC(1, "hook_signal_send", API_RETURN_ERROR);
signal_data = NULL;
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hook_signal_send");
- LUA_RETURN_ERROR;
- }
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_ERROR);
signal = lua_tostring (lua_current_interpreter, -3);
type_data = lua_tostring (lua_current_interpreter, -2);
@@ -4066,23 +2963,23 @@ weechat_lua_api_hook_signal_send (lua_State *L)
{
signal_data = lua_tostring (lua_current_interpreter, -1);
weechat_hook_signal_send (signal, type_data, (void *)signal_data);
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_INT) == 0)
{
number = lua_tonumber (lua_current_interpreter, -1);
weechat_hook_signal_send (signal, type_data, &number);
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_POINTER) == 0)
{
signal_data = lua_tostring (lua_current_interpreter, -1);
weechat_hook_signal_send (signal, type_data,
script_str2ptr (signal_data));
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
- LUA_RETURN_ERROR;
+ API_RETURN_ERROR;
}
/*
@@ -4094,7 +2991,7 @@ weechat_lua_api_hook_hsignal_cb (void *data, const char *signal,
struct t_hashtable *hashtable)
{
struct t_script_callback *script_callback;
- void *lua_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -4102,14 +2999,14 @@ weechat_lua_api_hook_hsignal_cb (void *data, const char *signal,
if (script_callback && script_callback->function && script_callback->function[0])
{
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = (signal) ? (char *)signal : empty_arg;
- lua_argv[2] = hashtable;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (signal) ? (char *)signal : empty_arg;
+ func_argv[2] = hashtable;
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ssh", lua_argv);
+ "ssh", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -4134,24 +3031,10 @@ weechat_lua_api_hook_hsignal (lua_State *L)
{
const char *signal, *function, *data;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_hsignal");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hook_hsignal");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "hook_hsignal", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
signal = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
@@ -4164,7 +3047,7 @@ weechat_lua_api_hook_hsignal (lua_State *L)
function,
data));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4176,24 +3059,10 @@ weechat_lua_api_hook_hsignal_send (lua_State *L)
{
const char *signal;
struct t_hashtable *hashtable;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_hsignal_send");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hook_hsignal_send");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "hook_hsignal_send", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_ERROR);
signal = lua_tostring (lua_current_interpreter, -2);
hashtable = weechat_lua_tohashtable (lua_current_interpreter, -1,
@@ -4204,7 +3073,7 @@ weechat_lua_api_hook_hsignal_send (lua_State *L)
if (hashtable)
weechat_hashtable_free (hashtable);
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4216,7 +3085,7 @@ weechat_lua_api_hook_config_cb (void *data, const char *option,
const char *value)
{
struct t_script_callback *script_callback;
- void *lua_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -4224,14 +3093,14 @@ weechat_lua_api_hook_config_cb (void *data, const char *option,
if (script_callback && script_callback->function && script_callback->function[0])
{
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = (option) ? (char *)option : empty_arg;
- lua_argv[2] = (value) ? (char *)value : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (option) ? (char *)option : empty_arg;
+ func_argv[2] = (value) ? (char *)value : empty_arg;
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", lua_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -4256,24 +3125,10 @@ weechat_lua_api_hook_config (lua_State *L)
{
const char *option, *function, *data;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_config");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hook_config");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "hook_config", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
option = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
@@ -4286,7 +3141,7 @@ weechat_lua_api_hook_config (lua_State *L)
function,
data));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4299,7 +3154,7 @@ weechat_lua_api_hook_completion_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
struct t_script_callback *script_callback;
- void *lua_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -4307,15 +3162,15 @@ weechat_lua_api_hook_completion_cb (void *data, const char *completion_item,
if (script_callback && script_callback->function && script_callback->function[0])
{
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = (completion_item) ? (char *)completion_item : empty_arg;
- lua_argv[2] = script_ptr2str (buffer);
- lua_argv[3] = script_ptr2str (completion);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (completion_item) ? (char *)completion_item : empty_arg;
+ func_argv[2] = script_ptr2str (buffer);
+ func_argv[3] = script_ptr2str (completion);
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ssss", lua_argv);
+ "ssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -4324,10 +3179,10 @@ weechat_lua_api_hook_completion_cb (void *data, const char *completion_item,
ret = *rc;
free (rc);
}
- if (lua_argv[2])
- free (lua_argv[2]);
- if (lua_argv[3])
- free (lua_argv[3]);
+ if (func_argv[2])
+ free (func_argv[2]);
+ if (func_argv[3])
+ free (func_argv[3]);
return ret;
}
@@ -4344,24 +3199,10 @@ weechat_lua_api_hook_completion (lua_State *L)
{
const char *completion, *description, *function, *data;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_completion");
- LUA_RETURN_EMPTY;
- }
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hook_completion");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "hook_completion", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 4)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
completion = lua_tostring (lua_current_interpreter, -4);
description = lua_tostring (lua_current_interpreter, -3);
@@ -4376,7 +3217,7 @@ weechat_lua_api_hook_completion (lua_State *L)
function,
data));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4387,24 +3228,11 @@ static int
weechat_lua_api_hook_completion_list_add (lua_State *L)
{
const char *completion, *word, *where;
- int n, nick_completion;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_completion_list_add");
- LUA_RETURN_ERROR;
- }
+ int nick_completion;
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hook_completion_list_add");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "hook_completion_list_add", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 4)
+ API_WRONG_ARGS(API_RETURN_ERROR);
completion = lua_tostring (lua_current_interpreter, -4);
word = lua_tostring (lua_current_interpreter, -3);
@@ -4416,7 +3244,7 @@ weechat_lua_api_hook_completion_list_add (lua_State *L)
nick_completion,
where);
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4429,22 +3257,22 @@ weechat_lua_api_hook_modifier_cb (void *data, const char *modifier,
const char *string)
{
struct t_script_callback *script_callback;
- void *lua_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' };
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = (modifier) ? (char *)modifier : empty_arg;
- lua_argv[2] = (modifier_data) ? (char *)modifier_data : empty_arg;
- lua_argv[3] = (string) ? (char *)string : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (modifier) ? (char *)modifier : empty_arg;
+ func_argv[2] = (modifier_data) ? (char *)modifier_data : empty_arg;
+ func_argv[3] = (string) ? (char *)string : empty_arg;
return (char *)weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
- "ssss", lua_argv);
+ "ssss", func_argv);
}
return NULL;
@@ -4459,24 +3287,10 @@ weechat_lua_api_hook_modifier (lua_State *L)
{
const char *modifier, *function, *data;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_modifier");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hook_modifier");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "hook_modifier", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
modifier = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
@@ -4489,7 +3303,7 @@ weechat_lua_api_hook_modifier (lua_State *L)
function,
data));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4501,24 +3315,10 @@ weechat_lua_api_hook_modifier_exec (lua_State *L)
{
const char *modifier, *modifier_data, *string;
char *result;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_modifier_exec");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hook_modifier_exec");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "hook_modifier_exec", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_ERROR);
modifier = lua_tostring (lua_current_interpreter, -3);
modifier_data = lua_tostring (lua_current_interpreter, -2);
@@ -4526,7 +3326,7 @@ weechat_lua_api_hook_modifier_exec (lua_State *L)
result = weechat_hook_modifier_exec (modifier, modifier_data, string);
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4538,21 +3338,21 @@ weechat_lua_api_hook_info_cb (void *data, const char *info_name,
const char *arguments)
{
struct t_script_callback *script_callback;
- void *lua_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = (info_name) ? (char *)info_name : empty_arg;
- lua_argv[2] = (arguments) ? (char *)arguments : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
+ func_argv[2] = (arguments) ? (char *)arguments : empty_arg;
return (const char *)weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
- "sss", lua_argv);
+ "sss", func_argv);
}
return NULL;
@@ -4567,24 +3367,10 @@ weechat_lua_api_hook_info (lua_State *L)
{
const char *info_name, *description, *args_description, *function, *data;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_info");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 5)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hook_info");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "hook_info", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 5)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
info_name = lua_tostring (lua_current_interpreter, -5);
description = lua_tostring (lua_current_interpreter, -4);
@@ -4601,7 +3387,7 @@ weechat_lua_api_hook_info (lua_State *L)
function,
data));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4613,21 +3399,21 @@ weechat_lua_api_hook_info_hashtable_cb (void *data, const char *info_name,
struct t_hashtable *hashtable)
{
struct t_script_callback *script_callback;
- void *lua_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = (info_name) ? (char *)info_name : empty_arg;
- lua_argv[2] = hashtable;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
+ func_argv[2] = hashtable;
return (struct t_hashtable *)weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
script_callback->function,
- "ssh", lua_argv);
+ "ssh", func_argv);
}
return NULL;
@@ -4643,24 +3429,10 @@ weechat_lua_api_hook_info_hashtable (lua_State *L)
const char *info_name, *description, *args_description;
const char *output_description, *function, *data;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_info_hashtable");
- LUA_RETURN_EMPTY;
- }
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 6)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hook_info_hashtable");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "hook_info_hashtable", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 6)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
info_name = lua_tostring (lua_current_interpreter, -6);
description = lua_tostring (lua_current_interpreter, -5);
@@ -4679,7 +3451,7 @@ weechat_lua_api_hook_info_hashtable (lua_State *L)
function,
data));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4691,7 +3463,7 @@ weechat_lua_api_hook_infolist_cb (void *data, const char *info_name,
void *pointer, const char *arguments)
{
struct t_script_callback *script_callback;
- void *lua_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' };
struct t_infolist *result;
@@ -4699,18 +3471,18 @@ weechat_lua_api_hook_infolist_cb (void *data, const char *info_name,
if (script_callback && script_callback->function && script_callback->function[0])
{
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = (info_name) ? (char *)info_name : empty_arg;
- lua_argv[2] = script_ptr2str (pointer);
- lua_argv[3] = (arguments) ? (char *)arguments : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
+ func_argv[2] = script_ptr2str (pointer);
+ func_argv[3] = (arguments) ? (char *)arguments : empty_arg;
result = (struct t_infolist *)weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
- "ssss", lua_argv);
+ "ssss", func_argv);
- if (lua_argv[2])
- free (lua_argv[2]);
+ if (func_argv[2])
+ free (func_argv[2]);
return result;
}
@@ -4728,24 +3500,10 @@ weechat_lua_api_hook_infolist (lua_State *L)
const char *infolist_name, *description, *pointer_description;
const char *args_description, *function, *data;
char *result;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_infolist");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 6)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hook_infolist");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "hook_infolist", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 6)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
infolist_name = lua_tostring (lua_current_interpreter, -6);
description = lua_tostring (lua_current_interpreter, -5);
@@ -4764,7 +3522,7 @@ weechat_lua_api_hook_infolist (lua_State *L)
function,
data));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4776,20 +3534,20 @@ weechat_lua_api_hook_focus_cb (void *data,
struct t_hashtable *info)
{
struct t_script_callback *script_callback;
- void *lua_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = info;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = info;
return (struct t_hashtable *)weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
script_callback->function,
- "sh", lua_argv);
+ "sh", func_argv);
}
return NULL;
@@ -4804,24 +3562,10 @@ weechat_lua_api_hook_focus (lua_State *L)
{
const char *area, *function, *data;
char *result;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_focus");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hook_focus");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "hook_focus", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
area = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
@@ -4834,7 +3578,7 @@ weechat_lua_api_hook_focus (lua_State *L)
function,
data));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4845,24 +3589,10 @@ static int
weechat_lua_api_unhook (lua_State *L)
{
const char *hook;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "unhook");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "unhook");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "unhook", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_ERROR);
hook = lua_tostring (lua_current_interpreter, -1);
@@ -4870,7 +3600,7 @@ weechat_lua_api_unhook (lua_State *L)
lua_current_script,
script_str2ptr (hook));
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4880,18 +3610,11 @@ weechat_lua_api_unhook (lua_State *L)
static int
weechat_lua_api_unhook_all (lua_State *L)
{
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "unhook_all");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "unhook_all", API_RETURN_ERROR);
script_api_unhook_all (lua_current_script);
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4903,7 +3626,7 @@ weechat_lua_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
const char *input_data)
{
struct t_script_callback *script_callback;
- void *lua_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -4911,14 +3634,14 @@ weechat_lua_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
if (script_callback && script_callback->function && script_callback->function[0])
{
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = script_ptr2str (buffer);
- lua_argv[2] = (input_data) ? (char *)input_data : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (buffer);
+ func_argv[2] = (input_data) ? (char *)input_data : empty_arg;
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", lua_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -4927,8 +3650,8 @@ weechat_lua_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
ret = *rc;
free (rc);
}
- if (lua_argv[1])
- free (lua_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -4944,7 +3667,7 @@ int
weechat_lua_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
{
struct t_script_callback *script_callback;
- void *lua_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -4952,13 +3675,13 @@ weechat_lua_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
if (script_callback && script_callback->function && script_callback->function[0])
{
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = script_ptr2str (buffer);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (buffer);
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", lua_argv);
+ "ss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -4967,8 +3690,8 @@ weechat_lua_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
ret = *rc;
free (rc);
}
- if (lua_argv[1])
- free (lua_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -4986,24 +3709,10 @@ weechat_lua_api_buffer_new (lua_State *L)
const char *name, *function_input, *data_input, *function_close;
const char *data_close;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "buffer_new");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 5)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "buffer_new");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "buffer_new", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 5)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
name = lua_tostring (lua_current_interpreter, -5);
function_input = lua_tostring (lua_current_interpreter, -4);
@@ -5021,7 +3730,7 @@ weechat_lua_api_buffer_new (lua_State *L)
function_close,
data_close));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5033,31 +3742,17 @@ weechat_lua_api_buffer_search (lua_State *L)
{
const char *plugin, *name;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "buffer_search");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "buffer_search");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "buffer_search", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
plugin = lua_tostring (lua_current_interpreter, -2);
name = lua_tostring (lua_current_interpreter, -1);
result = script_ptr2str (weechat_buffer_search (plugin, name));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5069,18 +3764,11 @@ weechat_lua_api_buffer_search_main (lua_State *L)
{
char *result;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "buffer_search_main");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "buffer_search_main", API_RETURN_EMPTY);
result = script_ptr2str (weechat_buffer_search_main ());
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5092,18 +3780,11 @@ weechat_lua_api_current_buffer (lua_State *L)
{
char *result;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "current_buffer");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "current_buffer", API_RETURN_EMPTY);
result = script_ptr2str (weechat_current_buffer ());
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5114,30 +3795,16 @@ static int
weechat_lua_api_buffer_clear (lua_State *L)
{
const char *buffer;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "buffer_clear");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "buffer_clear");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "buffer_clear", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = lua_tostring (lua_current_interpreter, -1);
weechat_buffer_clear (script_str2ptr (buffer));
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5148,24 +3815,10 @@ static int
weechat_lua_api_buffer_close (lua_State *L)
{
const char *buffer;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "buffer_close");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "buffer_close");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "buffer_close", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = lua_tostring (lua_current_interpreter, -1);
@@ -5173,7 +3826,7 @@ weechat_lua_api_buffer_close (lua_State *L)
lua_current_script,
script_str2ptr (buffer));
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5184,24 +3837,10 @@ static int
weechat_lua_api_buffer_merge (lua_State *L)
{
const char *buffer, *target_buffer;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "buffer_merge");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "buffer_merge");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "buffer_merge", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = lua_tostring (lua_current_interpreter, -2);
target_buffer = lua_tostring (lua_current_interpreter, -1);
@@ -5209,7 +3848,7 @@ weechat_lua_api_buffer_merge (lua_State *L)
weechat_buffer_merge (script_str2ptr (buffer),
script_str2ptr (target_buffer));
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5221,31 +3860,18 @@ static int
weechat_lua_api_buffer_unmerge (lua_State *L)
{
const char *buffer;
- int n, number;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "buffer_unmerge");
- LUA_RETURN_ERROR;
- }
+ int number;
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "buffer_unmerge");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "buffer_unmerge", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = lua_tostring (lua_current_interpreter, -2);
number = lua_tonumber (lua_current_interpreter, -1);
weechat_buffer_unmerge (script_str2ptr (buffer), number);
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5256,24 +3882,11 @@ static int
weechat_lua_api_buffer_get_integer (lua_State *L)
{
const char *buffer, *property;
- int n, value;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "buffer_get_integer");
- LUA_RETURN_INT(-1);
- }
-
- n = lua_gettop (lua_current_interpreter);
+ int value;
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "buffer_get_integer");
- LUA_RETURN_INT(-1);
- }
+ API_FUNC(1, "buffer_get_integer", API_RETURN_INT(-1));
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_INT(-1));
buffer = lua_tostring (lua_current_interpreter, -2);
property = lua_tostring (lua_current_interpreter, -1);
@@ -5281,7 +3894,7 @@ weechat_lua_api_buffer_get_integer (lua_State *L)
value = weechat_buffer_get_integer (script_str2ptr (buffer),
property);
- LUA_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -5292,24 +3905,10 @@ static int
weechat_lua_api_buffer_get_string (lua_State *L)
{
const char *buffer, *property, *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "buffer_get_string");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "buffer_get_string");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "buffer_get_string", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = lua_tostring (lua_current_interpreter, -2);
property = lua_tostring (lua_current_interpreter, -1);
@@ -5317,7 +3916,7 @@ weechat_lua_api_buffer_get_string (lua_State *L)
result = weechat_buffer_get_string (script_str2ptr (buffer),
property);
- LUA_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -5329,24 +3928,10 @@ weechat_lua_api_buffer_get_pointer (lua_State *L)
{
const char *buffer, *property;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "buffer_get_pointer");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "buffer_get_pointer");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "buffer_get_pointer", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = lua_tostring (lua_current_interpreter, -2);
property = lua_tostring (lua_current_interpreter, -1);
@@ -5354,7 +3939,7 @@ weechat_lua_api_buffer_get_pointer (lua_State *L)
result = script_ptr2str (weechat_buffer_get_pointer (script_str2ptr (buffer),
property));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5365,24 +3950,10 @@ static int
weechat_lua_api_buffer_set (lua_State *L)
{
const char *buffer, *property, *value;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "buffer_set");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "buffer_set");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "buffer_set", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = lua_tostring (lua_current_interpreter, -3);
property = lua_tostring (lua_current_interpreter, -2);
@@ -5390,7 +3961,7 @@ weechat_lua_api_buffer_set (lua_State *L)
weechat_buffer_set (script_str2ptr (buffer), property, value);
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5403,31 +3974,17 @@ weechat_lua_api_buffer_string_replace_local_var (lua_State *L)
{
const char *buffer, *string;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "buffer_string_replace_local_var");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "buffer_string_replace_local_var");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "buffer_string_replace_local_var", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = lua_tostring (lua_current_interpreter, -2);
string = lua_tostring (lua_current_interpreter, -1);
result = weechat_buffer_string_replace_local_var (script_str2ptr (buffer), string);
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5438,24 +3995,11 @@ static int
weechat_lua_api_buffer_match_list (lua_State *L)
{
const char *buffer, *string;
- int n, value;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "buffer_match_list");
- LUA_RETURN_INT(0);
- }
+ int value;
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "buffer_match_list");
- LUA_RETURN_INT(0);
- }
+ API_FUNC(1, "buffer_match_list", API_RETURN_INT(0));
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_INT(0));
buffer = lua_tostring (lua_current_interpreter, -2);
string = lua_tostring (lua_current_interpreter, -1);
@@ -5463,7 +4007,7 @@ weechat_lua_api_buffer_match_list (lua_State *L)
value = weechat_buffer_match_list (script_str2ptr (buffer),
string);
- LUA_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -5475,18 +4019,11 @@ weechat_lua_api_current_window (lua_State *L)
{
char *result;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "current_window");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "current_window", API_RETURN_EMPTY);
result = script_ptr2str (weechat_current_window ());
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5499,30 +4036,16 @@ weechat_lua_api_window_search_with_buffer (lua_State *L)
{
const char *buffer;
char *result;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "window_search_with_buffer");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "window_search_with_buffer");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "window_search_with_buffer", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = lua_tostring (lua_current_interpreter, -1);
result = script_ptr2str (weechat_window_search_with_buffer (script_str2ptr (buffer)));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5533,24 +4056,11 @@ static int
weechat_lua_api_window_get_integer (lua_State *L)
{
const char *window, *property;
- int n, value;
+ int value;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "window_get_integer");
- LUA_RETURN_INT(-1);
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "window_get_integer");
- LUA_RETURN_INT(-1);
- }
+ API_FUNC(1, "window_get_integer", API_RETURN_INT(-1));
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_INT(-1));
window = lua_tostring (lua_current_interpreter, -2);
property = lua_tostring (lua_current_interpreter, -1);
@@ -5558,7 +4068,7 @@ weechat_lua_api_window_get_integer (lua_State *L)
value = weechat_window_get_integer (script_str2ptr (window),
property);
- LUA_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -5569,24 +4079,10 @@ static int
weechat_lua_api_window_get_string (lua_State *L)
{
const char *window, *property, *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "window_get_string");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "window_get_string");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "window_get_string", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
window = lua_tostring (lua_current_interpreter, -2);
property = lua_tostring (lua_current_interpreter, -1);
@@ -5594,7 +4090,7 @@ weechat_lua_api_window_get_string (lua_State *L)
result = weechat_window_get_string (script_str2ptr (window),
property);
- LUA_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -5606,24 +4102,10 @@ weechat_lua_api_window_get_pointer (lua_State *L)
{
const char *window, *property;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "window_get_pointer");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "window_get_pointer");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "window_get_pointer", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
window = lua_tostring (lua_current_interpreter, -2);
property = lua_tostring (lua_current_interpreter, -1);
@@ -5631,7 +4113,7 @@ weechat_lua_api_window_get_pointer (lua_State *L)
result = script_ptr2str (weechat_window_get_pointer (script_str2ptr (window),
property));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5642,30 +4124,16 @@ static int
weechat_lua_api_window_set_title (lua_State *L)
{
const char *title;
- int n;
-
- /* make C compiler happy */
- (void) L;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "window_set_title");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "window_set_title");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "window_set_title", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_ERROR);
title = lua_tostring (lua_current_interpreter, -1);
weechat_window_set_title (title);
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5677,24 +4145,11 @@ weechat_lua_api_nicklist_add_group (lua_State *L)
{
const char *buffer, *parent_group, *name, *color;
char *result;
- int n, visible;
-
- /* make C compiler happy */
- (void) L;
+ int visible;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_add_group");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 5)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "nicklist_add_group");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "nicklist_add_group", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 5)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = lua_tostring (lua_current_interpreter, -5);
parent_group = lua_tostring (lua_current_interpreter, -4);
@@ -5708,7 +4163,7 @@ weechat_lua_api_nicklist_add_group (lua_State *L)
color,
visible));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5720,24 +4175,10 @@ weechat_lua_api_nicklist_search_group (lua_State *L)
{
const char *buffer, *from_group, *name;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_search_group");
- LUA_RETURN_EMPTY;
- }
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "nicklist_search_group");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "nicklist_search_group", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = lua_tostring (lua_current_interpreter, -3);
from_group = lua_tostring (lua_current_interpreter, -2);
@@ -5747,7 +4188,7 @@ weechat_lua_api_nicklist_search_group (lua_State *L)
script_str2ptr (from_group),
name));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5759,24 +4200,11 @@ weechat_lua_api_nicklist_add_nick (lua_State *L)
{
const char *buffer, *group, *name, *color, *prefix, *prefix_color;
char *result;
- int n, visible;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_add_nick");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
+ int visible;
- if (n < 7)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "nicklist_add_nick");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "nicklist_add_nick", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 7)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = lua_tostring (lua_current_interpreter, -7);
group = lua_tostring (lua_current_interpreter, -6);
@@ -5794,7 +4222,7 @@ weechat_lua_api_nicklist_add_nick (lua_State *L)
prefix_color,
visible));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5806,24 +4234,10 @@ weechat_lua_api_nicklist_search_nick (lua_State *L)
{
const char *buffer, *from_group, *name;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_search_nick");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "nicklist_search_nick");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "nicklist_search_nick", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = lua_tostring (lua_current_interpreter, -3);
from_group = lua_tostring (lua_current_interpreter, -2);
@@ -5833,7 +4247,7 @@ weechat_lua_api_nicklist_search_nick (lua_State *L)
script_str2ptr (from_group),
name));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5844,24 +4258,10 @@ static int
weechat_lua_api_nicklist_remove_group (lua_State *L)
{
const char *buffer, *group;
- int n;
-
- /* make C compiler happy */
- (void) L;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_remove_group");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "nicklist_remove_group");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "nicklist_remove_group", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = lua_tostring (lua_current_interpreter, -3);
group = lua_tostring (lua_current_interpreter, -2);
@@ -5869,7 +4269,7 @@ weechat_lua_api_nicklist_remove_group (lua_State *L)
weechat_nicklist_remove_group (script_str2ptr (buffer),
script_str2ptr (group));
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5880,24 +4280,10 @@ static int
weechat_lua_api_nicklist_remove_nick (lua_State *L)
{
const char *buffer, *nick;
- int n;
-
- /* make C compiler happy */
- (void) L;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_remove_nick");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "nicklist_remove_nick");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "nicklist_remove_nick", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = lua_tostring (lua_current_interpreter, -3);
nick = lua_tostring (lua_current_interpreter, -2);
@@ -5905,7 +4291,7 @@ weechat_lua_api_nicklist_remove_nick (lua_State *L)
weechat_nicklist_remove_nick (script_str2ptr (buffer),
script_str2ptr (nick));
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5916,30 +4302,16 @@ static int
weechat_lua_api_nicklist_remove_all (lua_State *L)
{
const char *buffer;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_remove_all");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "nicklist_remove_all");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "nicklist_remove_all", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = lua_tostring (lua_current_interpreter, -3);
weechat_nicklist_remove_all (script_str2ptr (buffer));
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5950,24 +4322,11 @@ static int
weechat_lua_api_nicklist_group_get_integer (lua_State *L)
{
const char *buffer, *group, *property;
- int n, value;
+ int value;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_group_get_integer");
- LUA_RETURN_INT(-1);
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "nicklist_group_get_integer");
- LUA_RETURN_INT(-1);
- }
+ API_FUNC(1, "nicklist_group_get_integer", API_RETURN_INT(-1));
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_INT(-1));
buffer = lua_tostring (lua_current_interpreter, -3);
group = lua_tostring (lua_current_interpreter, -2);
@@ -5977,7 +4336,7 @@ weechat_lua_api_nicklist_group_get_integer (lua_State *L)
script_str2ptr (group),
property);
- LUA_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -5988,24 +4347,10 @@ static int
weechat_lua_api_nicklist_group_get_string (lua_State *L)
{
const char *buffer, *group, *property, *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_group_get_string");
- LUA_RETURN_EMPTY;
- }
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "nicklist_group_get_string");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "nicklist_group_get_string", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = lua_tostring (lua_current_interpreter, -3);
group = lua_tostring (lua_current_interpreter, -2);
@@ -6015,7 +4360,7 @@ weechat_lua_api_nicklist_group_get_string (lua_State *L)
script_str2ptr (group),
property);
- LUA_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -6027,24 +4372,10 @@ weechat_lua_api_nicklist_group_get_pointer (lua_State *L)
{
const char *buffer, *group, *property;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_group_get_pointer");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "nicklist_group_get_pointer");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "nicklist_group_get_pointer", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = lua_tostring (lua_current_interpreter, -3);
group = lua_tostring (lua_current_interpreter, -2);
@@ -6054,7 +4385,7 @@ weechat_lua_api_nicklist_group_get_pointer (lua_State *L)
script_str2ptr (group),
property));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6065,24 +4396,10 @@ static int
weechat_lua_api_nicklist_group_set (lua_State *L)
{
const char *buffer, *group, *property, *value;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_group_set");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "nicklist_group_set");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "nicklist_group_set", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 4)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = lua_tostring (lua_current_interpreter, -4);
group = lua_tostring (lua_current_interpreter, -3);
@@ -6094,7 +4411,7 @@ weechat_lua_api_nicklist_group_set (lua_State *L)
property,
value);
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6105,24 +4422,11 @@ static int
weechat_lua_api_nicklist_nick_get_integer (lua_State *L)
{
const char *buffer, *nick, *property;
- int n, value;
-
- /* make C compiler happy */
- (void) L;
+ int value;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_nick_get_integer");
- LUA_RETURN_INT(-1);
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "nicklist_nick_get_integer");
- LUA_RETURN_INT(-1);
- }
+ API_FUNC(1, "nicklist_nick_get_integer", API_RETURN_INT(-1));
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_INT(-1));
buffer = lua_tostring (lua_current_interpreter, -3);
nick = lua_tostring (lua_current_interpreter, -2);
@@ -6132,7 +4436,7 @@ weechat_lua_api_nicklist_nick_get_integer (lua_State *L)
script_str2ptr (nick),
property);
- LUA_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -6143,24 +4447,10 @@ static int
weechat_lua_api_nicklist_nick_get_string (lua_State *L)
{
const char *buffer, *nick, *property, *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_nick_get_string");
- LUA_RETURN_EMPTY;
- }
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "nicklist_nick_get_string");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "nicklist_nick_get_string", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = lua_tostring (lua_current_interpreter, -3);
nick = lua_tostring (lua_current_interpreter, -2);
@@ -6170,7 +4460,7 @@ weechat_lua_api_nicklist_nick_get_string (lua_State *L)
script_str2ptr (nick),
property);
- LUA_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -6182,24 +4472,10 @@ weechat_lua_api_nicklist_nick_get_pointer (lua_State *L)
{
const char *buffer, *nick, *property;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_nick_get_pointer");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "nicklist_nick_get_pointer");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "nicklist_nick_get_pointer", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = lua_tostring (lua_current_interpreter, -3);
nick = lua_tostring (lua_current_interpreter, -2);
@@ -6209,7 +4485,7 @@ weechat_lua_api_nicklist_nick_get_pointer (lua_State *L)
script_str2ptr (nick),
property));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6220,24 +4496,10 @@ static int
weechat_lua_api_nicklist_nick_set (lua_State *L)
{
const char *buffer, *nick, *property, *value;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_nick_set");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "nicklist_nick_set");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "nicklist_nick_set", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 4)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = lua_tostring (lua_current_interpreter, -4);
nick = lua_tostring (lua_current_interpreter, -3);
@@ -6249,7 +4511,7 @@ weechat_lua_api_nicklist_nick_set (lua_State *L)
property,
value);
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6261,30 +4523,16 @@ weechat_lua_api_bar_item_search (lua_State *L)
{
const char *name;
char *result;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "bar_item_search");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "bar_item_search");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "bar_item_search", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
name = lua_tostring (lua_current_interpreter, -1);
result = script_ptr2str (weechat_bar_item_search (name));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6296,26 +4544,26 @@ weechat_lua_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
{
struct t_script_callback *script_callback;
- void *lua_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' }, *ret;
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = script_ptr2str (item);
- lua_argv[2] = script_ptr2str (window);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (item);
+ func_argv[2] = script_ptr2str (window);
ret = (char *)weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
- "sss", lua_argv);
+ "sss", func_argv);
- if (lua_argv[1])
- free (lua_argv[1]);
- if (lua_argv[2])
- free (lua_argv[2]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[2])
+ free (func_argv[2]);
return ret;
}
@@ -6332,24 +4580,10 @@ weechat_lua_api_bar_item_new (lua_State *L)
{
const char *name, *function, *data;
char *result;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "bar_item_new");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "bar_item_new");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "bar_item_new", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
name = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
@@ -6362,7 +4596,7 @@ weechat_lua_api_bar_item_new (lua_State *L)
function,
data));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6373,30 +4607,16 @@ static int
weechat_lua_api_bar_item_update (lua_State *L)
{
const char *name;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "bar_item_update");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "bar_item_update");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "bar_item_update", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_ERROR);
name = lua_tostring (lua_current_interpreter, -1);
weechat_bar_item_update (name);
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6407,24 +4627,10 @@ static int
weechat_lua_api_bar_item_remove (lua_State *L)
{
const char *item;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "bar_item_remove");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "bar_item_remove");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "bar_item_remove", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_ERROR);
item = lua_tostring (lua_current_interpreter, -1);
@@ -6432,7 +4638,7 @@ weechat_lua_api_bar_item_remove (lua_State *L)
lua_current_script,
script_str2ptr (item));
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6444,30 +4650,16 @@ weechat_lua_api_bar_search (lua_State *L)
{
const char *name;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "bar_search");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "bar_search");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "bar_search", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
name = lua_tostring (lua_current_interpreter, -1);
result = script_ptr2str (weechat_bar_search (name));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6481,24 +4673,10 @@ weechat_lua_api_bar_new (lua_State *L)
const char *filling_top_bottom, *filling_left_right, *size, *size_max;
const char *color_fg, *color_delim, *color_bg, *separator, *items;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "bar_new");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 15)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "bar_new");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "bar_new", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 15)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
name = lua_tostring (lua_current_interpreter, -15);
hidden = lua_tostring (lua_current_interpreter, -14);
@@ -6532,7 +4710,7 @@ weechat_lua_api_bar_new (lua_State *L)
separator,
items));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6543,24 +4721,10 @@ static int
weechat_lua_api_bar_set (lua_State *L)
{
const char *bar, *property, *value;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "bar_set");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "bar_set");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "bar_set", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_ERROR);
bar = lua_tostring (lua_current_interpreter, -3);
property = lua_tostring (lua_current_interpreter, -2);
@@ -6570,7 +4734,7 @@ weechat_lua_api_bar_set (lua_State *L)
property,
value);
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6581,30 +4745,16 @@ static int
weechat_lua_api_bar_update (lua_State *L)
{
const char *name;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "bar_update");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "bar_update");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "bar_update", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_ERROR);
name = lua_tostring (lua_current_interpreter, -1);
weechat_bar_update (name);
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6615,30 +4765,16 @@ static int
weechat_lua_api_bar_remove (lua_State *L)
{
const char *bar;
- int n;
-
- /* make C compiler happy */
- (void) L;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "bar_remove");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "bar_remove");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "bar_remove", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_ERROR);
bar = lua_tostring (lua_current_interpreter, -1);
weechat_bar_remove (script_str2ptr (bar));
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6649,24 +4785,10 @@ static int
weechat_lua_api_command (lua_State *L)
{
const char *buffer, *command;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "command");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "command");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "command", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = lua_tostring (lua_current_interpreter, -2);
command = lua_tostring (lua_current_interpreter, -1);
@@ -6676,7 +4798,7 @@ weechat_lua_api_command (lua_State *L)
script_str2ptr (buffer),
command);
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6687,31 +4809,17 @@ static int
weechat_lua_api_info_get (lua_State *L)
{
const char *info_name, *arguments, *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "info_get");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "info_get");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "info_get", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
info_name = lua_tostring (lua_current_interpreter, -2);
arguments = lua_tostring (lua_current_interpreter, -1);
result = weechat_info_get (info_name, arguments);
- LUA_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -6723,24 +4831,10 @@ weechat_lua_api_info_get_hashtable (lua_State *L)
{
const char *info_name;
struct t_hashtable *table, *result_hashtable;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "info_get_hashtable");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "info_get_hashtable");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "info_get_hashtable", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
info_name = lua_tostring (lua_current_interpreter, -2);
table = weechat_lua_tohashtable (lua_current_interpreter, -1,
@@ -6767,18 +4861,11 @@ weechat_lua_api_infolist_new (lua_State *L)
{
char *result;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "infolist_new");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "infolist_new", API_RETURN_EMPTY);
result = script_ptr2str (weechat_infolist_new ());
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6790,30 +4877,16 @@ weechat_lua_api_infolist_new_item (lua_State *L)
{
const char *infolist;
char *result;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "infolist_new_item");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "infolist_new_item");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "infolist_new_item", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
infolist = lua_tostring (lua_current_interpreter, -1);
result = script_ptr2str (weechat_infolist_new_item (script_str2ptr (infolist)));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6826,24 +4899,11 @@ weechat_lua_api_infolist_new_var_integer (lua_State *L)
{
const char *infolist, *name;
char *result;
- int n, value;
+ int value;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "infolist_new_var_integer");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "infolist_new_var_integer");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "infolist_new_var_integer", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
infolist = lua_tostring (lua_current_interpreter, -3);
name = lua_tostring (lua_current_interpreter, -2);
@@ -6853,7 +4913,7 @@ weechat_lua_api_infolist_new_var_integer (lua_State *L)
name,
value));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6866,24 +4926,10 @@ weechat_lua_api_infolist_new_var_string (lua_State *L)
{
const char *infolist, *name, *value;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "infolist_new_var_string");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "infolist_new_var_string");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "infolist_new_var_string", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
infolist = lua_tostring (lua_current_interpreter, -3);
name = lua_tostring (lua_current_interpreter, -2);
@@ -6893,7 +4939,7 @@ weechat_lua_api_infolist_new_var_string (lua_State *L)
name,
value));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6906,24 +4952,10 @@ weechat_lua_api_infolist_new_var_pointer (lua_State *L)
{
const char *infolist, *name, *value;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "infolist_new_var_pointer");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "infolist_new_var_pointer");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "infolist_new_var_pointer", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
infolist = lua_tostring (lua_current_interpreter, -3);
name = lua_tostring (lua_current_interpreter, -2);
@@ -6933,7 +4965,7 @@ weechat_lua_api_infolist_new_var_pointer (lua_State *L)
name,
script_str2ptr (value)));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6945,24 +4977,11 @@ weechat_lua_api_infolist_new_var_time (lua_State *L)
{
const char *infolist, *name;
char *result;
- int n, value;
+ int value;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "infolist_new_var_time");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "infolist_new_var_time");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "infolist_new_var_time", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
infolist = lua_tostring (lua_current_interpreter, -3);
name = lua_tostring (lua_current_interpreter, -2);
@@ -6972,7 +4991,7 @@ weechat_lua_api_infolist_new_var_time (lua_State *L)
name,
value));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6984,24 +5003,10 @@ weechat_lua_api_infolist_get (lua_State *L)
{
const char *name, *pointer, *arguments;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "infolist_get");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "infolist_get");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "infolist_get", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
name = lua_tostring (lua_current_interpreter, -3);
pointer = lua_tostring (lua_current_interpreter, -2);
@@ -7011,7 +5016,7 @@ weechat_lua_api_infolist_get (lua_State *L)
script_str2ptr (pointer),
arguments));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7022,30 +5027,17 @@ static int
weechat_lua_api_infolist_next (lua_State *L)
{
const char *infolist;
- int n, value;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "infolist_next");
- LUA_RETURN_INT(0);
- }
-
- n = lua_gettop (lua_current_interpreter);
+ int value;
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "infolist_next");
- LUA_RETURN_INT(0);
- }
+ API_FUNC(1, "infolist_next", API_RETURN_INT(0));
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_INT(0));
infolist = lua_tostring (lua_current_interpreter, -1);
value = weechat_infolist_next (script_str2ptr (infolist));
- LUA_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -7056,30 +5048,17 @@ static int
weechat_lua_api_infolist_prev (lua_State *L)
{
const char *infolist;
- int n, value;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "infolist_prev");
- LUA_RETURN_INT(0);
- }
-
- n = lua_gettop (lua_current_interpreter);
+ int value;
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "infolist_prev");
- LUA_RETURN_INT(0);
- }
+ API_FUNC(1, "infolist_prev", API_RETURN_INT(0));
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_INT(0));
infolist = lua_tostring (lua_current_interpreter, -1);
value = weechat_infolist_prev (script_str2ptr (infolist));
- LUA_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -7091,30 +5070,16 @@ static int
weechat_lua_api_infolist_reset_item_cursor (lua_State *L)
{
const char *infolist;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "infolist_reset_item_cursor");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "infolist_reset_item_cursor");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "infolist_reset_item_cursor", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_ERROR);
infolist = lua_tostring (lua_current_interpreter, -1);
weechat_infolist_reset_item_cursor (script_str2ptr (infolist));
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -7125,30 +5090,16 @@ static int
weechat_lua_api_infolist_fields (lua_State *L)
{
const char *infolist, *result;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "infolist_fields");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "infolist_fields");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "infolist_fields", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
infolist = lua_tostring (lua_current_interpreter, -1);
result = weechat_infolist_fields (script_str2ptr (infolist));
- LUA_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -7159,24 +5110,11 @@ static int
weechat_lua_api_infolist_integer (lua_State *L)
{
const char *infolist, *variable;
- int n, value;
+ int value;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "infolist_integer");
- LUA_RETURN_INT(0);
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "infolist_integer");
- LUA_RETURN_INT(0);
- }
+ API_FUNC(1, "infolist_integer", API_RETURN_INT(0));
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_INT(0));
infolist = lua_tostring (lua_current_interpreter, -2);
variable = lua_tostring (lua_current_interpreter, -1);
@@ -7184,7 +5122,7 @@ weechat_lua_api_infolist_integer (lua_State *L)
value = weechat_infolist_integer (script_str2ptr (infolist),
variable);
- LUA_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -7195,24 +5133,10 @@ static int
weechat_lua_api_infolist_string (lua_State *L)
{
const char *infolist, *variable, *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "infolist_string");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "infolist_string");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "infolist_string", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
infolist = lua_tostring (lua_current_interpreter, -2);
variable = lua_tostring (lua_current_interpreter, -1);
@@ -7220,7 +5144,7 @@ weechat_lua_api_infolist_string (lua_State *L)
result = weechat_infolist_string (script_str2ptr (infolist),
variable);
- LUA_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -7232,24 +5156,10 @@ weechat_lua_api_infolist_pointer (lua_State *L)
{
const char *infolist, *variable;
char *result;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "infolist_pointer");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "infolist_pointer");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "infolist_pointer", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
infolist = lua_tostring (lua_current_interpreter, -2);
variable = lua_tostring (lua_current_interpreter, -1);
@@ -7257,7 +5167,7 @@ weechat_lua_api_infolist_pointer (lua_State *L)
result = script_ptr2str (weechat_infolist_pointer (script_str2ptr (infolist),
variable));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7270,24 +5180,10 @@ weechat_lua_api_infolist_time (lua_State *L)
const char *infolist, *variable;
time_t time;
char timebuffer[64], *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "infolist_time");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "infolist_time");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "infolist_time", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
infolist = lua_tostring (lua_current_interpreter, -2);
variable = lua_tostring (lua_current_interpreter, -1);
@@ -7297,7 +5193,7 @@ weechat_lua_api_infolist_time (lua_State *L)
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
result = strdup (timebuffer);
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7308,30 +5204,16 @@ static int
weechat_lua_api_infolist_free (lua_State *L)
{
const char *infolist;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "infolist_free");
- LUA_RETURN_ERROR;
- }
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "infolist_free");
- LUA_RETURN_ERROR;
- }
+ API_FUNC(1, "infolist_free", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_ERROR);
infolist = lua_tostring (lua_current_interpreter, -1);
weechat_infolist_free (script_str2ptr (infolist));
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -7343,30 +5225,16 @@ weechat_lua_api_hdata_get (lua_State *L)
{
const char *name;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hdata_get");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hdata_get");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "hdata_get", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
name = lua_tostring (lua_current_interpreter, -1);
result = script_ptr2str (weechat_hdata_get (name));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7377,31 +5245,18 @@ static int
weechat_lua_api_hdata_get_var_offset (lua_State *L)
{
const char *hdata, *name;
- int n, value;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hdata_get_var_offset");
- LUA_RETURN_INT(0);
- }
-
- n = lua_gettop (lua_current_interpreter);
+ int value;
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hdata_get_var_offset");
- LUA_RETURN_INT(0);
- }
+ API_FUNC(1, "hdata_get_var_offset", API_RETURN_INT(0));
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_INT(0));
hdata = lua_tostring (lua_current_interpreter, -2);
name = lua_tostring (lua_current_interpreter, -1);
value = weechat_hdata_get_var_offset (script_str2ptr (hdata), name);
- LUA_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -7413,31 +5268,17 @@ static int
weechat_lua_api_hdata_get_var_type_string (lua_State *L)
{
const char *hdata, *name, *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hdata_get_var_type_string");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hdata_get_var_type_string");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "hdata_get_var_type_string", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
hdata = lua_tostring (lua_current_interpreter, -2);
name = lua_tostring (lua_current_interpreter, -1);
result = weechat_hdata_get_var_type_string (script_str2ptr (hdata), name);
- LUA_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -7448,31 +5289,17 @@ static int
weechat_lua_api_hdata_get_var_hdata (lua_State *L)
{
const char *hdata, *name, *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hdata_get_var_hdata");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hdata_get_var_hdata");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "hdata_get_var_hdata", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
hdata = lua_tostring (lua_current_interpreter, -2);
name = lua_tostring (lua_current_interpreter, -1);
result = weechat_hdata_get_var_hdata (script_str2ptr (hdata), name);
- LUA_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -7484,24 +5311,10 @@ weechat_lua_api_hdata_get_list (lua_State *L)
{
const char *hdata, *name;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hdata_get_list");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hdata_get_list");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "hdata_get_list", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
hdata = lua_tostring (lua_current_interpreter, -2);
name = lua_tostring (lua_current_interpreter, -1);
@@ -7509,7 +5322,7 @@ weechat_lua_api_hdata_get_list (lua_State *L)
result = script_ptr2str (weechat_hdata_get_list (script_str2ptr (hdata),
name));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7521,24 +5334,11 @@ weechat_lua_api_hdata_move (lua_State *L)
{
const char *hdata, *pointer;
char *result;
- int count, n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hdata_move");
- LUA_RETURN_EMPTY;
- }
+ int count;
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hdata_move");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "hdata_move", 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);
@@ -7548,7 +5348,7 @@ weechat_lua_api_hdata_move (lua_State *L)
script_str2ptr (pointer),
count));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7560,24 +5360,11 @@ static int
weechat_lua_api_hdata_integer (lua_State *L)
{
const char *hdata, *pointer, *name;
- int n, value;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hdata_integer");
- LUA_RETURN_INT(0);
- }
+ int value;
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hdata_integer");
- LUA_RETURN_INT(0);
- }
+ API_FUNC(1, "hdata_integer", API_RETURN_INT(0));
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_INT(0));
hdata = lua_tostring (lua_current_interpreter, -3);
pointer = lua_tostring (lua_current_interpreter, -2);
@@ -7587,7 +5374,7 @@ weechat_lua_api_hdata_integer (lua_State *L)
script_str2ptr (pointer),
name);
- LUA_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -7600,24 +5387,10 @@ weechat_lua_api_hdata_long (lua_State *L)
{
const char *hdata, *pointer, *name;
long value;
- int n;
-
- /* make C compiler happy */
- (void) L;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hdata_long");
- LUA_RETURN_LONG(0);
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hdata_long");
- LUA_RETURN_LONG(0);
- }
+ API_FUNC(1, "hdata_long", API_RETURN_LONG(0));
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_LONG(0));
hdata = lua_tostring (lua_current_interpreter, -3);
pointer = lua_tostring (lua_current_interpreter, -2);
@@ -7627,7 +5400,7 @@ weechat_lua_api_hdata_long (lua_State *L)
script_str2ptr (pointer),
name);
- LUA_RETURN_LONG(value);
+ API_RETURN_LONG(value);
}
/*
@@ -7639,24 +5412,10 @@ static int
weechat_lua_api_hdata_string (lua_State *L)
{
const char *hdata, *pointer, *name, *result;
- int n;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hdata_string");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hdata_string");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "hdata_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);
@@ -7666,7 +5425,7 @@ weechat_lua_api_hdata_string (lua_State *L)
script_str2ptr (pointer),
name);
- LUA_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -7679,24 +5438,10 @@ weechat_lua_api_hdata_pointer (lua_State *L)
{
const char *hdata, *pointer, *name;
char *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hdata_pointer");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hdata_pointer");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "hdata_pointer", 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);
@@ -7706,7 +5451,7 @@ weechat_lua_api_hdata_pointer (lua_State *L)
script_str2ptr (pointer),
name));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7720,24 +5465,10 @@ weechat_lua_api_hdata_time (lua_State *L)
const char *hdata, *pointer, *name;
time_t time;
char timebuffer[64], *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hdata_time");
- LUA_RETURN_EMPTY;
- }
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hdata_time");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "hdata_time", 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);
@@ -7749,7 +5480,7 @@ weechat_lua_api_hdata_time (lua_State *L)
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
result = strdup (timebuffer);
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7760,31 +5491,17 @@ static int
weechat_lua_api_hdata_get_string (lua_State *L)
{
const char *hdata, *property, *result;
- int n;
-
- /* make C compiler happy */
- (void) L;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hdata_get_string");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hdata_get_string");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "hdata_get_string", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
hdata = lua_tostring (lua_current_interpreter, -2);
property = lua_tostring (lua_current_interpreter, -1);
result = weechat_hdata_get_string (script_str2ptr (hdata), property);
- LUA_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -7796,31 +5513,18 @@ weechat_lua_api_upgrade_new (lua_State *L)
{
const char *filename;
char *result;
- int n, write;
+ int write;
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "upgrade_new");
- LUA_RETURN_EMPTY;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "upgrade_new");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "upgrade_new", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 2)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
filename = lua_tostring (lua_current_interpreter, -2);
write = lua_tonumber (lua_current_interpreter, -1);
result = script_ptr2str (weechat_upgrade_new (filename, write));
- LUA_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7831,24 +5535,11 @@ static int
weechat_lua_api_upgrade_write_object (lua_State *L)
{
const char *upgrade_file, *infolist;
- int n, object_id, rc;
-
- /* make C compiler happy */
- (void) L;
+ int object_id, rc;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "upgrade_write_object");
- LUA_RETURN_INT(0);
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "upgrade_write_object");
- LUA_RETURN_INT(0);
- }
+ API_FUNC(1, "upgrade_write_object", API_RETURN_INT(0));
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_INT(0));
upgrade_file = lua_tostring (lua_current_interpreter, -3);
object_id = lua_tonumber (lua_current_interpreter, -2);
@@ -7858,7 +5549,7 @@ weechat_lua_api_upgrade_write_object (lua_State *L)
object_id,
script_str2ptr (infolist));
- LUA_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -7872,7 +5563,7 @@ weechat_lua_api_upgrade_read_cb (void *data,
struct t_infolist *infolist)
{
struct t_script_callback *script_callback;
- void *lua_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' }, str_object_id[32];
int *rc, ret;
@@ -7882,15 +5573,15 @@ weechat_lua_api_upgrade_read_cb (void *data,
{
snprintf (str_object_id, sizeof (str_object_id), "%d", object_id);
- lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- lua_argv[1] = script_ptr2str (upgrade_file);
- lua_argv[2] = str_object_id;
- lua_argv[3] = script_ptr2str (infolist);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (upgrade_file);
+ func_argv[2] = str_object_id;
+ func_argv[3] = script_ptr2str (infolist);
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ssss", lua_argv);
+ "ssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -7899,10 +5590,10 @@ weechat_lua_api_upgrade_read_cb (void *data,
ret = *rc;
free (rc);
}
- if (lua_argv[1])
- free (lua_argv[1]);
- if (lua_argv[3])
- free (lua_argv[3]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[3])
+ free (func_argv[3]);
return ret;
}
@@ -7918,24 +5609,11 @@ static int
weechat_lua_api_upgrade_read (lua_State *L)
{
const char *upgrade_file, *function, *data;
- int n, rc;
-
- /* make C compiler happy */
- (void) L;
-
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "upgrade_read");
- LUA_RETURN_EMPTY;
- }
+ int rc;
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "upgrade_read");
- LUA_RETURN_EMPTY;
- }
+ API_FUNC(1, "upgrade_read", API_RETURN_EMPTY);
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
upgrade_file = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
@@ -7948,7 +5626,7 @@ weechat_lua_api_upgrade_read (lua_State *L)
function,
data);
- LUA_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -7959,30 +5637,16 @@ static int
weechat_lua_api_upgrade_close (lua_State *L)
{
const char *upgrade_file;
- int n;
-
- /* make C compiler happy */
- (void) L;
- if (!lua_current_script || !lua_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "upgrade_close");
- LUA_RETURN_ERROR;
- }
-
- n = lua_gettop (lua_current_interpreter);
-
- if (n < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "upgrade_close");
- LUA_RETURN_INT(0);
- }
+ API_FUNC(1, "upgrade_close", API_RETURN_ERROR);
+ if (lua_gettop (lua_current_interpreter) < 1)
+ API_WRONG_ARGS(API_RETURN_INT(0));
upgrade_file = lua_tostring (lua_current_interpreter, -1);
weechat_upgrade_close (script_str2ptr (upgrade_file));
- LUA_RETURN_OK;
+ API_RETURN_OK;
}
/*
diff --git a/src/plugins/scripts/lua/weechat-lua.c b/src/plugins/scripts/lua/weechat-lua.c
index b555818fe..a4f4227f7 100644
--- a/src/plugins/scripts/lua/weechat-lua.c
+++ b/src/plugins/scripts/lua/weechat-lua.c
@@ -380,7 +380,7 @@ weechat_lua_load_cb (void *data, const char *filename)
void
weechat_lua_unload (struct t_plugin_script *script)
{
- int *r;
+ int *rc;
void *interpreter;
if ((weechat_lua_plugin->debug >= 1) || !lua_quiet)
@@ -392,12 +392,12 @@ weechat_lua_unload (struct t_plugin_script *script)
if (script->shutdown_func && script->shutdown_func[0])
{
- r = weechat_lua_exec (script,
- WEECHAT_SCRIPT_EXEC_INT,
- script->shutdown_func,
- NULL, NULL);
- if (r)
- free (r);
+ rc = (int *)weechat_lua_exec (script,
+ WEECHAT_SCRIPT_EXEC_INT,
+ script->shutdown_func,
+ NULL, NULL);
+ if (rc)
+ free (rc);
}
interpreter = script->interpreter;
diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c
index dfd4dd139..c1fa7cbba 100644
--- a/src/plugins/scripts/perl/weechat-perl-api.c
+++ b/src/plugins/scripts/perl/weechat-perl-api.c
@@ -36,10 +36,26 @@
#include "weechat-perl.h"
-#define PERL_RETURN_OK XSRETURN_YES
-#define PERL_RETURN_ERROR XSRETURN_NO
-#define PERL_RETURN_EMPTY XSRETURN_EMPTY
-#define PERL_RETURN_STRING(__string) \
+#define API_FUNC(__init, __name, __ret) \
+ char *perl_function_name = __name; \
+ (void) cv; \
+ if (__init \
+ && (!perl_current_script || !perl_current_script->name)) \
+ { \
+ WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, \
+ perl_function_name); \
+ __ret; \
+ }
+#define API_WRONG_ARGS(__ret) \
+ { \
+ WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, \
+ perl_function_name); \
+ __ret; \
+ }
+#define API_RETURN_OK XSRETURN_YES
+#define API_RETURN_ERROR XSRETURN_NO
+#define API_RETURN_EMPTY XSRETURN_EMPTY
+#define API_RETURN_STRING(__string) \
if (__string) \
{ \
XST_mPV (0, __string); \
@@ -47,7 +63,7 @@
} \
XST_mPV (0, ""); \
XSRETURN (1)
-#define PERL_RETURN_STRING_FREE(__string) \
+#define API_RETURN_STRING_FREE(__string) \
if (__string) \
{ \
XST_mPV (0, __string); \
@@ -56,13 +72,13 @@
} \
XST_mPV (0, ""); \
XSRETURN (1)
-#define PERL_RETURN_INT(__int) \
+#define API_RETURN_INT(__int) \
XST_mIV (0, __int); \
XSRETURN (1);
-#define PERL_RETURN_LONG(__long) \
+#define API_RETURN_LONG(__long) \
XST_mIV (0, __long); \
XSRETURN (1);
-#define PERL_RETURN_OBJ(__obj) \
+#define API_RETURN_OBJ(__obj) \
ST (0) = newRV_inc((SV *)__obj); \
if (SvREFCNT(ST(0))) sv_2mortal(ST(0)); \
XSRETURN (1);
@@ -83,16 +99,13 @@ XS (XS_weechat_api_register)
/* make C compiler happy */
(void) items;
- (void) cv;
+ API_FUNC(0, "register", API_RETURN_ERROR);
perl_current_script = NULL;
perl_registered_script = NULL;
if (items < 7)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(perl_current_script_filename, "register");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
name = SvPV_nolen (ST (0));
author = SvPV_nolen (ST (1));
@@ -110,7 +123,7 @@ XS (XS_weechat_api_register)
"\"%s\" (another script already "
"exists with this name)"),
weechat_prefix ("error"), PERL_PLUGIN_NAME, name);
- PERL_RETURN_ERROR;
+ API_RETURN_ERROR;
}
/* register script */
@@ -133,10 +146,10 @@ XS (XS_weechat_api_register)
}
else
{
- PERL_RETURN_ERROR;
+ API_RETURN_ERROR;
}
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -148,24 +161,13 @@ XS (XS_weechat_api_plugin_get_name)
const char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "plugin_get_name");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "plugin_get_name", API_RETURN_EMPTY);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "plugin_get_name");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_plugin_get_name (script_str2ptr (SvPV_nolen (ST (0)))); /* plugin */
- PERL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -176,25 +178,14 @@ XS (XS_weechat_api_charset_set)
{
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "charset_set");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "charset_set", API_RETURN_ERROR);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "charset_set");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_charset_set (perl_current_script,
SvPV_nolen (ST (0))); /* charset */
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -206,27 +197,16 @@ XS (XS_weechat_api_iconv_to_internal)
char *result, *charset, *string;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "iconv_to_internal");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "iconv_to_internal", API_RETURN_EMPTY);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "iconv_to_internal");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
charset = SvPV_nolen (ST (0));
string = SvPV_nolen (ST (1));
result = weechat_iconv_to_internal (charset, string);
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -239,27 +219,16 @@ XS (XS_weechat_api_iconv_from_internal)
char *result, *charset, *string;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "iconv_from_internal");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "iconv_from_internal", API_RETURN_EMPTY);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "iconv_from_internal");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
charset = SvPV_nolen (ST (0));
string = SvPV_nolen (ST (1));
result = weechat_iconv_from_internal (charset, string);
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -271,24 +240,13 @@ XS (XS_weechat_api_gettext)
const char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "gettext");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "gettext", API_RETURN_EMPTY);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "gettext");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_gettext (SvPV_nolen (ST (0))); /* string */
- PERL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -301,20 +259,9 @@ XS (XS_weechat_api_ngettext)
const char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "ngettext");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "ngettext", API_RETURN_EMPTY);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "ngettext");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
single = SvPV_nolen (ST (0));
plural = SvPV_nolen (ST (1));
@@ -322,7 +269,7 @@ XS (XS_weechat_api_ngettext)
result = weechat_ngettext (single, plural,
SvIV (ST (2))); /* count */
- PERL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -336,26 +283,15 @@ XS (XS_weechat_api_string_match)
int value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "string_match");
- PERL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "string_match", API_RETURN_INT(0));
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "string_match");
- PERL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_string_match (SvPV_nolen (ST (0)), /* string */
SvPV_nolen (ST (1)), /* mask */
SvIV (ST (2))); /* case_sensitive */
- PERL_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -369,25 +305,14 @@ XS (XS_weechat_api_string_has_highlight)
int value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "string_has_highlight");
- PERL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "string_has_highlight", API_RETURN_INT(0));
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "string_has_highlight");
- PERL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_string_has_highlight (SvPV_nolen (ST (0)), /* string */
SvPV_nolen (ST (1))); /* highlight_words */
- PERL_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -402,25 +327,14 @@ XS (XS_weechat_api_string_has_highlight_regex)
int value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "string_has_highlight_regex");
- PERL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "string_has_highlight_regex", API_RETURN_INT(0));
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "string_has_highlight_regex");
- PERL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_string_has_highlight_regex (SvPV_nolen (ST (0)), /* string */
SvPV_nolen (ST (1))); /* regex */
- PERL_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -434,24 +348,13 @@ XS (XS_weechat_api_string_mask_to_regex)
char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "string_mask_to_regex");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "string_mask_to_regex", API_RETURN_EMPTY);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "string_mask_to_regex");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_string_mask_to_regex (SvPV_nolen (ST (0))); /* mask */
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -463,27 +366,16 @@ XS (XS_weechat_api_string_remove_color)
char *result, *string, *replacement;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "string_remove_color");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "string_remove_color", API_RETURN_EMPTY);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "string_remove_color");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
string = SvPV_nolen (ST (0));
replacement = SvPV_nolen (ST (1));
result = weechat_string_remove_color (string, replacement);
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -496,24 +388,13 @@ XS (XS_weechat_api_string_is_command_char)
int value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "string_is_command_char");
- PERL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "string_is_command_char", API_RETURN_INT(0));
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "string_is_command_char");
- PERL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_string_is_command_char (SvPV_nolen (ST (0))); /* string */
- PERL_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -526,24 +407,13 @@ XS (XS_weechat_api_string_input_for_buffer)
const char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "string_input_for_buffer");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "string_input_for_buffer", API_RETURN_EMPTY);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "string_input_for_buffer");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_string_input_for_buffer (SvPV_nolen (ST (0))); /* string */
- PERL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -554,26 +424,15 @@ XS (XS_weechat_api_mkdir_home)
{
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "mkdir_home");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "mkdir_home", API_RETURN_ERROR);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "mkdir_home");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
if (weechat_mkdir_home (SvPV_nolen (ST (0)), /* directory */
SvIV (ST (1)))) /* mode */
- PERL_RETURN_OK;
+ API_RETURN_OK;
- PERL_RETURN_ERROR;
+ API_RETURN_ERROR;
}
/*
@@ -584,26 +443,15 @@ XS (XS_weechat_api_mkdir)
{
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "mkdir");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "mkdir", API_RETURN_ERROR);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "mkdir");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
if (weechat_mkdir (SvPV_nolen (ST (0)), /* directory */
SvIV (ST (1)))) /* mode */
- PERL_RETURN_OK;
+ API_RETURN_OK;
- PERL_RETURN_ERROR;
+ API_RETURN_ERROR;
}
/*
@@ -615,26 +463,15 @@ XS (XS_weechat_api_mkdir_parents)
{
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "mkdir_parents");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "mkdir_parents", API_RETURN_ERROR);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "mkdir_parents");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
if (weechat_mkdir_parents (SvPV_nolen (ST (0)), /* directory */
SvIV (ST (1)))) /* mode */
- PERL_RETURN_OK;
+ API_RETURN_OK;
- PERL_RETURN_ERROR;
+ API_RETURN_ERROR;
}
/*
@@ -650,15 +487,11 @@ XS (XS_weechat_api_list_new)
(void) items;
(void) cv;
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "list_new");
- PERL_RETURN_EMPTY;
- }
+ API_FUNC(1, "list_new", API_RETURN_EMPTY);
result = script_ptr2str (weechat_list_new ());
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -670,20 +503,9 @@ XS (XS_weechat_api_list_add)
char *result, *weelist, *data, *where, *user_data;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "list_add");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "list_add", API_RETURN_EMPTY);
if (items < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "list_add");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
weelist = SvPV_nolen (ST (0));
data = SvPV_nolen (ST (1));
@@ -695,7 +517,7 @@ XS (XS_weechat_api_list_add)
where,
script_str2ptr (user_data)));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -707,20 +529,9 @@ XS (XS_weechat_api_list_search)
char *result, *weelist, *data;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "list_search");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "list_search", API_RETURN_EMPTY);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "list_search");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
weelist = SvPV_nolen (ST (0));
data = SvPV_nolen (ST (1));
@@ -728,7 +539,7 @@ XS (XS_weechat_api_list_search)
result = script_ptr2str (weechat_list_search (script_str2ptr (weelist),
data));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -741,27 +552,16 @@ XS (XS_weechat_api_list_search_pos)
int pos;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "list_search_pos");
- PERL_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "list_search_pos", API_RETURN_INT(-1));
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "list_search_pos");
- PERL_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
weelist = SvPV_nolen (ST (0));
data = SvPV_nolen (ST (1));
pos = weechat_list_search_pos (script_str2ptr (weelist), data);
- PERL_RETURN_INT(pos);
+ API_RETURN_INT(pos);
}
/*
@@ -773,20 +573,9 @@ XS (XS_weechat_api_list_casesearch)
char *result, *weelist, *data;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "list_casesearch");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "list_casesearch", API_RETURN_EMPTY);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "list_casesearch");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
weelist = SvPV_nolen (ST (0));
data = SvPV_nolen (ST (1));
@@ -794,7 +583,7 @@ XS (XS_weechat_api_list_casesearch)
result = script_ptr2str (weechat_list_casesearch (script_str2ptr (weelist),
data));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -808,27 +597,16 @@ XS (XS_weechat_api_list_casesearch_pos)
int pos;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "list_casesearch_pos");
- PERL_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "list_casesearch_pos", API_RETURN_INT(-1));
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "list_casesearch_pos");
- PERL_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
weelist = SvPV_nolen (ST (0));
data = SvPV_nolen (ST (1));
pos = weechat_list_casesearch_pos (script_str2ptr (weelist), data);
- PERL_RETURN_INT(pos);
+ API_RETURN_INT(pos);
}
/*
@@ -840,25 +618,14 @@ XS (XS_weechat_api_list_get)
char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "list_get");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "list_get", API_RETURN_EMPTY);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "list_get");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_list_get (script_str2ptr (SvPV_nolen (ST (0))), /* weelist */
SvIV (ST (1)))); /* position */
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -870,27 +637,16 @@ XS (XS_weechat_api_list_set)
char *item, *new_value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "list_set");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "list_set", API_RETURN_ERROR);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "list_set");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
item = SvPV_nolen (ST (0));
new_value = SvPV_nolen (ST (1));
weechat_list_set (script_str2ptr (item), new_value);
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -902,24 +658,13 @@ XS (XS_weechat_api_list_next)
char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "list_next");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "list_next", API_RETURN_EMPTY);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "list_next");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_list_next (script_str2ptr (SvPV_nolen (ST (0))))); /* item */
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -931,24 +676,13 @@ XS (XS_weechat_api_list_prev)
char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "list_prev");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "list_prev", API_RETURN_EMPTY);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "list_prev");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_list_prev (script_str2ptr (SvPV_nolen (ST (0))))); /* item */
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -960,24 +694,13 @@ XS (XS_weechat_api_list_string)
const char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "list_string");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "list_string", API_RETURN_EMPTY);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "list_string");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_list_string (script_str2ptr (SvPV_nolen (ST (0)))); /* item */
- PERL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -989,24 +712,13 @@ XS (XS_weechat_api_list_size)
int size;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "list_size");
- PERL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "list_size", API_RETURN_INT(0));
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "list_size");
- PERL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
size = weechat_list_size (script_str2ptr (SvPV_nolen (ST (0)))); /* weelist */
- PERL_RETURN_INT(size);
+ API_RETURN_INT(size);
}
/*
@@ -1018,27 +730,16 @@ XS (XS_weechat_api_list_remove)
char *weelist, *item;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "list_remove");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "list_remove", API_RETURN_ERROR);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "list_remove");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weelist = SvPV_nolen (ST (0));
item = SvPV_nolen (ST (1));
weechat_list_remove (script_str2ptr (weelist), script_str2ptr (item));
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -1049,24 +750,13 @@ XS (XS_weechat_api_list_remove_all)
{
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "list_remove_all");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "list_remove_all", API_RETURN_ERROR);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "list_remove_all");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_list_remove_all (script_str2ptr (SvPV_nolen (ST (0)))); /* weelist */
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -1077,24 +767,13 @@ XS (XS_weechat_api_list_free)
{
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "list_free");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "list_free", API_RETURN_ERROR);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "list_free");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_list_free (script_str2ptr (SvPV_nolen (ST (0)))); /* weelist */
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -1106,7 +785,7 @@ weechat_perl_api_config_reload_cb (void *data,
struct t_config_file *config_file)
{
struct t_script_callback *script_callback;
- void *perl_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1114,13 +793,13 @@ weechat_perl_api_config_reload_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = script_ptr2str (config_file);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", perl_argv);
+ "ss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
@@ -1129,8 +808,8 @@ weechat_perl_api_config_reload_cb (void *data,
ret = *rc;
free (rc);
}
- if (perl_argv[1])
- free (perl_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -1147,20 +826,9 @@ XS (XS_weechat_api_config_new)
char *result, *name, *function, *data;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_new");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_new", API_RETURN_EMPTY);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_new");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
name = SvPV_nolen (ST (0));
function = SvPV_nolen (ST (1));
@@ -1173,7 +841,7 @@ XS (XS_weechat_api_config_new)
function,
data));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1188,7 +856,7 @@ weechat_perl_api_config_section_read_cb (void *data,
const char *value)
{
struct t_script_callback *script_callback;
- void *perl_argv[5];
+ void *func_argv[5];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1196,16 +864,16 @@ weechat_perl_api_config_section_read_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = script_ptr2str (config_file);
- perl_argv[2] = script_ptr2str (section);
- perl_argv[3] = (option_name) ? (char *)option_name : empty_arg;
- perl_argv[4] = (value) ? (char *)value : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
+ func_argv[2] = script_ptr2str (section);
+ func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
+ func_argv[4] = (value) ? (char *)value : empty_arg;
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sssss", perl_argv);
+ "sssss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
@@ -1214,10 +882,10 @@ weechat_perl_api_config_section_read_cb (void *data,
ret = *rc;
free (rc);
}
- if (perl_argv[1])
- free (perl_argv[1]);
- if (perl_argv[2])
- free (perl_argv[2]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[2])
+ free (func_argv[2]);
return ret;
}
@@ -1235,7 +903,7 @@ weechat_perl_api_config_section_write_cb (void *data,
const char *section_name)
{
struct t_script_callback *script_callback;
- void *perl_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1243,14 +911,14 @@ weechat_perl_api_config_section_write_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = script_ptr2str (config_file);
- perl_argv[2] = (section_name) ? (char *)section_name : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
+ func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", perl_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_WRITE_ERROR;
@@ -1259,8 +927,8 @@ weechat_perl_api_config_section_write_cb (void *data,
ret = *rc;
free (rc);
}
- if (perl_argv[1])
- free (perl_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -1279,7 +947,7 @@ weechat_perl_api_config_section_write_default_cb (void *data,
const char *section_name)
{
struct t_script_callback *script_callback;
- void *perl_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1287,14 +955,14 @@ weechat_perl_api_config_section_write_default_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = script_ptr2str (config_file);
- perl_argv[2] = (section_name) ? (char *)section_name : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
+ func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", perl_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_WRITE_ERROR;
@@ -1303,8 +971,8 @@ weechat_perl_api_config_section_write_default_cb (void *data,
ret = *rc;
free (rc);
}
- if (perl_argv[1])
- free (perl_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -1324,7 +992,7 @@ weechat_perl_api_config_section_create_option_cb (void *data,
const char *value)
{
struct t_script_callback *script_callback;
- void *perl_argv[5];
+ void *func_argv[5];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1332,16 +1000,16 @@ weechat_perl_api_config_section_create_option_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = script_ptr2str (config_file);
- perl_argv[2] = script_ptr2str (section);
- perl_argv[3] = (option_name) ? (char *)option_name : empty_arg;
- perl_argv[4] = (value) ? (char *)value : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
+ func_argv[2] = script_ptr2str (section);
+ func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
+ func_argv[4] = (value) ? (char *)value : empty_arg;
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sssss", perl_argv);
+ "sssss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
@@ -1350,10 +1018,10 @@ weechat_perl_api_config_section_create_option_cb (void *data,
ret = *rc;
free (rc);
}
- if (perl_argv[1])
- free (perl_argv[1]);
- if (perl_argv[2])
- free (perl_argv[2]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[2])
+ free (func_argv[2]);
return ret;
}
@@ -1372,7 +1040,7 @@ weechat_perl_api_config_section_delete_option_cb (void *data,
struct t_config_option *option)
{
struct t_script_callback *script_callback;
- void *perl_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1380,15 +1048,15 @@ weechat_perl_api_config_section_delete_option_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = script_ptr2str (config_file);
- perl_argv[2] = script_ptr2str (section);
- perl_argv[3] = script_ptr2str (option);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
+ func_argv[2] = script_ptr2str (section);
+ func_argv[3] = script_ptr2str (option);
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ssss", perl_argv);
+ "ssss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_OPTION_UNSET_ERROR;
@@ -1397,12 +1065,12 @@ weechat_perl_api_config_section_delete_option_cb (void *data,
ret = *rc;
free (rc);
}
- if (perl_argv[1])
- free (perl_argv[1]);
- if (perl_argv[2])
- free (perl_argv[2]);
- if (perl_argv[3])
- free (perl_argv[3]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[2])
+ free (func_argv[2]);
+ if (func_argv[3])
+ free (func_argv[3]);
return ret;
}
@@ -1423,20 +1091,9 @@ XS (XS_weechat_api_config_new_section)
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_new_section");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_new_section", API_RETURN_EMPTY);
if (items < 14)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_new_section");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
cfg_file = SvPV_nolen (ST (0));
name = SvPV_nolen (ST (1));
@@ -1473,7 +1130,7 @@ XS (XS_weechat_api_config_new_section)
function_delete_option,
data_delete_option));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1485,20 +1142,9 @@ XS (XS_weechat_api_config_search_section)
char *result, *config_file, *section_name;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_search_section");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_search_section", API_RETURN_EMPTY);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_search_section");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
config_file = SvPV_nolen (ST (0));
section_name = SvPV_nolen (ST (1));
@@ -1506,7 +1152,7 @@ XS (XS_weechat_api_config_search_section)
result = script_ptr2str (weechat_config_search_section (script_str2ptr (config_file),
section_name));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1520,7 +1166,7 @@ weechat_perl_api_config_option_check_value_cb (void *data,
const char *value)
{
struct t_script_callback *script_callback;
- void *perl_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1528,14 +1174,14 @@ weechat_perl_api_config_option_check_value_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = script_ptr2str (option);
- perl_argv[2] = (value) ? (char *)value : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (option);
+ func_argv[2] = (value) ? (char *)value : empty_arg;
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", perl_argv);
+ "sss", func_argv);
if (!rc)
ret = 0;
@@ -1544,8 +1190,8 @@ weechat_perl_api_config_option_check_value_cb (void *data,
ret = *rc;
free (rc);
}
- if (perl_argv[1])
- free (perl_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -1562,7 +1208,7 @@ weechat_perl_api_config_option_change_cb (void *data,
struct t_config_option *option)
{
struct t_script_callback *script_callback;
- void *perl_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc;
@@ -1570,16 +1216,16 @@ weechat_perl_api_config_option_change_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = script_ptr2str (option);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (option);
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", perl_argv);
+ "ss", func_argv);
- if (perl_argv[1])
- free (perl_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
if (rc)
free (rc);
@@ -1595,7 +1241,7 @@ weechat_perl_api_config_option_delete_cb (void *data,
struct t_config_option *option)
{
struct t_script_callback *script_callback;
- void *perl_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc;
@@ -1603,16 +1249,16 @@ weechat_perl_api_config_option_delete_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = script_ptr2str (option);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (option);
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", perl_argv);
+ "ss", func_argv);
- if (perl_argv[1])
- free (perl_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
if (rc)
free (rc);
@@ -1631,20 +1277,9 @@ XS (XS_weechat_api_config_new_option)
char *data_change, *function_delete, *data_delete;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_new_option");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_new_option", API_RETURN_EMPTY);
if (items < 17)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_new_option");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
config_file = SvPV_nolen (ST (0));
section = SvPV_nolen (ST (1));
@@ -1684,7 +1319,7 @@ XS (XS_weechat_api_config_new_option)
function_delete,
data_delete));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1696,20 +1331,9 @@ XS (XS_weechat_api_config_search_option)
char *result, *config_file, *section, *option_name;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_search_option");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_search_option", API_RETURN_EMPTY);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_search_option");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
config_file = SvPV_nolen (ST (0));
section = SvPV_nolen (ST (1));
@@ -1719,7 +1343,7 @@ XS (XS_weechat_api_config_search_option)
script_str2ptr (section),
option_name));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1731,24 +1355,13 @@ XS (XS_weechat_api_config_string_to_boolean)
int value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_string_to_boolean");
- PERL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_string_to_boolean", API_RETURN_INT(0));
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_string_to_boolean");
- PERL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_config_string_to_boolean (SvPV_nolen (ST (0))); /* text */
- PERL_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -1761,27 +1374,16 @@ XS (XS_weechat_api_config_option_reset)
char *option;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_option_reset");
- PERL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_option_reset", API_RETURN_INT(0));
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_option_reset");
- PERL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
option = SvPV_nolen (ST (0));
rc = weechat_config_option_reset (script_str2ptr (option),
SvIV (ST (1))); /* run_callback */
- PERL_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -1794,20 +1396,9 @@ XS (XS_weechat_api_config_option_set)
char *option, *new_value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_option_set");
- PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
-
+ API_FUNC(1, "config_option_set", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_option_set");
- PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
option = SvPV_nolen (ST (0));
new_value = SvPV_nolen (ST (1));
@@ -1816,7 +1407,7 @@ XS (XS_weechat_api_config_option_set)
new_value,
SvIV (ST (2))); /* run_callback */
- PERL_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -1829,27 +1420,16 @@ XS (XS_weechat_api_config_option_set_null)
char *option;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_option_set_null");
- PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
-
+ API_FUNC(1, "config_option_set_null", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_option_set_null");
- PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
option = SvPV_nolen (ST (0));
rc = weechat_config_option_set_null (script_str2ptr (option),
SvIV (ST (1))); /* run_callback */
- PERL_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -1862,26 +1442,15 @@ XS (XS_weechat_api_config_option_unset)
char *option;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_option_unset");
- PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
- }
-
+ API_FUNC(1, "config_option_unset", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_option_unset");
- PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
- }
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
option = SvPV_nolen (ST (0));
rc = weechat_config_option_unset (script_str2ptr (option));
- PERL_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -1893,20 +1462,9 @@ XS (XS_weechat_api_config_option_rename)
char *option, *new_name;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_option_rename");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_option_rename", API_RETURN_ERROR);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_option_rename");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
option = SvPV_nolen (ST (0));
new_name = SvPV_nolen (ST (1));
@@ -1914,7 +1472,7 @@ XS (XS_weechat_api_config_option_rename)
weechat_config_option_rename (script_str2ptr (option),
new_name);
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -1926,24 +1484,13 @@ XS (XS_weechat_api_config_option_is_null)
int value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_option_is_null");
- PERL_RETURN_INT(1);
- }
-
+ API_FUNC(1, "config_option_is_null", API_RETURN_INT(1));
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_option_is_null");
- PERL_RETURN_INT(1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(1));
value = weechat_config_option_is_null (script_str2ptr (SvPV_nolen (ST (0)))); /* option */
- PERL_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -1956,24 +1503,13 @@ XS (XS_weechat_api_config_option_default_is_null)
int value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_option_default_is_null");
- PERL_RETURN_INT(1);
- }
-
+ API_FUNC(1, "config_option_default_is_null", API_RETURN_INT(1));
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_option_default_is_null");
- PERL_RETURN_INT(1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(1));
value = weechat_config_option_default_is_null (script_str2ptr (SvPV_nolen (ST (0)))); /* option */
- PERL_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -1985,24 +1521,13 @@ XS (XS_weechat_api_config_boolean)
int value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_boolean");
- PERL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_boolean", API_RETURN_INT(0));
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_boolean");
- PERL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_config_boolean (script_str2ptr (SvPV_nolen (ST (0)))); /* option */
- PERL_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2014,24 +1539,13 @@ XS (XS_weechat_api_config_boolean_default)
int value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_boolean_default");
- PERL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_boolean_default", API_RETURN_INT(0));
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_boolean_default");
- PERL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_config_boolean_default (script_str2ptr (SvPV_nolen (ST (0)))); /* option */
- PERL_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2043,24 +1557,13 @@ XS (XS_weechat_api_config_integer)
int value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_integer");
- PERL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_integer", API_RETURN_INT(0));
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_integer");
- PERL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_config_integer (script_str2ptr (SvPV_nolen (ST (0)))); /* option */
- PERL_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2072,24 +1575,13 @@ XS (XS_weechat_api_config_integer_default)
int value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_integer_default");
- PERL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_integer_default", API_RETURN_INT(0));
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_integer_default");
- PERL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_config_integer_default (script_str2ptr (SvPV_nolen (ST (0)))); /* option */
- PERL_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2101,24 +1593,13 @@ XS (XS_weechat_api_config_string)
const char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_string");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_string", API_RETURN_EMPTY);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_string");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_config_string (script_str2ptr (SvPV_nolen (ST (0)))); /* option */
- PERL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2130,24 +1611,13 @@ XS (XS_weechat_api_config_string_default)
const char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_string_default");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_string_default", API_RETURN_EMPTY);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_string_default");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_config_string_default (script_str2ptr (SvPV_nolen (ST (0)))); /* option */
- PERL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2159,24 +1629,13 @@ XS (XS_weechat_api_config_color)
const char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_color");
- PERL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_color", API_RETURN_INT(0));
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_color");
- PERL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
result = weechat_config_color (script_str2ptr (SvPV_nolen (ST (0)))); /* option */
- PERL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2188,24 +1647,13 @@ XS (XS_weechat_api_config_color_default)
const char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_color_default");
- PERL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_color_default", API_RETURN_INT(0));
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_color_default");
- PERL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
result = weechat_config_color_default (script_str2ptr (SvPV_nolen (ST (0)))); /* option */
- PERL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2217,20 +1665,9 @@ XS (XS_weechat_api_config_write_option)
char *config_file, *option;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_write_option");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_write_option", API_RETURN_ERROR);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_write_option");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
config_file = SvPV_nolen (ST (0));
option = SvPV_nolen (ST (1));
@@ -2238,7 +1675,7 @@ XS (XS_weechat_api_config_write_option)
weechat_config_write_option (script_str2ptr (config_file),
script_str2ptr (option));
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2250,20 +1687,9 @@ XS (XS_weechat_api_config_write_line)
char *config_file, *option_name, *value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_write_line");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_write_line", API_RETURN_ERROR);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_write_line");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
config_file = SvPV_nolen (ST (0));
option_name = SvPV_nolen (ST (1));
@@ -2272,7 +1698,7 @@ XS (XS_weechat_api_config_write_line)
weechat_config_write_line (script_str2ptr (config_file), option_name,
"%s", value);
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2284,24 +1710,13 @@ XS (XS_weechat_api_config_write)
int rc;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_write");
- PERL_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "config_write", API_RETURN_INT(-1));
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_write");
- PERL_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
rc = weechat_config_write (script_str2ptr (SvPV_nolen (ST (0)))); /* config_file */
- PERL_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2313,24 +1728,13 @@ XS (XS_weechat_api_config_read)
int rc;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_read");
- PERL_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "config_read", API_RETURN_INT(-1));
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_read");
- PERL_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
rc = weechat_config_read (script_str2ptr (SvPV_nolen (ST (0)))); /* config_file */
- PERL_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2342,24 +1746,13 @@ XS (XS_weechat_api_config_reload)
int rc;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_reload");
- PERL_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "config_reload", API_RETURN_INT(-1));
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_reload");
- PERL_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
rc = weechat_config_reload (script_str2ptr (SvPV_nolen (ST (0)))); /* config_file */
- PERL_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2370,26 +1763,15 @@ XS (XS_weechat_api_config_option_free)
{
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_option_free");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_option_free", API_RETURN_ERROR);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_option_free");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_config_option_free (weechat_perl_plugin,
perl_current_script,
script_str2ptr (SvPV_nolen (ST (0)))); /* option */
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2401,26 +1783,15 @@ XS (XS_weechat_api_config_section_free_options)
{
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_section_free_options");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_section_free_options", API_RETURN_ERROR);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_section_free_options");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_config_section_free_options (weechat_perl_plugin,
perl_current_script,
script_str2ptr (SvPV_nolen (ST (0)))); /* section */
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2431,26 +1802,15 @@ XS (XS_weechat_api_config_section_free)
{
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_section_free");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_section_free", API_RETURN_ERROR);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_section_free");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_config_section_free (weechat_perl_plugin,
perl_current_script,
script_str2ptr (SvPV_nolen (ST (0)))); /* section */
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2461,26 +1821,15 @@ XS (XS_weechat_api_config_free)
{
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_free");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_free", API_RETURN_ERROR);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_free");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_config_free (weechat_perl_plugin,
perl_current_script,
script_str2ptr (SvPV_nolen (ST (0)))); /* config_file */
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2492,24 +1841,13 @@ XS (XS_weechat_api_config_get)
char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_get");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_get", API_RETURN_EMPTY);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_get");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_config_get (SvPV_nolen (ST (0))));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -2521,26 +1859,15 @@ XS (XS_weechat_api_config_get_plugin)
const char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_get_plugin");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_get_plugin", API_RETURN_EMPTY);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_get_plugin");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_api_config_get_plugin (weechat_perl_plugin,
perl_current_script,
SvPV_nolen (ST (0)));
- PERL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2553,20 +1880,9 @@ XS (XS_weechat_api_config_is_set_plugin)
int rc;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_is_set_plugin");
- PERL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_is_set_plugin", API_RETURN_INT(0));
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_is_set_plugin");
- PERL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
option = SvPV_nolen (ST (0));
@@ -2574,7 +1890,7 @@ XS (XS_weechat_api_config_is_set_plugin)
perl_current_script,
option);
- PERL_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2587,20 +1903,9 @@ XS (XS_weechat_api_config_set_plugin)
int rc;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_set_plugin");
- PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
-
+ API_FUNC(1, "config_set_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_set_plugin");
- PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
option = SvPV_nolen (ST (0));
value = SvPV_nolen (ST (1));
@@ -2610,7 +1915,7 @@ XS (XS_weechat_api_config_set_plugin)
option,
value);
- PERL_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2622,20 +1927,9 @@ XS (XS_weechat_api_config_set_desc_plugin)
char *option, *description;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_set_desc_plugin");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_set_desc_plugin", API_RETURN_ERROR);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_set_desc_plugin");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
option = SvPV_nolen (ST (0));
description = SvPV_nolen (ST (1));
@@ -2645,7 +1939,7 @@ XS (XS_weechat_api_config_set_desc_plugin)
option,
description);
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2658,20 +1952,9 @@ XS (XS_weechat_api_config_unset_plugin)
int rc;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_unset_plugin");
- PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
- }
-
+ API_FUNC(1, "config_unset_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_unset_plugin");
- PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
- }
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
option = SvPV_nolen (ST (0));
@@ -2679,7 +1962,7 @@ XS (XS_weechat_api_config_unset_plugin)
perl_current_script,
option);
- PERL_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2693,20 +1976,9 @@ XS (XS_weechat_api_key_bind)
int num_keys;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "key_bind");
- PERL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "key_bind", API_RETURN_INT(0));
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "key_bind");
- PERL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
context = SvPV_nolen (ST (0));
hashtable = weechat_perl_hash_to_hashtable (ST (1),
@@ -2717,7 +1989,7 @@ XS (XS_weechat_api_key_bind)
if (hashtable)
weechat_hashtable_free (hashtable);
- PERL_RETURN_INT(num_keys);
+ API_RETURN_INT(num_keys);
}
/*
@@ -2730,27 +2002,16 @@ XS (XS_weechat_api_key_unbind)
int num_keys;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "key_unbind");
- PERL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "key_unbind", API_RETURN_INT(0));
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "key_unbind");
- PERL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
context = SvPV_nolen (ST (0));
key = SvPV_nolen (ST (1));
num_keys = weechat_key_unbind (context, key);
- PERL_RETURN_INT(num_keys);
+ API_RETURN_INT(num_keys);
}
/*
@@ -2761,19 +2022,14 @@ XS (XS_weechat_api_prefix)
{
const char *result;
dXSARGS;
-
- /* make C compiler happy */
- (void) cv;
-
+
+ API_FUNC(0, "prefix", API_RETURN_EMPTY);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "prefix");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_prefix (SvPV_nolen (ST (0))); /* prefix */
- PERL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2785,18 +2041,13 @@ XS (XS_weechat_api_color)
const char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
+ API_FUNC(0, "color", API_RETURN_EMPTY);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "color");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_color (SvPV_nolen (ST (0))); /* color */
- PERL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2808,14 +2059,9 @@ XS (XS_weechat_api_print)
char *buffer, *message;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
+ API_FUNC(0, "print", API_RETURN_ERROR);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "print");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = SvPV_nolen (ST (0));
message = SvPV_nolen (ST (1));
@@ -2825,7 +2071,7 @@ XS (XS_weechat_api_print)
script_str2ptr (buffer),
"%s", message);
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2838,20 +2084,9 @@ XS (XS_weechat_api_print_date_tags)
char *buffer, *tags, *message;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "print_date_tags");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "print_date_tags", API_RETURN_ERROR);
if (items < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "print_date_tags");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = SvPV_nolen (ST (0));
tags = SvPV_nolen (ST (2));
@@ -2864,7 +2099,7 @@ XS (XS_weechat_api_print_date_tags)
tags,
"%s", message);
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2876,20 +2111,9 @@ XS (XS_weechat_api_print_y)
char *buffer, *message;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "print_y");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "print_y", API_RETURN_ERROR);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "print_y");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = SvPV_nolen (ST (0));
message = SvPV_nolen (ST (2));
@@ -2900,7 +2124,7 @@ XS (XS_weechat_api_print_y)
SvIV (ST (1)),
"%s", message);
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2911,26 +2135,16 @@ XS (XS_weechat_api_log_print)
{
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "log_print");
- PERL_RETURN_ERROR;
- }
+ API_FUNC(1, "log_print", API_RETURN_ERROR);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "log_print");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_log_printf (weechat_perl_plugin,
perl_current_script,
"%s", SvPV_nolen (ST (0))); /* message */
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2942,7 +2156,7 @@ weechat_perl_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
struct t_script_callback *script_callback;
- void *perl_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -2953,14 +2167,14 @@ weechat_perl_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
if (script_callback && script_callback->function && script_callback->function[0])
{
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = script_ptr2str (buffer);
- perl_argv[2] = (argc > 1) ? argv_eol[1] : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (buffer);
+ func_argv[2] = (argc > 1) ? argv_eol[1] : empty_arg;
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", perl_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -2969,8 +2183,8 @@ weechat_perl_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
ret = *rc;
free (rc);
}
- if (perl_argv[1])
- free (perl_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -2988,20 +2202,9 @@ XS (XS_weechat_api_hook_command)
char *completion, *function, *data;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_command");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_command", API_RETURN_EMPTY);
if (items < 7)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hook_command");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
command = SvPV_nolen (ST (0));
description = SvPV_nolen (ST (1));
@@ -3022,7 +2225,7 @@ XS (XS_weechat_api_hook_command)
function,
data));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3034,7 +2237,7 @@ weechat_perl_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
const char *command)
{
struct t_script_callback *script_callback;
- void *perl_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3042,14 +2245,14 @@ weechat_perl_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
if (script_callback && script_callback->function && script_callback->function[0])
{
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = script_ptr2str (buffer);
- perl_argv[2] = (command) ? (char *)command : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (buffer);
+ func_argv[2] = (command) ? (char *)command : empty_arg;
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", perl_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3058,8 +2261,8 @@ weechat_perl_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
ret = *rc;
free (rc);
}
- if (perl_argv[1])
- free (perl_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -3076,20 +2279,9 @@ XS (XS_weechat_api_hook_command_run)
char *result, *command, *function, *data;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_command_run");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_command_run", API_RETURN_EMPTY);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hook_command_run");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
command = SvPV_nolen (ST (0));
function = SvPV_nolen (ST (1));
@@ -3102,7 +2294,7 @@ XS (XS_weechat_api_hook_command_run)
function,
data));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3113,7 +2305,7 @@ int
weechat_perl_api_hook_timer_cb (void *data, int remaining_calls)
{
struct t_script_callback *script_callback;
- void *perl_argv[2];
+ void *func_argv[2];
char str_remaining_calls[32], empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3124,13 +2316,13 @@ weechat_perl_api_hook_timer_cb (void *data, int remaining_calls)
snprintf (str_remaining_calls, sizeof (str_remaining_calls),
"%d", remaining_calls);
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = str_remaining_calls;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = str_remaining_calls;
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", perl_argv);
+ "ss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3155,20 +2347,9 @@ XS (XS_weechat_api_hook_timer)
char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_timer");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_timer", API_RETURN_EMPTY);
if (items < 5)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hook_timer");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_timer (weechat_perl_plugin,
perl_current_script,
@@ -3179,7 +2360,7 @@ XS (XS_weechat_api_hook_timer)
SvPV_nolen (ST (3)), /* perl function */
SvPV_nolen (ST (4)))); /* data */
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3190,7 +2371,7 @@ int
weechat_perl_api_hook_fd_cb (void *data, int fd)
{
struct t_script_callback *script_callback;
- void *perl_argv[2];
+ void *func_argv[2];
char str_fd[32], empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3200,13 +2381,13 @@ weechat_perl_api_hook_fd_cb (void *data, int fd)
{
snprintf (str_fd, sizeof (str_fd), "%d", fd);
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = str_fd;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = str_fd;
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", perl_argv);
+ "ss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3231,20 +2412,9 @@ XS (XS_weechat_api_hook_fd)
char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_fd");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_fd", API_RETURN_EMPTY);
if (items < 6)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hook_fd");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_fd (weechat_perl_plugin,
perl_current_script,
@@ -3256,7 +2426,7 @@ XS (XS_weechat_api_hook_fd)
SvPV_nolen (ST (4)), /* perl function */
SvPV_nolen (ST (5)))); /* data */
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3269,7 +2439,7 @@ weechat_perl_api_hook_process_cb (void *data,
const char *out, const char *err)
{
struct t_script_callback *script_callback;
- void *perl_argv[5];
+ void *func_argv[5];
char str_rc[32], empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3279,16 +2449,16 @@ weechat_perl_api_hook_process_cb (void *data,
{
snprintf (str_rc, sizeof (str_rc), "%d", return_code);
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = (command) ? (char *)command : empty_arg;
- perl_argv[2] = str_rc;
- perl_argv[3] = (out) ? (char *)out : empty_arg;
- perl_argv[4] = (err) ? (char *)err : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (command) ? (char *)command : empty_arg;
+ func_argv[2] = str_rc;
+ func_argv[3] = (out) ? (char *)out : empty_arg;
+ func_argv[4] = (err) ? (char *)err : empty_arg;
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sssss", perl_argv);
+ "sssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3313,20 +2483,9 @@ XS (XS_weechat_api_hook_process)
char *command, *function, *data, *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_process");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_process", API_RETURN_EMPTY);
if (items < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hook_process");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
command = SvPV_nolen (ST (0));
function = SvPV_nolen (ST (2));
@@ -3340,7 +2499,7 @@ XS (XS_weechat_api_hook_process)
function,
data));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3352,7 +2511,7 @@ weechat_perl_api_hook_connect_cb (void *data, int status, int gnutls_rc,
const char *error, const char *ip_address)
{
struct t_script_callback *script_callback;
- void *perl_argv[5];
+ void *func_argv[5];
char str_status[32], str_gnutls_rc[32];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3364,16 +2523,16 @@ weechat_perl_api_hook_connect_cb (void *data, int status, int gnutls_rc,
snprintf (str_status, sizeof (str_status), "%d", status);
snprintf (str_gnutls_rc, sizeof (str_gnutls_rc), "%d", gnutls_rc);
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = str_status;
- perl_argv[2] = str_gnutls_rc;
- perl_argv[3] = (ip_address) ? (char *)ip_address : empty_arg;
- perl_argv[4] = (error) ? (char *)error : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = str_status;
+ func_argv[2] = str_gnutls_rc;
+ func_argv[3] = (ip_address) ? (char *)ip_address : empty_arg;
+ func_argv[4] = (error) ? (char *)error : empty_arg;
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sssss", perl_argv);
+ "sssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3398,20 +2557,9 @@ XS (XS_weechat_api_hook_connect)
char *proxy, *address, *local_hostname, *function, *data, *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_connect");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_connect", API_RETURN_EMPTY);
if (items < 8)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hook_connect");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
proxy = SvPV_nolen (ST (0));
address = SvPV_nolen (ST (1));
@@ -3435,7 +2583,7 @@ XS (XS_weechat_api_hook_connect)
function,
data));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3450,7 +2598,7 @@ weechat_perl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
const char *prefix, const char *message)
{
struct t_script_callback *script_callback;
- void *perl_argv[8];
+ void *func_argv[8];
char empty_arg[1] = { '\0' };
static char timebuffer[64];
int *rc, ret;
@@ -3464,21 +2612,21 @@ weechat_perl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
{
snprintf (timebuffer, sizeof (timebuffer) - 1, "%ld", (long int)date);
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = script_ptr2str (buffer);
- perl_argv[2] = timebuffer;
- perl_argv[3] = weechat_string_build_with_split_string (tags, ",");
- if (!perl_argv[3])
- perl_argv[3] = strdup ("");
- perl_argv[4] = (displayed) ? strdup ("1") : strdup ("0");
- perl_argv[5] = (highlight) ? strdup ("1") : strdup ("0");
- perl_argv[6] = (prefix) ? (char *)prefix : empty_arg;
- perl_argv[7] = (message) ? (char *)message : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (buffer);
+ func_argv[2] = timebuffer;
+ func_argv[3] = weechat_string_build_with_split_string (tags, ",");
+ if (!func_argv[3])
+ func_argv[3] = strdup ("");
+ func_argv[4] = (displayed) ? strdup ("1") : strdup ("0");
+ func_argv[5] = (highlight) ? strdup ("1") : strdup ("0");
+ func_argv[6] = (prefix) ? (char *)prefix : empty_arg;
+ func_argv[7] = (message) ? (char *)message : empty_arg;
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ssssssss", perl_argv);
+ "ssssssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3487,14 +2635,14 @@ weechat_perl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
ret = *rc;
free (rc);
}
- if (perl_argv[1])
- free (perl_argv[1]);
- if (perl_argv[3])
- free (perl_argv[3]);
- if (perl_argv[4])
- free (perl_argv[4]);
- if (perl_argv[5])
- free (perl_argv[5]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[3])
+ free (func_argv[3]);
+ if (func_argv[4])
+ free (func_argv[4]);
+ if (func_argv[5])
+ free (func_argv[5]);
return ret;
}
@@ -3511,20 +2659,9 @@ XS (XS_weechat_api_hook_print)
char *result, *buffer, *tags, *message, *function, *data;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_print");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_print", API_RETURN_EMPTY);
if (items < 6)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hook_print");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = SvPV_nolen (ST (0));
tags = SvPV_nolen (ST (1));
@@ -3542,7 +2679,7 @@ XS (XS_weechat_api_hook_print)
function,
data));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3554,7 +2691,7 @@ weechat_perl_api_hook_signal_cb (void *data, const char *signal, const char *typ
void *signal_data)
{
struct t_script_callback *script_callback;
- void *perl_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
static char value_str[64];
int *rc, ret, free_needed;
@@ -3563,31 +2700,31 @@ weechat_perl_api_hook_signal_cb (void *data, const char *signal, const char *typ
if (script_callback && script_callback->function && script_callback->function[0])
{
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = (signal) ? (char *)signal : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (signal) ? (char *)signal : empty_arg;
free_needed = 0;
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
{
- perl_argv[2] = (signal_data) ? (char *)signal_data : empty_arg;
+ func_argv[2] = (signal_data) ? (char *)signal_data : empty_arg;
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_INT) == 0)
{
snprintf (value_str, sizeof (value_str) - 1,
"%d", *((int *)signal_data));
- perl_argv[2] = value_str;
+ func_argv[2] = value_str;
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_POINTER) == 0)
{
- perl_argv[2] = script_ptr2str (signal_data);
+ func_argv[2] = script_ptr2str (signal_data);
free_needed = 1;
}
else
- perl_argv[2] = empty_arg;
+ func_argv[2] = empty_arg;
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", perl_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3596,8 +2733,8 @@ weechat_perl_api_hook_signal_cb (void *data, const char *signal, const char *typ
ret = *rc;
free (rc);
}
- if (free_needed && perl_argv[2])
- free (perl_argv[2]);
+ if (free_needed && func_argv[2])
+ free (func_argv[2]);
return ret;
}
@@ -3614,20 +2751,9 @@ XS (XS_weechat_api_hook_signal)
char *result, *signal, *function, *data;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_signal");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_signal", API_RETURN_EMPTY);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hook_signal");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
signal = SvPV_nolen (ST (0));
function = SvPV_nolen (ST (1));
@@ -3640,7 +2766,7 @@ XS (XS_weechat_api_hook_signal)
function,
data));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3653,20 +2779,9 @@ XS (XS_weechat_api_hook_signal_send)
int number;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_signal_send");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "hook_signal_send", API_RETURN_ERROR);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hook_signal_send");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
signal = SvPV_nolen (ST (0));
type_data = SvPV_nolen (ST (1));
@@ -3675,7 +2790,7 @@ XS (XS_weechat_api_hook_signal_send)
weechat_hook_signal_send (signal,
type_data,
SvPV_nolen (ST (2))); /* signal_data */
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_INT) == 0)
{
@@ -3683,17 +2798,17 @@ XS (XS_weechat_api_hook_signal_send)
weechat_hook_signal_send (signal,
type_data,
&number); /* signal_data */
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_POINTER) == 0)
{
weechat_hook_signal_send (signal,
type_data,
script_str2ptr (SvPV_nolen (ST (2)))); /* signal_data */
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
- PERL_RETURN_ERROR;
+ API_RETURN_ERROR;
}
/*
@@ -3705,7 +2820,7 @@ weechat_perl_api_hook_hsignal_cb (void *data, const char *signal,
struct t_hashtable *hashtable)
{
struct t_script_callback *script_callback;
- void *perl_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3713,14 +2828,14 @@ weechat_perl_api_hook_hsignal_cb (void *data, const char *signal,
if (script_callback && script_callback->function && script_callback->function[0])
{
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = (signal) ? (char *)signal : empty_arg;
- perl_argv[2] = hashtable;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (signal) ? (char *)signal : empty_arg;
+ func_argv[2] = hashtable;
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ssh", perl_argv);
+ "ssh", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3745,20 +2860,9 @@ XS (XS_weechat_api_hook_hsignal)
char *result, *signal, *function, *data;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_hsignal");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_hsignal", API_RETURN_EMPTY);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hook_hsignal");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
signal = SvPV_nolen (ST (0));
function = SvPV_nolen (ST (1));
@@ -3771,7 +2875,7 @@ XS (XS_weechat_api_hook_hsignal)
function,
data));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3784,20 +2888,9 @@ XS (XS_weechat_api_hook_hsignal_send)
struct t_hashtable *hashtable;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_hsignal_send");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "hook_hsignal_send", API_RETURN_ERROR);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hook_hsignal_send");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
signal = SvPV_nolen (ST (0));
hashtable = weechat_perl_hash_to_hashtable (ST (1),
@@ -3808,7 +2901,7 @@ XS (XS_weechat_api_hook_hsignal_send)
if (hashtable)
weechat_hashtable_free (hashtable);
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -3819,7 +2912,7 @@ int
weechat_perl_api_hook_config_cb (void *data, const char *option, const char *value)
{
struct t_script_callback *script_callback;
- void *perl_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3827,14 +2920,14 @@ weechat_perl_api_hook_config_cb (void *data, const char *option, const char *val
if (script_callback && script_callback->function && script_callback->function[0])
{
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = (option) ? (char *)option : empty_arg;
- perl_argv[2] = (value) ? (char *)value : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (option) ? (char *)option : empty_arg;
+ func_argv[2] = (value) ? (char *)value : empty_arg;
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", perl_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3859,20 +2952,9 @@ XS (XS_weechat_api_hook_config)
char *result, *option, *function, *data;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_config");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_config", API_RETURN_EMPTY);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hook_config");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
option = SvPV_nolen (ST (0));
function = SvPV_nolen (ST (1));
@@ -3885,7 +2967,7 @@ XS (XS_weechat_api_hook_config)
function,
data));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3898,7 +2980,7 @@ weechat_perl_api_hook_completion_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
struct t_script_callback *script_callback;
- void *perl_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3906,15 +2988,15 @@ weechat_perl_api_hook_completion_cb (void *data, const char *completion_item,
if (script_callback && script_callback->function && script_callback->function[0])
{
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = (completion_item) ? (char *)completion_item : empty_arg;
- perl_argv[2] = script_ptr2str (buffer);
- perl_argv[3] = script_ptr2str (completion);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (completion_item) ? (char *)completion_item : empty_arg;
+ func_argv[2] = script_ptr2str (buffer);
+ func_argv[3] = script_ptr2str (completion);
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ssss", perl_argv);
+ "ssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3923,10 +3005,10 @@ weechat_perl_api_hook_completion_cb (void *data, const char *completion_item,
ret = *rc;
free (rc);
}
- if (perl_argv[2])
- free (perl_argv[2]);
- if (perl_argv[3])
- free (perl_argv[3]);
+ if (func_argv[2])
+ free (func_argv[2]);
+ if (func_argv[3])
+ free (func_argv[3]);
return ret;
}
@@ -3943,20 +3025,9 @@ XS (XS_weechat_api_hook_completion)
char *result, *completion, *description, *function, *data;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_completion");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_completion", API_RETURN_EMPTY);
if (items < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hook_completion");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
completion = SvPV_nolen (ST (0));
description = SvPV_nolen (ST (1));
@@ -3971,7 +3042,7 @@ XS (XS_weechat_api_hook_completion)
function,
data));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3983,20 +3054,9 @@ XS (XS_weechat_api_hook_completion_list_add)
char *completion, *word, *where;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_completion_list_add");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "hook_completion_list_add", API_RETURN_ERROR);
if (items < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hook_completion_list_add");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
completion = SvPV_nolen (ST (0));
word = SvPV_nolen (ST (1));
@@ -4007,7 +3067,7 @@ XS (XS_weechat_api_hook_completion_list_add)
SvIV (ST (2)), /* nick_completion */
where);
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4019,22 +3079,22 @@ weechat_perl_api_hook_modifier_cb (void *data, const char *modifier,
const char *modifier_data, const char *string)
{
struct t_script_callback *script_callback;
- void *perl_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' };
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = (modifier) ? (char *)modifier : empty_arg;
- perl_argv[2] = (modifier_data) ? (char *)modifier_data : empty_arg;
- perl_argv[3] = (string) ? (char *)string : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (modifier) ? (char *)modifier : empty_arg;
+ func_argv[2] = (modifier_data) ? (char *)modifier_data : empty_arg;
+ func_argv[3] = (string) ? (char *)string : empty_arg;
return (char *)weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
- "ssss", perl_argv);
+ "ssss", func_argv);
}
return NULL;
@@ -4049,20 +3109,9 @@ XS (XS_weechat_api_hook_modifier)
char *result, *modifier, *function, *data;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_modifier");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_modifier", API_RETURN_EMPTY);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hook_modifier");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
modifier = SvPV_nolen (ST (0));
function = SvPV_nolen (ST (1));
@@ -4075,7 +3124,7 @@ XS (XS_weechat_api_hook_modifier)
function,
data));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4087,20 +3136,9 @@ XS (XS_weechat_api_hook_modifier_exec)
char *result, *modifier, *modifier_data, *string;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_modifier_exec");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_modifier_exec", API_RETURN_EMPTY);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hook_modifier_exec");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
modifier = SvPV_nolen (ST (0));
modifier_data = SvPV_nolen (ST (1));
@@ -4108,7 +3146,7 @@ XS (XS_weechat_api_hook_modifier_exec)
result = weechat_hook_modifier_exec (modifier, modifier_data, string);
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4120,21 +3158,21 @@ weechat_perl_api_hook_info_cb (void *data, const char *info_name,
const char *arguments)
{
struct t_script_callback *script_callback;
- void *perl_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = (info_name) ? (char *)info_name : empty_arg;
- perl_argv[2] = (arguments) ? (char *)arguments : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
+ func_argv[2] = (arguments) ? (char *)arguments : empty_arg;
return (const char *)weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
- "sss", perl_argv);
+ "sss", func_argv);
}
return NULL;
@@ -4149,20 +3187,9 @@ XS (XS_weechat_api_hook_info)
char *result, *info_name, *description, *args_description, *function, *data;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_info");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_info", API_RETURN_EMPTY);
if (items < 5)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hook_info");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
info_name = SvPV_nolen (ST (0));
description = SvPV_nolen (ST (1));
@@ -4179,7 +3206,7 @@ XS (XS_weechat_api_hook_info)
function,
data));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4191,21 +3218,21 @@ weechat_perl_api_hook_info_hashtable_cb (void *data, const char *info_name,
struct t_hashtable *hashtable)
{
struct t_script_callback *script_callback;
- void *perl_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = (info_name) ? (char *)info_name : empty_arg;
- perl_argv[2] = hashtable;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
+ func_argv[2] = hashtable;
return (struct t_hashtable *)weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
script_callback->function,
- "ssh", perl_argv);
+ "ssh", func_argv);
}
return NULL;
@@ -4221,20 +3248,9 @@ XS (XS_weechat_api_hook_info_hashtable)
char *output_description, *function, *data;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_info_hashtable");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_info_hashtable", API_RETURN_EMPTY);
if (items < 6)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hook_info_hashtable");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
info_name = SvPV_nolen (ST (0));
description = SvPV_nolen (ST (1));
@@ -4253,7 +3269,7 @@ XS (XS_weechat_api_hook_info_hashtable)
function,
data));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4265,7 +3281,7 @@ weechat_perl_api_hook_infolist_cb (void *data, const char *infolist_name,
void *pointer, const char *arguments)
{
struct t_script_callback *script_callback;
- void *perl_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' };
struct t_infolist *result;
@@ -4273,18 +3289,18 @@ weechat_perl_api_hook_infolist_cb (void *data, const char *infolist_name,
if (script_callback && script_callback->function && script_callback->function[0])
{
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = (infolist_name) ? (char *)infolist_name : empty_arg;
- perl_argv[2] = script_ptr2str (pointer);
- perl_argv[3] = (arguments) ? (char *)arguments : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (infolist_name) ? (char *)infolist_name : empty_arg;
+ func_argv[2] = script_ptr2str (pointer);
+ func_argv[3] = (arguments) ? (char *)arguments : empty_arg;
result = (struct t_infolist *)weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
- "ssss", perl_argv);
+ "ssss", func_argv);
- if (perl_argv[2])
- free (perl_argv[2]);
+ if (func_argv[2])
+ free (func_argv[2]);
return result;
}
@@ -4302,20 +3318,9 @@ XS (XS_weechat_api_hook_infolist)
char *args_description, *function, *data;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_infolist");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_infolist", API_RETURN_EMPTY);
if (items < 6)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hook_infolist");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
infolist_name = SvPV_nolen (ST (0));
description = SvPV_nolen (ST (1));
@@ -4334,7 +3339,7 @@ XS (XS_weechat_api_hook_infolist)
function,
data));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4346,20 +3351,20 @@ weechat_perl_api_hook_focus_cb (void *data,
struct t_hashtable *info)
{
struct t_script_callback *script_callback;
- void *perl_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = info;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = info;
return (struct t_hashtable *)weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
script_callback->function,
- "sh", perl_argv);
+ "sh", func_argv);
}
return NULL;
@@ -4374,20 +3379,9 @@ XS (XS_weechat_api_hook_focus)
char *result, *area, *function, *data;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_focus");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_focus", API_RETURN_EMPTY);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hook_focus");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
area = SvPV_nolen (ST (0));
function = SvPV_nolen (ST (1));
@@ -4400,7 +3394,7 @@ XS (XS_weechat_api_hook_focus)
function,
data));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4411,26 +3405,15 @@ XS (XS_weechat_api_unhook)
{
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "unhook");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "unhook", API_RETURN_ERROR);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "unhook");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_unhook (weechat_perl_plugin,
perl_current_script,
script_str2ptr (SvPV_nolen (ST (0)))); /* hook */
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4445,15 +3428,11 @@ XS (XS_weechat_api_unhook_all)
(void) cv;
(void) items;
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "unhook_all");
- PERL_RETURN_ERROR;
- }
+ API_FUNC(1, "unhook_all", API_RETURN_ERROR);
script_api_unhook_all (perl_current_script);
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4465,7 +3444,7 @@ weechat_perl_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
const char *input_data)
{
struct t_script_callback *script_callback;
- void *perl_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -4473,14 +3452,14 @@ weechat_perl_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
if (script_callback && script_callback->function && script_callback->function[0])
{
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = script_ptr2str (buffer);
- perl_argv[2] = (input_data) ? (char *)input_data : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (buffer);
+ func_argv[2] = (input_data) ? (char *)input_data : empty_arg;
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", perl_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -4488,8 +3467,8 @@ weechat_perl_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
ret = *rc;
free (rc);
}
- if (perl_argv[1])
- free (perl_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -4505,7 +3484,7 @@ int
weechat_perl_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
{
struct t_script_callback *script_callback;
- void *perl_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -4513,13 +3492,13 @@ weechat_perl_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
if (script_callback && script_callback->function && script_callback->function[0])
{
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = script_ptr2str (buffer);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (buffer);
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", perl_argv);
+ "ss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -4527,8 +3506,8 @@ weechat_perl_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
ret = *rc;
free (rc);
}
- if (perl_argv[1])
- free (perl_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -4546,20 +3525,9 @@ XS (XS_weechat_api_buffer_new)
char *data_close;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "buffer_new");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "buffer_new", API_RETURN_EMPTY);
if (items < 5)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "buffer_new");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
name = SvPV_nolen (ST (0));
function_input = SvPV_nolen (ST (1));
@@ -4577,7 +3545,7 @@ XS (XS_weechat_api_buffer_new)
function_close,
data_close));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4589,27 +3557,16 @@ XS (XS_weechat_api_buffer_search)
char *result, *plugin, *name;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "buffer_search");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "buffer_search", API_RETURN_EMPTY);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "buffer_search");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
plugin = SvPV_nolen (ST (0));
name = SvPV_nolen (ST (1));
result = script_ptr2str (weechat_buffer_search (plugin, name));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4625,15 +3582,11 @@ XS (XS_weechat_api_buffer_search_main)
(void) items;
(void) cv;
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "buffer_search_main");
- PERL_RETURN_EMPTY;
- }
+ API_FUNC(1, "buffer_search_main", API_RETURN_EMPTY);
result = script_ptr2str (weechat_buffer_search_main ());
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4649,15 +3602,11 @@ XS (XS_weechat_api_current_buffer)
(void) items;
(void) cv;
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "current_buffer");
- PERL_RETURN_EMPTY;
- }
+ API_FUNC(1, "current_buffer", API_RETURN_EMPTY);
result = script_ptr2str (weechat_current_buffer ());
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4668,24 +3617,13 @@ XS (XS_weechat_api_buffer_clear)
{
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "buffer_clear");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_clear", API_RETURN_ERROR);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "buffer_clear");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_buffer_clear (script_str2ptr (SvPV_nolen (ST (0)))); /* buffer */
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4696,26 +3634,15 @@ XS (XS_weechat_api_buffer_close)
{
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "buffer_close");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_close", API_RETURN_ERROR);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "buffer_close");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_buffer_close (weechat_perl_plugin,
perl_current_script,
script_str2ptr (SvPV_nolen (ST (0)))); /* buffer */
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4726,25 +3653,14 @@ XS (XS_weechat_api_buffer_merge)
{
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "buffer_merge");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_merge", API_RETURN_ERROR);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "buffer_merge");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_buffer_merge (script_str2ptr (SvPV_nolen (ST (0))), /* buffer */
script_str2ptr (SvPV_nolen (ST (1)))); /* target_buffer */
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4755,25 +3671,14 @@ XS (XS_weechat_api_buffer_unmerge)
{
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "buffer_unmerge");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_unmerge", API_RETURN_ERROR);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "buffer_unmerge");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_buffer_unmerge (script_str2ptr (SvPV_nolen (ST (0))), /* buffer */
SvIV (ST (1))); /* number */
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4786,27 +3691,16 @@ XS (XS_weechat_api_buffer_get_integer)
int value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "buffer_get_integer");
- PERL_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "buffer_get_integer", API_RETURN_INT(-1));
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "buffer_get_integer");
- PERL_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
buffer = SvPV_nolen (ST (0));
property = SvPV_nolen (ST (1));
value = weechat_buffer_get_integer (script_str2ptr (buffer), property);
- PERL_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -4819,27 +3713,16 @@ XS (XS_weechat_api_buffer_get_string)
const char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "buffer_get_string");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "buffer_get_string", API_RETURN_EMPTY);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "buffer_get_string");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = SvPV_nolen (ST (0));
property = SvPV_nolen (ST (1));
result = weechat_buffer_get_string (script_str2ptr (buffer), property);
- PERL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -4851,20 +3734,9 @@ XS (XS_weechat_api_buffer_get_pointer)
char *result, *buffer, *property;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "buffer_get_pointer");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "buffer_get_pointer", API_RETURN_EMPTY);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "buffer_get_pointer");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = SvPV_nolen (ST (0));
property = SvPV_nolen (ST (1));
@@ -4872,7 +3744,7 @@ XS (XS_weechat_api_buffer_get_pointer)
result = script_ptr2str (weechat_buffer_get_pointer (script_str2ptr (buffer),
property));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4884,20 +3756,9 @@ XS (XS_weechat_api_buffer_set)
char *buffer, *property, *value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "buffer_set");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_set", API_RETURN_ERROR);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "buffer_set");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = SvPV_nolen (ST (0));
property = SvPV_nolen (ST (1));
@@ -4905,7 +3766,7 @@ XS (XS_weechat_api_buffer_set)
weechat_buffer_set (script_str2ptr (buffer), property, value);
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4918,27 +3779,16 @@ XS (XS_weechat_api_buffer_string_replace_local_var)
char *buffer, *string, *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "buffer_string_replace_local_var");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_string_replace_local_var", API_RETURN_ERROR);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "buffer_string_replace_local_var");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = SvPV_nolen (ST (0));
string = SvPV_nolen (ST (1));
result = weechat_buffer_string_replace_local_var (script_str2ptr (buffer), string);
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4951,27 +3801,16 @@ XS (XS_weechat_api_buffer_match_list)
int value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "buffer_match_list");
- PERL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "buffer_match_list", API_RETURN_INT(0));
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "buffer_match_list");
- PERL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
buffer = SvPV_nolen (ST (0));
string = SvPV_nolen (ST (1));
value = weechat_buffer_match_list (script_str2ptr (buffer), string);
- PERL_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -4987,15 +3826,11 @@ XS (XS_weechat_api_current_window)
(void) items;
(void) cv;
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "current_window");
- PERL_RETURN_EMPTY;
- }
+ API_FUNC(1, "current_window", API_RETURN_EMPTY);
result = script_ptr2str (weechat_current_window ());
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5007,24 +3842,13 @@ XS (XS_weechat_api_window_search_with_buffer)
char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "window_search_with_buffer");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "window_search_with_buffer", API_RETURN_EMPTY);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "window_search_with_buffer");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_window_search_with_buffer (script_str2ptr (SvPV_nolen (ST (0)))));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
@@ -5038,27 +3862,16 @@ XS (XS_weechat_api_window_get_integer)
int value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "window_get_integer");
- PERL_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "window_get_integer", API_RETURN_INT(-1));
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "window_get_integer");
- PERL_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
window = SvPV_nolen (ST (0));
property = SvPV_nolen (ST (1));
value = weechat_window_get_integer (script_str2ptr (window), property);
- PERL_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -5071,27 +3884,16 @@ XS (XS_weechat_api_window_get_string)
const char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "window_get_string");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "window_get_string", API_RETURN_EMPTY);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "window_get_string");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
window = SvPV_nolen (ST (0));
property = SvPV_nolen (ST (1));
result = weechat_window_get_string (script_str2ptr (window), property);
- PERL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -5103,20 +3905,9 @@ XS (XS_weechat_api_window_get_pointer)
char *result, *window, *property;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "window_get_pointer");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "window_get_pointer", API_RETURN_EMPTY);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "window_get_pointer");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
window = SvPV_nolen (ST (0));
property = SvPV_nolen (ST (1));
@@ -5124,7 +3915,7 @@ XS (XS_weechat_api_window_get_pointer)
result = script_ptr2str (weechat_window_get_pointer (script_str2ptr (window),
property));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5135,24 +3926,13 @@ XS (XS_weechat_api_window_set_title)
{
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "window_set_title");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "window_set_title", API_RETURN_ERROR);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "window_set_title");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_window_set_title (SvPV_nolen (ST (0))); /* title */
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5164,20 +3944,9 @@ XS (XS_weechat_api_nicklist_add_group)
char *result, *buffer, *parent_group, *name, *color;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_add_group");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "nicklist_add_group", API_RETURN_EMPTY);
if (items < 5)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "nicklist_add_group");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = SvPV_nolen (ST (0));
parent_group = SvPV_nolen (ST (1));
@@ -5190,7 +3959,7 @@ XS (XS_weechat_api_nicklist_add_group)
color,
SvIV (ST (4)))); /* visible */
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5202,20 +3971,9 @@ XS (XS_weechat_api_nicklist_search_group)
char *result, *buffer, *from_group, *name;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_search_group");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "nicklist_search_group", API_RETURN_EMPTY);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "nicklist_search_group");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = SvPV_nolen (ST (0));
from_group = SvPV_nolen (ST (1));
@@ -5225,7 +3983,7 @@ XS (XS_weechat_api_nicklist_search_group)
script_str2ptr (from_group),
name));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5237,20 +3995,9 @@ XS (XS_weechat_api_nicklist_add_nick)
char *result, *buffer, *group, *name, *color, *prefix, *prefix_color;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_add_nick");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "nicklist_add_nick", API_RETURN_EMPTY);
if (items < 7)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "nicklist_add_nick");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = SvPV_nolen (ST (0));
group = SvPV_nolen (ST (1));
@@ -5267,7 +4014,7 @@ XS (XS_weechat_api_nicklist_add_nick)
prefix_color,
SvIV (ST (6)))); /* visible */
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5279,20 +4026,9 @@ XS (XS_weechat_api_nicklist_search_nick)
char *result, *buffer, *from_group, *name;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_search_nick");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "nicklist_search_nick", API_RETURN_EMPTY);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "nicklist_search_nick");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = SvPV_nolen (ST (0));
from_group = SvPV_nolen (ST (1));
@@ -5302,7 +4038,7 @@ XS (XS_weechat_api_nicklist_search_nick)
script_str2ptr (from_group),
name));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5314,20 +4050,9 @@ XS (XS_weechat_api_nicklist_remove_group)
char *buffer, *group;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_remove_group");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_remove_group", API_RETURN_ERROR);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "nicklist_remove_group");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = SvPV_nolen (ST (0));
group = SvPV_nolen (ST (1));
@@ -5335,7 +4060,7 @@ XS (XS_weechat_api_nicklist_remove_group)
weechat_nicklist_remove_group (script_str2ptr (buffer),
script_str2ptr (group));
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5347,20 +4072,9 @@ XS (XS_weechat_api_nicklist_remove_nick)
char *buffer, *nick;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_remove_nick");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_remove_nick", API_RETURN_ERROR);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "nicklist_remove_nick");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = SvPV_nolen (ST (0));
nick = SvPV_nolen (ST (1));
@@ -5368,7 +4082,7 @@ XS (XS_weechat_api_nicklist_remove_nick)
weechat_nicklist_remove_nick (script_str2ptr (buffer),
script_str2ptr (nick));
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5379,24 +4093,13 @@ XS (XS_weechat_api_nicklist_remove_all)
{
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_remove_all");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_remove_all", API_RETURN_ERROR);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "nicklist_remove_all");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_nicklist_remove_all (script_str2ptr (SvPV_nolen (ST (0)))); /* buffer */
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5409,20 +4112,9 @@ XS (XS_weechat_api_nicklist_group_get_integer)
int value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_group_get_integer");
- PERL_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "nicklist_group_get_integer", API_RETURN_INT(-1));
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "nicklist_group_get_integer");
- PERL_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
buffer = SvPV_nolen (ST (0));
group = SvPV_nolen (ST (1));
@@ -5432,7 +4124,7 @@ XS (XS_weechat_api_nicklist_group_get_integer)
script_str2ptr (group),
property);
- PERL_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -5445,20 +4137,9 @@ XS (XS_weechat_api_nicklist_group_get_string)
const char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_group_get_string");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "nicklist_group_get_string", API_RETURN_EMPTY);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "nicklist_group_get_string");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = SvPV_nolen (ST (0));
group = SvPV_nolen (ST (1));
@@ -5468,7 +4149,7 @@ XS (XS_weechat_api_nicklist_group_get_string)
script_str2ptr (group),
property);
- PERL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -5480,20 +4161,9 @@ XS (XS_weechat_api_nicklist_group_get_pointer)
char *result, *buffer, *group, *property;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_group_get_pointer");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "nicklist_group_get_pointer", API_RETURN_EMPTY);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "nicklist_group_get_pointer");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = SvPV_nolen (ST (0));
group = SvPV_nolen (ST (1));
@@ -5503,7 +4173,7 @@ XS (XS_weechat_api_nicklist_group_get_pointer)
script_str2ptr (group),
property));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5515,20 +4185,9 @@ XS (XS_weechat_api_nicklist_group_set)
char *buffer, *group, *property, *value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_group_set");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_group_set", API_RETURN_ERROR);
if (items < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "nicklist_group_set");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = SvPV_nolen (ST (0));
group = SvPV_nolen (ST (1));
@@ -5540,7 +4199,7 @@ XS (XS_weechat_api_nicklist_group_set)
property,
value);
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5553,20 +4212,9 @@ XS (XS_weechat_api_nicklist_nick_get_integer)
int value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_nick_get_integer");
- PERL_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "nicklist_nick_get_integer", API_RETURN_INT(-1));
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "nicklist_nick_get_integer");
- PERL_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
buffer = SvPV_nolen (ST (0));
nick = SvPV_nolen (ST (1));
@@ -5576,7 +4224,7 @@ XS (XS_weechat_api_nicklist_nick_get_integer)
script_str2ptr (nick),
property);
- PERL_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -5589,20 +4237,9 @@ XS (XS_weechat_api_nicklist_nick_get_string)
const char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_nick_get_string");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "nicklist_nick_get_string", API_RETURN_EMPTY);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "nicklist_nick_get_string");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = SvPV_nolen (ST (0));
nick = SvPV_nolen (ST (1));
@@ -5612,7 +4249,7 @@ XS (XS_weechat_api_nicklist_nick_get_string)
script_str2ptr (nick),
property);
- PERL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -5624,20 +4261,9 @@ XS (XS_weechat_api_nicklist_nick_get_pointer)
char *result, *buffer, *nick, *property;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_nick_get_pointer");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "nicklist_nick_get_pointer", API_RETURN_EMPTY);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "nicklist_nick_get_pointer");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = SvPV_nolen (ST (0));
nick = SvPV_nolen (ST (1));
@@ -5647,7 +4273,7 @@ XS (XS_weechat_api_nicklist_nick_get_pointer)
script_str2ptr (nick),
property));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5659,20 +4285,9 @@ XS (XS_weechat_api_nicklist_nick_set)
char *buffer, *nick, *property, *value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_nick_set");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_nick_set", API_RETURN_ERROR);
if (items < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "nicklist_nick_set");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = SvPV_nolen (ST (0));
nick = SvPV_nolen (ST (1));
@@ -5684,7 +4299,7 @@ XS (XS_weechat_api_nicklist_nick_set)
property,
value);
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5696,24 +4311,13 @@ XS (XS_weechat_api_bar_item_search)
char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "bar_item_search");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "bar_item_search", API_RETURN_EMPTY);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "bar_item_search");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_bar_item_search (SvPV_nolen (ST (0)))); /* name */
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5725,26 +4329,26 @@ weechat_perl_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
{
struct t_script_callback *script_callback;
- void *perl_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' }, *ret;
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = script_ptr2str (item);
- perl_argv[2] = script_ptr2str (window);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (item);
+ func_argv[2] = script_ptr2str (window);
ret = (char *)weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
- "sss", perl_argv);
+ "sss", func_argv);
- if (perl_argv[1])
- free (perl_argv[1]);
- if (perl_argv[2])
- free (perl_argv[2]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[2])
+ free (func_argv[2]);
return ret;
}
@@ -5761,20 +4365,9 @@ XS (XS_weechat_api_bar_item_new)
char *result, *name, *function, *data;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "bar_item_new");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "bar_item_new", API_RETURN_EMPTY);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "bar_item_new");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
name = SvPV_nolen (ST (0));
function = SvPV_nolen (ST (1));
@@ -5787,7 +4380,7 @@ XS (XS_weechat_api_bar_item_new)
function,
data));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5798,24 +4391,13 @@ XS (XS_weechat_api_bar_item_update)
{
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "bar_item_update");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "bar_item_update", API_RETURN_ERROR);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "bar_item_update");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_bar_item_update (SvPV_nolen (ST (0))); /* name */
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5826,26 +4408,15 @@ XS (XS_weechat_api_bar_item_remove)
{
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "bar_item_remove");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "bar_item_remove", API_RETURN_ERROR);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "bar_item_remove");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_bar_item_remove (weechat_perl_plugin,
perl_current_script,
script_str2ptr (SvPV_nolen (ST (0)))); /* item */
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5857,24 +4428,13 @@ XS (XS_weechat_api_bar_search)
char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "bar_search");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "bar_search", API_RETURN_EMPTY);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "bar_search");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_bar_search (SvPV_nolen (ST (0)))); /* name */
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5888,20 +4448,9 @@ XS (XS_weechat_api_bar_new)
char *color_delim, *color_bg, *separator, *bar_items;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "bar_new");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "bar_new", API_RETURN_EMPTY);
if (items < 15)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "bar_new");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
name = SvPV_nolen (ST (0));
hidden = SvPV_nolen (ST (1));
@@ -5935,7 +4484,7 @@ XS (XS_weechat_api_bar_new)
separator,
bar_items));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5947,20 +4496,9 @@ XS (XS_weechat_api_bar_set)
char *bar, *property, *value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "bar_set");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "bar_set", API_RETURN_ERROR);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "bar_set");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
bar = SvPV_nolen (ST (0));
property = SvPV_nolen (ST (1));
@@ -5968,7 +4506,7 @@ XS (XS_weechat_api_bar_set)
weechat_bar_set (script_str2ptr (bar), property, value);
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5979,24 +4517,13 @@ XS (XS_weechat_api_bar_update)
{
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "bar_update");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "bar_update", API_RETURN_ERROR);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "bar_update");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_bar_update (SvPV_nolen (ST (0))); /* name */
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6007,24 +4534,13 @@ XS (XS_weechat_api_bar_remove)
{
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "bar_remove");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "bar_remove", API_RETURN_ERROR);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "bar_remove");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_bar_remove (script_str2ptr (SvPV_nolen (ST (0)))); /* bar */
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6036,20 +4552,9 @@ XS (XS_weechat_api_command)
char *buffer, *command;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "command");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "command", API_RETURN_ERROR);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "command");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = SvPV_nolen (ST (0));
command = SvPV_nolen (ST (1));
@@ -6059,7 +4564,7 @@ XS (XS_weechat_api_command)
script_str2ptr (buffer),
command);
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6072,27 +4577,16 @@ XS (XS_weechat_api_info_get)
const char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "info_get");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "info_get", API_RETURN_EMPTY);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "info_get");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
info_name = SvPV_nolen (ST (0));
arguments = SvPV_nolen (ST (1));
result = weechat_info_get (info_name, arguments);
- PERL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -6106,20 +4600,9 @@ XS (XS_weechat_api_info_get_hashtable)
HV *result_hash;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "info_get_hashtable");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "info_get_hashtable", API_RETURN_EMPTY);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "info_get_hashtable");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
info_name = SvPV_nolen (ST (0));
hashtable = weechat_perl_hash_to_hashtable (ST (1),
@@ -6133,7 +4616,7 @@ XS (XS_weechat_api_info_get_hashtable)
if (result_hashtable)
weechat_hashtable_free (result_hashtable);
- PERL_RETURN_OBJ(result_hash);
+ API_RETURN_OBJ(result_hash);
}
/*
@@ -6149,15 +4632,11 @@ XS (XS_weechat_api_infolist_new)
(void) items;
(void) cv;
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_new");
- PERL_RETURN_EMPTY;
- }
+ API_FUNC(1, "infolist_new", API_RETURN_EMPTY);
result = script_ptr2str (weechat_infolist_new ());
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6169,26 +4648,15 @@ XS (XS_weechat_api_infolist_new_item)
char *infolist, *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_new_item");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_new_item", API_RETURN_EMPTY);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "infolist_new_item");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
infolist = SvPV_nolen (ST (0));
result = script_ptr2str (weechat_infolist_new_item (script_str2ptr (infolist)));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6200,20 +4668,9 @@ XS (XS_weechat_api_infolist_new_var_integer)
char *infolist, *name, *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_new_var_integer");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_new_var_integer", API_RETURN_EMPTY);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "infolist_new_var_integer");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
infolist = SvPV_nolen (ST (0));
name = SvPV_nolen (ST (1));
@@ -6222,7 +4679,7 @@ XS (XS_weechat_api_infolist_new_var_integer)
name,
SvIV (ST (2)))); /* value */
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6234,20 +4691,9 @@ XS (XS_weechat_api_infolist_new_var_string)
char *infolist, *name, *value, *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_new_var_string");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_new_var_string", API_RETURN_EMPTY);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "infolist_new_var_string");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
infolist = SvPV_nolen (ST (0));
name = SvPV_nolen (ST (1));
@@ -6257,7 +4703,7 @@ XS (XS_weechat_api_infolist_new_var_string)
name,
value));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6269,20 +4715,9 @@ XS (XS_weechat_api_infolist_new_var_pointer)
char *infolist, *name, *value, *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_new_var_pointer");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_new_var_pointer", API_RETURN_EMPTY);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "infolist_new_var_pointer");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
infolist = SvPV_nolen (ST (0));
name = SvPV_nolen (ST (1));
@@ -6292,7 +4727,7 @@ XS (XS_weechat_api_infolist_new_var_pointer)
name,
script_str2ptr (value)));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6304,20 +4739,9 @@ XS (XS_weechat_api_infolist_new_var_time)
char *infolist, *name, *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_new_var_time");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_new_var_time", API_RETURN_EMPTY);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "infolist_new_var_time");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
infolist = SvPV_nolen (ST (0));
name = SvPV_nolen (ST (1));
@@ -6326,7 +4750,7 @@ XS (XS_weechat_api_infolist_new_var_time)
name,
SvIV (ST (2)))); /* value */
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6338,20 +4762,9 @@ XS (XS_weechat_api_infolist_get)
char *result, *name, *pointer, *arguments;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_get");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_get", API_RETURN_EMPTY);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "infolist_get");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
name = SvPV_nolen (ST (0));
pointer = SvPV_nolen (ST (1));
@@ -6361,7 +4774,7 @@ XS (XS_weechat_api_infolist_get)
script_str2ptr (pointer),
arguments));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6373,24 +4786,13 @@ XS (XS_weechat_api_infolist_next)
int value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_next");
- PERL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "infolist_next", API_RETURN_INT(0));
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "infolist_next");
- PERL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_infolist_next (script_str2ptr (SvPV_nolen (ST (0)))); /* infolist */
- PERL_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -6402,24 +4804,13 @@ XS (XS_weechat_api_infolist_prev)
int value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_prev");
- PERL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "infolist_prev", API_RETURN_INT(0));
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "infolist_prev");
- PERL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_infolist_prev (script_str2ptr (SvPV_nolen (ST (0)))); /* infolist */
- PERL_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -6431,24 +4822,13 @@ XS (XS_weechat_api_infolist_reset_item_cursor)
{
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_reset_item_cursor");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "infolist_reset_item_cursor", API_RETURN_ERROR);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "infolist_reset_item_cursor");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_infolist_reset_item_cursor (script_str2ptr (SvPV_nolen (ST (0)))); /* infolist */
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6460,24 +4840,13 @@ XS (XS_weechat_api_infolist_fields)
const char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_fields");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_fields", API_RETURN_EMPTY);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "infolist_fields");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_infolist_fields (script_str2ptr (SvPV_nolen (ST (0)))); /* infolist */
- PERL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -6490,27 +4859,16 @@ XS (XS_weechat_api_infolist_integer)
int value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_integer");
- PERL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "infolist_integer", API_RETURN_INT(0));
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "infolist_integer");
- PERL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
infolist = SvPV_nolen (ST (0));
variable = SvPV_nolen (ST (1));
value = weechat_infolist_integer (script_str2ptr (infolist), variable);
- PERL_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -6523,27 +4881,16 @@ XS (XS_weechat_api_infolist_string)
const char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_string");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_string", API_RETURN_EMPTY);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "infolist_string");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
infolist = SvPV_nolen (ST (0));
variable = SvPV_nolen (ST (1));
result = weechat_infolist_string (script_str2ptr (infolist), variable);
- PERL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -6556,27 +4903,16 @@ XS (XS_weechat_api_infolist_pointer)
char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_pointer");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_pointer", API_RETURN_EMPTY);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "infolist_pointer");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
infolist = SvPV_nolen (ST (0));
variable = SvPV_nolen (ST (1));
result = script_ptr2str (weechat_infolist_pointer (script_str2ptr (infolist), variable));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6589,20 +4925,9 @@ XS (XS_weechat_api_infolist_time)
char timebuffer[64], *result, *infolist, *variable;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_time");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_time", API_RETURN_EMPTY);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "infolist_time");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
infolist = SvPV_nolen (ST (0));
variable = SvPV_nolen (ST (1));
@@ -6610,7 +4935,7 @@ XS (XS_weechat_api_infolist_time)
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
result = strdup (timebuffer);
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6621,24 +4946,13 @@ XS (XS_weechat_api_infolist_free)
{
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_free");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "infolist_free", API_RETURN_ERROR);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "infolist_free");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_infolist_free (script_str2ptr (SvPV_nolen (ST (0)))); /* infolist */
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6650,26 +4964,15 @@ XS (XS_weechat_api_hdata_get)
char *result, *name;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hdata_get");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_get", API_RETURN_EMPTY);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hdata_get");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
name = SvPV_nolen (ST (0));
result = script_ptr2str (weechat_hdata_get (name));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6682,27 +4985,16 @@ XS (XS_weechat_api_hdata_get_var_offset)
int value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hdata_get_var_offset");
- PERL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "hdata_get_var_offset", API_RETURN_INT(0));
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hdata_get_var_offset");
- PERL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
hdata = SvPV_nolen (ST (0));
name = SvPV_nolen (ST (1));
value = weechat_hdata_get_var_offset (script_str2ptr (hdata), name);
- PERL_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -6715,27 +5007,16 @@ XS (XS_weechat_api_hdata_get_var_type_string)
char *hdata, *name;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hdata_get_var_type_string");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_get_var_type_string", API_RETURN_EMPTY);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hdata_get_var_type_string");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
hdata = SvPV_nolen (ST (0));
name = SvPV_nolen (ST (1));
result = weechat_hdata_get_var_type_string (script_str2ptr (hdata), name);
- PERL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -6748,27 +5029,16 @@ XS (XS_weechat_api_hdata_get_var_hdata)
char *hdata, *name;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hdata_get_var_hdata");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_get_var_hdata", API_RETURN_EMPTY);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hdata_get_var_hdata");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
hdata = SvPV_nolen (ST (0));
name = SvPV_nolen (ST (1));
result = weechat_hdata_get_var_hdata (script_str2ptr (hdata), name);
- PERL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -6781,20 +5051,9 @@ XS (XS_weechat_api_hdata_get_list)
char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hdata_get_list");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_get_list", API_RETURN_EMPTY);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hdata_get_list");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
hdata = SvPV_nolen (ST (0));
name = SvPV_nolen (ST (1));
@@ -6802,7 +5061,7 @@ XS (XS_weechat_api_hdata_get_list)
result = script_ptr2str (weechat_hdata_get_list (script_str2ptr (hdata),
name));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6815,20 +5074,9 @@ XS (XS_weechat_api_hdata_move)
int count;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hdata_move");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_move", API_RETURN_EMPTY);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hdata_move");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
hdata = SvPV_nolen (ST (0));
pointer = SvPV_nolen (ST (1));
@@ -6838,7 +5086,7 @@ XS (XS_weechat_api_hdata_move)
script_str2ptr (pointer),
count));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6852,20 +5100,9 @@ XS (XS_weechat_api_hdata_integer)
int value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hdata_integer");
- PERL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "hdata_integer", API_RETURN_INT(0));
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hdata_integer");
- PERL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
hdata = SvPV_nolen (ST (0));
pointer = SvPV_nolen (ST (1));
@@ -6875,7 +5112,7 @@ XS (XS_weechat_api_hdata_integer)
script_str2ptr (pointer),
name);
- PERL_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -6888,20 +5125,9 @@ XS (XS_weechat_api_hdata_long)
long value;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hdata_long");
- PERL_RETURN_LONG(0);
- }
-
+ API_FUNC(1, "hdata_long", API_RETURN_LONG(0));
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hdata_long");
- PERL_RETURN_LONG(0);
- }
+ API_WRONG_ARGS(API_RETURN_LONG(0));
hdata = SvPV_nolen (ST (0));
pointer = SvPV_nolen (ST (1));
@@ -6911,7 +5137,7 @@ XS (XS_weechat_api_hdata_long)
script_str2ptr (pointer),
name);
- PERL_RETURN_LONG(value);
+ API_RETURN_LONG(value);
}
/*
@@ -6925,20 +5151,9 @@ XS (XS_weechat_api_hdata_string)
const char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hdata_string");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_string", API_RETURN_EMPTY);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hdata_string");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
hdata = SvPV_nolen (ST (0));
pointer = SvPV_nolen (ST (1));
@@ -6948,7 +5163,7 @@ XS (XS_weechat_api_hdata_string)
script_str2ptr (pointer),
name);
- PERL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -6962,20 +5177,9 @@ XS (XS_weechat_api_hdata_pointer)
char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hdata_pointer");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_pointer", API_RETURN_EMPTY);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hdata_pointer");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
hdata = SvPV_nolen (ST (0));
pointer = SvPV_nolen (ST (1));
@@ -6985,7 +5189,7 @@ XS (XS_weechat_api_hdata_pointer)
script_str2ptr (pointer),
name));
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6998,20 +5202,9 @@ XS (XS_weechat_api_hdata_time)
char timebuffer[64], *result, *hdata, *pointer, *name;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hdata_time");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_time", API_RETURN_EMPTY);
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hdata_time");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
hdata = SvPV_nolen (ST (0));
pointer = SvPV_nolen (ST (1));
@@ -7023,7 +5216,7 @@ XS (XS_weechat_api_hdata_time)
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
result = strdup (timebuffer);
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7036,27 +5229,16 @@ XS (XS_weechat_api_hdata_get_string)
const char *result;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hdata_get_string");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_get_string", API_RETURN_EMPTY);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hdata_get_string");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
hdata = SvPV_nolen (ST (0));
property = SvPV_nolen (ST (1));
result = weechat_hdata_get_string (script_str2ptr (hdata), property);
- PERL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -7068,27 +5250,16 @@ XS (XS_weechat_api_upgrade_new)
char *result, *filename;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "upgrade_new");
- PERL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "upgrade_new", API_RETURN_EMPTY);
if (items < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "upgrade_new");
- PERL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
filename = SvPV_nolen (ST (0));
result = script_ptr2str (weechat_upgrade_new (filename,
SvIV (ST (1)))); /* write */
- PERL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7101,20 +5272,9 @@ XS (XS_weechat_api_upgrade_write_object)
int rc;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "upgrade_write_object");
- PERL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "upgrade_write_object", API_RETURN_INT(0));
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "upgrade_write_object");
- PERL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
upgrade_file = SvPV_nolen (ST (0));
infolist = SvPV_nolen (ST (2));
@@ -7123,7 +5283,7 @@ XS (XS_weechat_api_upgrade_write_object)
SvIV (ST (1)), /* object_id */
script_str2ptr (infolist));
- PERL_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -7137,7 +5297,7 @@ weechat_perl_api_upgrade_read_cb (void *data,
struct t_infolist *infolist)
{
struct t_script_callback *script_callback;
- void *perl_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' }, str_object_id[32];
int *rc, ret;
@@ -7147,15 +5307,15 @@ weechat_perl_api_upgrade_read_cb (void *data,
{
snprintf (str_object_id, sizeof (str_object_id), "%d", object_id);
- perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- perl_argv[1] = script_ptr2str (upgrade_file);
- perl_argv[2] = str_object_id;
- perl_argv[3] = script_ptr2str (infolist);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (upgrade_file);
+ func_argv[2] = str_object_id;
+ func_argv[3] = script_ptr2str (infolist);
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ssss", perl_argv);
+ "ssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -7164,10 +5324,10 @@ weechat_perl_api_upgrade_read_cb (void *data,
ret = *rc;
free (rc);
}
- if (perl_argv[1])
- free (perl_argv[1]);
- if (perl_argv[3])
- free (perl_argv[3]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[3])
+ free (func_argv[3]);
return ret;
}
@@ -7185,20 +5345,9 @@ XS (XS_weechat_api_upgrade_read)
int rc;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "upgrade_read");
- PERL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "upgrade_read", API_RETURN_INT(0));
if (items < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "upgrade_read");
- PERL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
upgrade_file = SvPV_nolen (ST (0));
function = SvPV_nolen (ST (1));
@@ -7211,7 +5360,7 @@ XS (XS_weechat_api_upgrade_read)
function,
data);
- PERL_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -7223,26 +5372,15 @@ XS (XS_weechat_api_upgrade_close)
char *upgrade_file;
dXSARGS;
- /* make C compiler happy */
- (void) cv;
-
- if (!perl_current_script || !perl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "upgrade_close");
- PERL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "upgrade_close", API_RETURN_ERROR);
if (items < 1)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "upgrade_close");
- PERL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
upgrade_file = SvPV_nolen (ST (0));
weechat_upgrade_close (script_str2ptr (upgrade_file));
- PERL_RETURN_OK;
+ API_RETURN_OK;
}
/*
diff --git a/src/plugins/scripts/perl/weechat-perl.c b/src/plugins/scripts/perl/weechat-perl.c
index 3ab70faa0..8d6b30195 100644
--- a/src/plugins/scripts/perl/weechat-perl.c
+++ b/src/plugins/scripts/perl/weechat-perl.c
@@ -555,7 +555,7 @@ weechat_perl_load_cb (void *data, const char *filename)
void
weechat_perl_unload (struct t_plugin_script *script)
{
- int *r;
+ int *rc;
void *interpreter;
if ((weechat_perl_plugin->debug >= 1) || !perl_quiet)
@@ -573,12 +573,12 @@ weechat_perl_unload (struct t_plugin_script *script)
if (script->shutdown_func && script->shutdown_func[0])
{
- r = (int *) weechat_perl_exec (script,
+ rc = (int *)weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
script->shutdown_func,
NULL, NULL);
- if (r)
- free (r);
+ if (rc)
+ free (rc);
}
interpreter = script->interpreter;
diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c
index 9401eff2e..78c308605 100644
--- a/src/plugins/scripts/python/weechat-python-api.c
+++ b/src/plugins/scripts/python/weechat-python-api.c
@@ -34,27 +34,43 @@
#include "weechat-python.h"
-#define PYTHON_RETURN_OK return Py_BuildValue ("i", 1);
-#define PYTHON_RETURN_ERROR return Py_BuildValue ("i", 0);
-#define PYTHON_RETURN_EMPTY \
- Py_INCREF(Py_None); \
+#define API_FUNC(__init, __name, __ret) \
+ char *python_function_name = __name; \
+ (void) self; \
+ if (__init \
+ && (!python_current_script || !python_current_script->name)) \
+ { \
+ WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, \
+ python_function_name); \
+ __ret; \
+ }
+#define API_WRONG_ARGS(__ret) \
+ { \
+ WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, \
+ python_function_name); \
+ __ret; \
+ }
+#define API_RETURN_OK return Py_BuildValue ("i", 1);
+#define API_RETURN_ERROR return Py_BuildValue ("i", 0);
+#define API_RETURN_EMPTY \
+ Py_INCREF (Py_None); \
return Py_None;
-#define PYTHON_RETURN_STRING(__string) \
+#define API_RETURN_STRING(__string) \
if (__string) \
return Py_BuildValue ("s", __string); \
return Py_BuildValue ("s", "")
-#define PYTHON_RETURN_STRING_FREE(__string) \
+#define API_RETURN_STRING_FREE(__string) \
if (__string) \
{ \
- object = Py_BuildValue ("s", __string); \
+ return_value = Py_BuildValue ("s", __string); \
free (__string); \
- return object; \
+ return return_value; \
} \
return Py_BuildValue ("s", "")
-#define PYTHON_RETURN_INT(__int) \
- return Py_BuildValue("i", __int);
-#define PYTHON_RETURN_LONG(__long) \
- return Py_BuildValue("l", __long);
+#define API_RETURN_INT(__int) \
+ return Py_BuildValue ("i", __int);
+#define API_RETURN_LONG(__long) \
+ return Py_BuildValue ("l", __long);
/*
@@ -67,12 +83,9 @@ weechat_python_api_register (PyObject *self, PyObject *args)
char *name, *author, *version, *license, *shutdown_func, *description;
char *charset;
- /* make C compiler happy */
- (void) self;
-
+ API_FUNC(0, "register", API_RETURN_ERROR);
python_current_script = NULL;
python_registered_script = NULL;
-
name = NULL;
author = NULL;
version = NULL;
@@ -80,13 +93,9 @@ weechat_python_api_register (PyObject *self, PyObject *args)
description = NULL;
shutdown_func = NULL;
charset = NULL;
-
if (!PyArg_ParseTuple (args, "sssssss", &name, &author, &version,
&license, &description, &shutdown_func, &charset))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(python_current_script_filename, "register");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
if (script_search (weechat_python_plugin, python_scripts, name))
{
@@ -96,7 +105,7 @@ weechat_python_api_register (PyObject *self, PyObject *args)
"\"%s\" (another script already "
"exists with this name)"),
weechat_prefix ("error"), PYTHON_PLUGIN_NAME, name);
- PYTHON_RETURN_ERROR;
+ API_RETURN_ERROR;
}
/* register script */
@@ -119,10 +128,10 @@ weechat_python_api_register (PyObject *self, PyObject *args)
}
else
{
- PYTHON_RETURN_ERROR;
+ API_RETURN_ERROR;
}
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -136,26 +145,14 @@ weechat_python_api_plugin_get_name (PyObject *self, PyObject *args)
char *plugin;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "plugin_get_name");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "plugin_get_name", API_RETURN_EMPTY);
plugin = NULL;
-
if (!PyArg_ParseTuple (args, "s", &plugin))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "plugin_get_name");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_plugin_get_name (script_str2ptr (plugin));
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -167,27 +164,15 @@ weechat_python_api_charset_set (PyObject *self, PyObject *args)
{
char *charset;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "charset_set");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "charset_set", API_RETURN_ERROR);
charset = NULL;
-
if (!PyArg_ParseTuple (args, "s", &charset))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "charset_set");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_charset_set (python_current_script,
charset);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -198,29 +183,17 @@ static PyObject *
weechat_python_api_iconv_to_internal (PyObject *self, PyObject *args)
{
char *charset, *string, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "iconv_to_internal");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "iconv_to_internal", API_RETURN_EMPTY);
charset = NULL;
string = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &charset, &string))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "iconv_to_internal");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_iconv_to_internal (charset, string);
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -232,29 +205,17 @@ static PyObject *
weechat_python_api_iconv_from_internal (PyObject *self, PyObject *args)
{
char *charset, *string, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "iconv_from_internal");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "iconv_from_internal", API_RETURN_EMPTY);
charset = NULL;
string = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &charset, &string))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "iconv_from_internal");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_iconv_from_internal (charset, string);
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -267,26 +228,14 @@ weechat_python_api_gettext (PyObject *self, PyObject *args)
char *string;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "gettext");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "gettext", API_RETURN_EMPTY);
string = NULL;
-
if (!PyArg_ParseTuple (args, "s", &string))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "gettext");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_gettext (string);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -300,28 +249,16 @@ weechat_python_api_ngettext (PyObject *self, PyObject *args)
const char *result;
int count;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "ngettext");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "ngettext", API_RETURN_EMPTY);
single = NULL;
plural = NULL;
count = 0;
-
if (!PyArg_ParseTuple (args, "ssi", &single, &plural, &count))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "ngettext");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_ngettext (single, plural, count);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -336,28 +273,16 @@ weechat_python_api_string_match (PyObject *self, PyObject *args)
char *string, *mask;
int case_sensitive, value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "string_match");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "string_match", API_RETURN_INT(0));
string = NULL;
mask = NULL;
case_sensitive = 0;
-
if (!PyArg_ParseTuple (args, "ssi", &string, &mask, &case_sensitive))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "string_match");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_string_match (string, mask, case_sensitive);
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -374,27 +299,15 @@ weechat_python_api_string_has_highlight (PyObject *self, PyObject *args)
char *string, *highlight_words;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "string_has_highlight");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "string_has_highlight", API_RETURN_INT(0));
string = NULL;
highlight_words = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &string, &highlight_words))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "string_has_highlight");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_string_has_highlight (string, highlight_words);
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -411,27 +324,15 @@ weechat_python_api_string_has_highlight_regex (PyObject *self, PyObject *args)
char *string, *regex;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "string_has_highlight_regex");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "string_has_highlight_regex", API_RETURN_INT(0));
string = NULL;
regex = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &string, &regex))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "string_has_highlight_regex");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_string_has_highlight_regex (string, regex);
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -445,28 +346,16 @@ static PyObject *
weechat_python_api_string_mask_to_regex (PyObject *self, PyObject *args)
{
char *mask, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "string_mask_to_regex");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "string_mask_to_regex", API_RETURN_EMPTY);
mask = NULL;
-
if (!PyArg_ParseTuple (args, "s", &mask))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "string_mask_to_regex");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_string_mask_to_regex (mask);
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -478,29 +367,17 @@ static PyObject *
weechat_python_api_string_remove_color (PyObject *self, PyObject *args)
{
char *string, *replacement, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "string_remove_color");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "string_remove_color2", API_RETURN_EMPTY);
string = NULL;
replacement = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &string, &replacement))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "string_remove_color");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_string_remove_color (string, replacement);
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -514,26 +391,14 @@ weechat_python_api_string_is_command_char (PyObject *self, PyObject *args)
char *string;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "string_is_command_char");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "string_is_command_char", API_RETURN_INT(0));
string = NULL;
-
if (!PyArg_ParseTuple (args, "s", &string))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "string_is_command_char");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_string_is_command_char (string);
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -548,26 +413,14 @@ weechat_python_api_string_input_for_buffer (PyObject *self, PyObject *args)
char *string;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "string_input_for_buffer");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "string_input_for_buffer", API_RETURN_EMPTY);
string = NULL;
-
if (!PyArg_ParseTuple (args, "s", &string))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "string_input_for_buffer");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_string_input_for_buffer (string);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -580,28 +433,16 @@ weechat_python_api_mkdir_home (PyObject *self, PyObject *args)
char *directory;
int mode;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "mkdir_home");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "mkdir_home", API_RETURN_ERROR);
directory = NULL;
mode = 0;
-
if (!PyArg_ParseTuple (args, "si", &directory, &mode))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "mkdir_home");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
if (weechat_mkdir_home (directory, mode))
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
- PYTHON_RETURN_ERROR;
+ API_RETURN_ERROR;
}
/*
@@ -614,28 +455,16 @@ weechat_python_api_mkdir (PyObject *self, PyObject *args)
char *directory;
int mode;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "mkdir");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "mkdir", API_RETURN_ERROR);
directory = NULL;
mode = 0;
-
if (!PyArg_ParseTuple (args, "si", &directory, &mode))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "mkdir");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
if (weechat_mkdir (directory, mode))
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
- PYTHON_RETURN_ERROR;
+ API_RETURN_ERROR;
}
/*
@@ -649,28 +478,16 @@ weechat_python_api_mkdir_parents (PyObject *self, PyObject *args)
char *directory;
int mode;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "mkdir_parents");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "mkdir_parents", API_RETURN_ERROR);
directory = NULL;
mode = 0;
-
if (!PyArg_ParseTuple (args, "si", &directory, &mode))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "mkdir_parents");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
if (weechat_mkdir_parents (directory, mode))
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
- PYTHON_RETURN_ERROR;
+ API_RETURN_ERROR;
}
/*
@@ -681,21 +498,16 @@ static PyObject *
weechat_python_api_list_new (PyObject *self, PyObject *args)
{
char *result;
- PyObject *object;
+ PyObject *return_value;
/* make C compiler happy */
- (void) self;
(void) args;
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_new");
- PYTHON_RETURN_EMPTY;
- }
+ API_FUNC(1, "list_new", API_RETURN_EMPTY);
result = script_ptr2str (weechat_list_new ());
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -706,34 +518,22 @@ static PyObject *
weechat_python_api_list_add (PyObject *self, PyObject *args)
{
char *weelist, *data, *where, *user_data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_add");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "list_add", API_RETURN_EMPTY);
weelist = NULL;
data = NULL;
where = NULL;
user_data = NULL;
-
if (!PyArg_ParseTuple (args, "ssss", &weelist, &data, &where, &user_data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "list_add");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_list_add (script_str2ptr (weelist),
data,
where,
script_str2ptr (user_data)));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -744,30 +544,18 @@ static PyObject *
weechat_python_api_list_search (PyObject *self, PyObject *args)
{
char *weelist, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_search");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "list_search", API_RETURN_EMPTY);
weelist = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &weelist, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "list_search");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_list_search (script_str2ptr (weelist),
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -780,27 +568,15 @@ weechat_python_api_list_search_pos (PyObject *self, PyObject *args)
char *weelist, *data;
int pos;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_search_pos");
- PYTHON_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "list_search_pos", API_RETURN_INT(-1));
weelist = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &weelist, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "list_search_pos");
- PYTHON_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
pos = weechat_list_search_pos (script_str2ptr (weelist), data);
- PYTHON_RETURN_INT(pos);
+ API_RETURN_INT(pos);
}
/*
@@ -811,30 +587,18 @@ static PyObject *
weechat_python_api_list_casesearch (PyObject *self, PyObject *args)
{
char *weelist, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_casesearch");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "list_casesearch", API_RETURN_EMPTY);
weelist = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &weelist, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "list_casesearch");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_list_casesearch (script_str2ptr (weelist),
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -848,27 +612,15 @@ weechat_python_api_list_casesearch_pos (PyObject *self, PyObject *args)
char *weelist, *data;
int pos;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_casesearch_pos");
- PYTHON_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "list_casesearch_pos", API_RETURN_INT(-1));
weelist = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &weelist, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "list_casesearch_pos");
- PYTHON_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
pos = weechat_list_casesearch_pos (script_str2ptr (weelist), data);
- PYTHON_RETURN_INT(pos);
+ API_RETURN_INT(pos);
}
/*
@@ -880,29 +632,17 @@ weechat_python_api_list_get (PyObject *self, PyObject *args)
{
char *weelist, *result;
int position;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_get");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "list_get", API_RETURN_EMPTY);
weelist = NULL;
position = 0;
-
if (!PyArg_ParseTuple (args, "si", &weelist, &position))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "list_get");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_list_get (script_str2ptr (weelist),
position));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -914,28 +654,16 @@ weechat_python_api_list_set (PyObject *self, PyObject *args)
{
char *item, *new_value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_set");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "list_set", API_RETURN_ERROR);
item = NULL;
new_value = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &item, &new_value))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "list_set");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_list_set (script_str2ptr (item),
new_value);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -946,28 +674,16 @@ static PyObject *
weechat_python_api_list_next (PyObject *self, PyObject *args)
{
char *item, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_next");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "list_next", API_RETURN_EMPTY);
item = NULL;
-
if (!PyArg_ParseTuple (args, "s", &item))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "list_next");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_list_next (script_str2ptr (item)));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -978,28 +694,16 @@ static PyObject *
weechat_python_api_list_prev (PyObject *self, PyObject *args)
{
char *item, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_prev");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "list_prev", API_RETURN_EMPTY);
item = NULL;
-
if (!PyArg_ParseTuple (args, "s", &item))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "list_prev");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_list_prev (script_str2ptr (item)));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1012,26 +716,14 @@ weechat_python_api_list_string (PyObject *self, PyObject *args)
char *item;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_string");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "list_string", API_RETURN_EMPTY);
item = NULL;
-
if (!PyArg_ParseTuple (args, "s", &item))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "list_string");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_list_string (script_str2ptr (item));
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -1044,26 +736,14 @@ weechat_python_api_list_size (PyObject *self, PyObject *args)
char *weelist;
int size;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_size");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "list_size", API_RETURN_INT(0));
weelist = NULL;
-
if (!PyArg_ParseTuple (args, "s", &weelist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "list_size");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
size = weechat_list_size (script_str2ptr (weelist));
- PYTHON_RETURN_INT(size);
+ API_RETURN_INT(size);
}
/*
@@ -1075,28 +755,16 @@ weechat_python_api_list_remove (PyObject *self, PyObject *args)
{
char *weelist, *item;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_remove");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "list_remove", API_RETURN_ERROR);
weelist = NULL;
item = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &weelist, &item))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "list_remove");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_list_remove (script_str2ptr (weelist),
script_str2ptr (item));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -1108,26 +776,14 @@ weechat_python_api_list_remove_all (PyObject *self, PyObject *args)
{
char *weelist;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_remove_all");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "list_remove_all", API_RETURN_ERROR);
weelist = NULL;
-
if (!PyArg_ParseTuple (args, "s", &weelist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "list_remove_all");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_list_remove_all (script_str2ptr (weelist));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -1139,26 +795,14 @@ weechat_python_api_list_free (PyObject *self, PyObject *args)
{
char *weelist;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "list_free");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "list_free", API_RETURN_ERROR);
weelist = NULL;
-
if (!PyArg_ParseTuple (args, "s", &weelist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "list_free");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_list_free (script_str2ptr (weelist));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -1170,7 +814,7 @@ weechat_python_api_config_reload_cb (void *data,
struct t_config_file *config_file)
{
struct t_script_callback *script_callback;
- void *python_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1178,13 +822,13 @@ weechat_python_api_config_reload_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (config_file);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", python_argv);
+ "ss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
@@ -1193,8 +837,8 @@ weechat_python_api_config_reload_cb (void *data,
ret = *rc;
free (rc);
}
- if (python_argv[1])
- free (python_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -1210,26 +854,14 @@ static PyObject *
weechat_python_api_config_new (PyObject *self, PyObject *args)
{
char *name, *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_new");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "config_new", API_RETURN_EMPTY);
name = NULL;
function = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &name, &function, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_new");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_config_new (weechat_python_plugin,
python_current_script,
@@ -1238,7 +870,7 @@ weechat_python_api_config_new (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1252,7 +884,7 @@ weechat_python_api_config_read_cb (void *data,
const char *option_name, const char *value)
{
struct t_script_callback *script_callback;
- void *python_argv[5];
+ void *func_argv[5];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1260,16 +892,16 @@ weechat_python_api_config_read_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (config_file);
- python_argv[2] = script_ptr2str (section);
- python_argv[3] = (option_name) ? (char *)option_name : empty_arg;
- python_argv[4] = (value) ? (char *)value : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
+ func_argv[2] = script_ptr2str (section);
+ func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
+ func_argv[4] = (value) ? (char *)value : empty_arg;
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sssss", python_argv);
+ "sssss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
@@ -1278,10 +910,10 @@ weechat_python_api_config_read_cb (void *data,
ret = *rc;
free (rc);
}
- if (python_argv[1])
- free (python_argv[1]);
- if (python_argv[2])
- free (python_argv[2]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[2])
+ free (func_argv[2]);
return ret;
}
@@ -1299,7 +931,7 @@ weechat_python_api_config_section_write_cb (void *data,
const char *section_name)
{
struct t_script_callback *script_callback;
- void *python_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1307,14 +939,14 @@ weechat_python_api_config_section_write_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (config_file);
- python_argv[2] = (section_name) ? (char *)section_name : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
+ func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", python_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_WRITE_ERROR;
@@ -1323,8 +955,8 @@ weechat_python_api_config_section_write_cb (void *data,
ret = *rc;
free (rc);
}
- if (python_argv[1])
- free (python_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -1343,7 +975,7 @@ weechat_python_api_config_section_write_default_cb (void *data,
const char *section_name)
{
struct t_script_callback *script_callback;
- void *python_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1351,14 +983,14 @@ weechat_python_api_config_section_write_default_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (config_file);
- python_argv[2] = (section_name) ? (char *)section_name : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
+ func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", python_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_WRITE_ERROR;
@@ -1367,8 +999,8 @@ weechat_python_api_config_section_write_default_cb (void *data,
ret = *rc;
free (rc);
}
- if (python_argv[1])
- free (python_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -1388,7 +1020,7 @@ weechat_python_api_config_section_create_option_cb (void *data,
const char *value)
{
struct t_script_callback *script_callback;
- void *python_argv[5];
+ void *func_argv[5];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1396,16 +1028,16 @@ weechat_python_api_config_section_create_option_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (config_file);
- python_argv[2] = script_ptr2str (section);
- python_argv[3] = (option_name) ? (char *)option_name : empty_arg;
- python_argv[4] = (value) ? (char *)value : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
+ func_argv[2] = script_ptr2str (section);
+ func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
+ func_argv[4] = (value) ? (char *)value : empty_arg;
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sssss", python_argv);
+ "sssss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
@@ -1414,10 +1046,10 @@ weechat_python_api_config_section_create_option_cb (void *data,
ret = *rc;
free (rc);
}
- if (python_argv[1])
- free (python_argv[1]);
- if (python_argv[2])
- free (python_argv[2]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[2])
+ free (func_argv[2]);
return ret;
}
@@ -1436,7 +1068,7 @@ weechat_python_api_config_section_delete_option_cb (void *data,
struct t_config_option *option)
{
struct t_script_callback *script_callback;
- void *python_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1444,15 +1076,15 @@ weechat_python_api_config_section_delete_option_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (config_file);
- python_argv[2] = script_ptr2str (section);
- python_argv[3] = script_ptr2str (option);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
+ func_argv[2] = script_ptr2str (section);
+ func_argv[3] = script_ptr2str (option);
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ssss", python_argv);
+ "ssss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_OPTION_UNSET_ERROR;
@@ -1461,12 +1093,12 @@ weechat_python_api_config_section_delete_option_cb (void *data,
ret = *rc;
free (rc);
}
- if (python_argv[1])
- free (python_argv[1]);
- if (python_argv[2])
- free (python_argv[2]);
- if (python_argv[3])
- free (python_argv[3]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[2])
+ free (func_argv[2]);
+ if (func_argv[3])
+ free (func_argv[3]);
return ret;
}
@@ -1486,17 +1118,9 @@ weechat_python_api_config_new_section (PyObject *self, PyObject *args)
char *function_create_option, *data_create_option, *function_delete_option;
char *data_delete_option, *result;
int user_can_add_options, user_can_delete_options;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_new_section");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "config_new_section", API_RETURN_EMPTY);
config_file = NULL;
name = NULL;
user_can_add_options = 0;
@@ -1511,7 +1135,6 @@ weechat_python_api_config_new_section (PyObject *self, PyObject *args)
data_create_option = NULL;
function_delete_option = NULL;
data_delete_option = NULL;
-
if (!PyArg_ParseTuple (args, "ssiissssssssss", &config_file, &name,
&user_can_add_options, &user_can_delete_options,
&function_read, &data_read, &function_write,
@@ -1519,10 +1142,7 @@ weechat_python_api_config_new_section (PyObject *self, PyObject *args)
&data_write_default, &function_create_option,
&data_create_option, &function_delete_option,
&data_delete_option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_new_section");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_config_new_section (weechat_python_plugin,
python_current_script,
@@ -1546,7 +1166,7 @@ weechat_python_api_config_new_section (PyObject *self, PyObject *args)
function_delete_option,
data_delete_option));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1557,30 +1177,18 @@ static PyObject *
weechat_python_api_config_search_section (PyObject *self, PyObject *args)
{
char *config_file, *section_name, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_search_section");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "config_search_section", API_RETURN_EMPTY);
config_file = NULL;
section_name = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &config_file, &section_name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_search_section");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_config_search_section (script_str2ptr (config_file),
section_name));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1594,7 +1202,7 @@ weechat_python_api_config_option_check_value_cb (void *data,
const char *value)
{
struct t_script_callback *script_callback;
- void *python_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1602,14 +1210,14 @@ weechat_python_api_config_option_check_value_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (option);
- python_argv[2] = (value) ? (char *)value : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (option);
+ func_argv[2] = (value) ? (char *)value : empty_arg;
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", python_argv);
+ "sss", func_argv);
if (!rc)
ret = 0;
@@ -1618,8 +1226,8 @@ weechat_python_api_config_option_check_value_cb (void *data,
ret = *rc;
free (rc);
}
- if (python_argv[1])
- free (python_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -1636,7 +1244,7 @@ weechat_python_api_config_option_change_cb (void *data,
struct t_config_option *option)
{
struct t_script_callback *script_callback;
- void *python_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc;
@@ -1644,16 +1252,16 @@ weechat_python_api_config_option_change_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (option);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (option);
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", python_argv);
+ "ss", func_argv);
- if (python_argv[1])
- free (python_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
if (rc)
free (rc);
@@ -1669,7 +1277,7 @@ weechat_python_api_config_option_delete_cb (void *data,
struct t_config_option *option)
{
struct t_script_callback *script_callback;
- void *python_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc;
@@ -1677,16 +1285,16 @@ weechat_python_api_config_option_delete_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (option);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (option);
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", python_argv);
+ "ss", func_argv);
- if (python_argv[1])
- free (python_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
if (rc)
free (rc);
@@ -1705,17 +1313,9 @@ weechat_python_api_config_new_option (PyObject *self, PyObject *args)
char *function_check_value, *data_check_value, *function_change;
char *data_change, *function_delete, *data_delete;
int min, max, null_value_allowed;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_new_option");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "config_new_option", API_RETURN_EMPTY);
config_file = NULL;
section = NULL;
name = NULL;
@@ -1730,17 +1330,13 @@ weechat_python_api_config_new_option (PyObject *self, PyObject *args)
data_change = NULL;
function_delete = NULL;
data_delete = NULL;
-
if (!PyArg_ParseTuple (args, "ssssssiississssss", &config_file, &section, &name,
&type, &description, &string_values, &min, &max,
&default_value, &value, &null_value_allowed,
&function_check_value, &data_check_value,
&function_change, &data_change, &function_delete,
&data_delete))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_new_option");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_config_new_option (weechat_python_plugin,
python_current_script,
@@ -1765,7 +1361,7 @@ weechat_python_api_config_new_option (PyObject *self, PyObject *args)
function_delete,
data_delete));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1776,32 +1372,20 @@ static PyObject *
weechat_python_api_config_search_option (PyObject *self, PyObject *args)
{
char *config_file, *section, *option_name, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_search_option");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "config_search_option", API_RETURN_EMPTY);
config_file = NULL;
section = NULL;
option_name = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &config_file, &section, &option_name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_search_option");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_config_search_option (script_str2ptr (config_file),
script_str2ptr (section),
option_name));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1814,26 +1398,14 @@ weechat_python_api_config_string_to_boolean (PyObject *self, PyObject *args)
char *text;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_string_to_boolean");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_string_to_boolean", API_RETURN_INT(0));
text = NULL;
-
if (!PyArg_ParseTuple (args, "s", &text))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_string_to_boolean");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_config_string_to_boolean (text);
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -1846,28 +1418,16 @@ weechat_python_api_config_option_reset (PyObject *self, PyObject *args)
char *option;
int run_callback, rc;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_option_reset");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_option_reset", API_RETURN_INT(0));
option = NULL;
run_callback = 0;
-
if (!PyArg_ParseTuple (args, "si", &option, &run_callback))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_option_reset");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
rc = weechat_config_option_reset (script_str2ptr (option),
run_callback);
- PYTHON_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -1880,30 +1440,18 @@ weechat_python_api_config_option_set (PyObject *self, PyObject *args)
char *option, *new_value;
int run_callback, rc;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_option_set");
- PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
-
+ API_FUNC(1, "config_option_set", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
option = NULL;
new_value = NULL;
run_callback = 0;
-
if (!PyArg_ParseTuple (args, "ssi", &option, &new_value, &run_callback))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_option_set");
- PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
rc = weechat_config_option_set (script_str2ptr (option),
new_value,
run_callback);
- PYTHON_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -1917,28 +1465,16 @@ weechat_python_api_config_option_set_null (PyObject *self, PyObject *args)
char *option;
int run_callback, rc;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_option_set_null");
- PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
-
+ API_FUNC(1, "config_option_set_null", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
option = NULL;
run_callback = 0;
-
if (!PyArg_ParseTuple (args, "si", &option, &run_callback))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_option_set_null");
- PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
rc = weechat_config_option_set_null (script_str2ptr (option),
run_callback);
- PYTHON_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -1951,26 +1487,14 @@ weechat_python_api_config_option_unset (PyObject *self, PyObject *args)
char *option;
int rc;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_option_unset");
- PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
- }
-
+ API_FUNC(1, "config_option_unset", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_option_unset");
- PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
- }
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
rc = weechat_config_option_unset (script_str2ptr (option));
- PYTHON_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -1982,28 +1506,16 @@ weechat_python_api_config_option_rename (PyObject *self, PyObject *args)
{
char *option, *new_name;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_option_rename");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_option_rename", API_RETURN_ERROR);
option = NULL;
new_name = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &option, &new_name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_option_rename");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_config_option_rename (script_str2ptr (option),
new_name);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2016,26 +1528,14 @@ weechat_python_api_config_option_is_null (PyObject *self, PyObject *args)
char *option;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_option_is_null");
- PYTHON_RETURN_INT(1);
- }
-
+ API_FUNC(1, "config_option_is_null", API_RETURN_INT(1));
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_option_is_null");
- PYTHON_RETURN_INT(1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(1));
value = weechat_config_option_is_null (script_str2ptr (option));
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2049,26 +1549,14 @@ weechat_python_api_config_option_default_is_null (PyObject *self, PyObject *args
char *option;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_option_default_is_null");
- PYTHON_RETURN_INT(1);
- }
-
+ API_FUNC(1, "config_option_default_is_null", API_RETURN_INT(1));
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_option_default_is_null");
- PYTHON_RETURN_INT(1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(1));
value = weechat_config_option_default_is_null (script_str2ptr (option));
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2081,26 +1569,14 @@ weechat_python_api_config_boolean (PyObject *self, PyObject *args)
char *option;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_boolean");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_boolean", API_RETURN_INT(0));
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_boolean");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_config_boolean (script_str2ptr (option));
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2113,26 +1589,14 @@ weechat_python_api_config_boolean_default (PyObject *self, PyObject *args)
char *option;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_boolean_default");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_boolean_default", API_RETURN_INT(0));
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_boolean_default");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_config_boolean_default (script_str2ptr (option));
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2145,26 +1609,14 @@ weechat_python_api_config_integer (PyObject *self, PyObject *args)
char *option;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_integer");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_integer", API_RETURN_INT(0));
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_integer");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_config_integer (script_str2ptr (option));
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2177,26 +1629,14 @@ weechat_python_api_config_integer_default (PyObject *self, PyObject *args)
char *option;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_integer_default");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_integer_default", API_RETURN_INT(0));
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_integer_default");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_config_integer_default (script_str2ptr (option));
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2209,26 +1649,14 @@ weechat_python_api_config_string (PyObject *self, PyObject *args)
char *option;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_string");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_string", API_RETURN_EMPTY);
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_string");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_config_string (script_str2ptr (option));
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2241,26 +1669,14 @@ weechat_python_api_config_string_default (PyObject *self, PyObject *args)
char *option;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_string_default");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_string_default", API_RETURN_EMPTY);
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_string_default");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_config_string_default (script_str2ptr (option));
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2273,26 +1689,14 @@ weechat_python_api_config_color (PyObject *self, PyObject *args)
char *option;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_color");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_color", API_RETURN_INT(0));
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_color");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
result = weechat_config_color (script_str2ptr (option));
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2305,26 +1709,14 @@ weechat_python_api_config_color_default (PyObject *self, PyObject *args)
char *option;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_color_default");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_color_default", API_RETURN_INT(0));
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_color_default");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
result = weechat_config_color_default (script_str2ptr (option));
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2336,28 +1728,16 @@ weechat_python_api_config_write_option (PyObject *self, PyObject *args)
{
char *config_file, *option;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_write_option");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_write_option", API_RETURN_ERROR);
config_file = NULL;
option = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &config_file, &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_write_option");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_config_write_option (script_str2ptr (config_file),
script_str2ptr (option));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2369,31 +1749,19 @@ weechat_python_api_config_write_line (PyObject *self, PyObject *args)
{
char *config_file, *option_name, *value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_write_line");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_write_line", API_RETURN_ERROR);
config_file = NULL;
option_name = NULL;
value = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &config_file, &option_name, &value))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_write_line");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_config_write_line (script_str2ptr (config_file),
option_name,
"%s",
value);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2406,26 +1774,14 @@ weechat_python_api_config_write (PyObject *self, PyObject *args)
char *config_file;
int rc;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_write");
- PYTHON_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "config_write", API_RETURN_INT(-1));
config_file = NULL;
-
if (!PyArg_ParseTuple (args, "s", &config_file))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_write");
- PYTHON_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
rc = weechat_config_write (script_str2ptr (config_file));
- PYTHON_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2438,26 +1794,14 @@ weechat_python_api_config_read (PyObject *self, PyObject *args)
char *config_file;
int rc;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_read");
- PYTHON_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "config_read", API_RETURN_INT(-1));
config_file = NULL;
-
if (!PyArg_ParseTuple (args, "s", &config_file))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_read");
- PYTHON_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
rc = weechat_config_read (script_str2ptr (config_file));
- PYTHON_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2470,26 +1814,14 @@ weechat_python_api_config_reload (PyObject *self, PyObject *args)
char *config_file;
int rc;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_reload");
- PYTHON_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "config_reload", API_RETURN_INT(-1));
config_file = NULL;
-
if (!PyArg_ParseTuple (args, "s", &config_file))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_reload");
- PYTHON_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
rc = weechat_config_reload (script_str2ptr (config_file));
- PYTHON_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2501,28 +1833,16 @@ weechat_python_api_config_option_free (PyObject *self, PyObject *args)
{
char *option;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_option_free");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_option_free", API_RETURN_ERROR);
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_option_free");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_config_option_free (weechat_python_plugin,
python_current_script,
script_str2ptr (option));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2535,28 +1855,16 @@ weechat_python_api_config_section_free_options (PyObject *self, PyObject *args)
{
char *section;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_section_free_options");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_section_free_options", API_RETURN_ERROR);
section = NULL;
-
if (!PyArg_ParseTuple (args, "s", &section))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_section_free_options");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_config_section_free_options (weechat_python_plugin,
python_current_script,
script_str2ptr (section));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2568,28 +1876,16 @@ weechat_python_api_config_section_free (PyObject *self, PyObject *args)
{
char *section;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_section_free");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_section_free", API_RETURN_ERROR);
section = NULL;
-
if (!PyArg_ParseTuple (args, "s", &section))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_section_free");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_config_section_free (weechat_python_plugin,
python_current_script,
script_str2ptr (section));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2601,28 +1897,16 @@ weechat_python_api_config_free (PyObject *self, PyObject *args)
{
char *config_file;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_free");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_free", API_RETURN_ERROR);
config_file = NULL;
-
if (!PyArg_ParseTuple (args, "s", &config_file))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_free");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_config_free (weechat_python_plugin,
python_current_script,
script_str2ptr (config_file));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2633,28 +1917,16 @@ static PyObject *
weechat_python_api_config_get (PyObject *self, PyObject *args)
{
char *option, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_get");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "config_get", API_RETURN_EMPTY);
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_get");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_config_get (option));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -2667,28 +1939,16 @@ weechat_python_api_config_get_plugin (PyObject *self, PyObject *args)
char *option;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_get_plugin");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_get_plugin", API_RETURN_EMPTY);
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_get_plugin");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_api_config_get_plugin (weechat_python_plugin,
python_current_script,
option);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2701,28 +1961,16 @@ weechat_python_api_config_is_set_plugin (PyObject *self, PyObject *args)
char *option;
int rc;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_is_set_plugin");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_is_set_plugin", API_RETURN_INT(0));
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_is_set_plugin");
- PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
rc = script_api_config_is_set_plugin (weechat_python_plugin,
python_current_script,
option);
- PYTHON_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2735,30 +1983,18 @@ weechat_python_api_config_set_plugin (PyObject *self, PyObject *args)
char *option, *value;
int rc;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_set_plugin");
- PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
-
+ API_FUNC(1, "config_set_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
option = NULL;
value = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &option, &value))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_set_plugin");
- PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
rc = script_api_config_set_plugin (weechat_python_plugin,
python_current_script,
option,
value);
- PYTHON_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2770,30 +2006,18 @@ weechat_python_api_config_set_desc_plugin (PyObject *self, PyObject *args)
{
char *option, *description;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_set_desc_plugin");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_set_desc_plugin", API_RETURN_ERROR);
option = NULL;
description = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &option, &description))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_set_desc_plugin");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_config_set_desc_plugin (weechat_python_plugin,
python_current_script,
option,
description);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2806,28 +2030,16 @@ weechat_python_api_config_unset_plugin (PyObject *self, PyObject *args)
char *option;
int rc;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_unset_plugin");
- PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
- }
-
+ API_FUNC(1, "config_unset_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
option = NULL;
-
if (!PyArg_ParseTuple (args, "s", &option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_unset_plugin");
- PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
- }
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
rc = script_api_config_unset_plugin (weechat_python_plugin,
python_current_script,
option);
- PYTHON_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2842,22 +2054,10 @@ weechat_python_api_key_bind (PyObject *self, PyObject *args)
PyObject *dict;
int num_keys;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "key_bind");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "key_bind", API_RETURN_INT(0));
context = NULL;
-
if (!PyArg_ParseTuple (args, "sO", &context, &dict))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "key_bind");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
hashtable = weechat_python_dict_to_hashtable (dict,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
@@ -2867,7 +2067,7 @@ weechat_python_api_key_bind (PyObject *self, PyObject *args)
if (hashtable)
weechat_hashtable_free (hashtable);
- PYTHON_RETURN_INT(num_keys);
+ API_RETURN_INT(num_keys);
}
/*
@@ -2880,27 +2080,15 @@ weechat_python_api_key_unbind (PyObject *self, PyObject *args)
char *context, *key;
int num_keys;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "key_unbind");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "key_unbind", API_RETURN_INT(0));
context = NULL;
key = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &context, &key))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "key_unbind");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
num_keys = weechat_key_unbind (context, key);
- PYTHON_RETURN_INT(num_keys);
+ API_RETURN_INT(num_keys);
}
/*
@@ -2913,20 +2101,14 @@ weechat_python_api_prefix (PyObject *self, PyObject *args)
char *prefix;
const char *result;
- /* make C compiler happy */
- (void) self;
-
+ API_FUNC(0, "prefix", API_RETURN_EMPTY);
prefix = NULL;
-
if (!PyArg_ParseTuple (args, "s", &prefix))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "prefix");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_prefix (prefix);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2939,20 +2121,14 @@ weechat_python_api_color (PyObject *self, PyObject *args)
char *color;
const char *result;
- /* make C compiler happy */
- (void) self;
-
+ API_FUNC(0, "color", API_RETURN_EMPTY);
color = NULL;
-
if (!PyArg_ParseTuple (args, "s", &color))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "color");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_color (color);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2964,24 +2140,18 @@ weechat_python_api_prnt (PyObject *self, PyObject *args)
{
char *buffer, *message;
- /* make C compiler happy */
- (void) self;
-
+ API_FUNC(0, "prnt", API_RETURN_ERROR);
buffer = NULL;
message = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &buffer, &message))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "prnt");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_printf (weechat_python_plugin,
python_current_script,
script_str2ptr (buffer),
"%s", message);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2995,25 +2165,13 @@ weechat_python_api_prnt_date_tags (PyObject *self, PyObject *args)
char *buffer, *tags, *message;
int date;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "prnt_date_tags");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "prnt_date_tags", API_RETURN_ERROR);
buffer = NULL;
date = 0;
tags = NULL;
message = NULL;
-
if (!PyArg_ParseTuple (args, "siss", &buffer, &date, &tags, &message))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "prnt_date_tags");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_printf_date_tags (weechat_python_plugin,
python_current_script,
@@ -3022,7 +2180,7 @@ weechat_python_api_prnt_date_tags (PyObject *self, PyObject *args)
tags,
"%s", message);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -3035,24 +2193,12 @@ weechat_python_api_prnt_y (PyObject *self, PyObject *args)
char *buffer, *message;
int y;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "prnt_y");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "prnt_y", API_RETURN_ERROR);
buffer = NULL;
y = 0;
message = NULL;
-
if (!PyArg_ParseTuple (args, "sis", &buffer, &y, &message))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "prnt_y");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_printf_y (weechat_python_plugin,
python_current_script,
@@ -3060,7 +2206,7 @@ weechat_python_api_prnt_y (PyObject *self, PyObject *args)
y,
"%s", message);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -3072,28 +2218,16 @@ weechat_python_api_log_print (PyObject *self, PyObject *args)
{
char *message;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "log_print");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "log_print", API_RETURN_ERROR);
message = NULL;
-
if (!PyArg_ParseTuple (args, "s", &message))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "log_print");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_log_printf (weechat_python_plugin,
python_current_script,
"%s", message);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -3105,7 +2239,7 @@ weechat_python_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
struct t_script_callback *script_callback;
- void *python_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3116,14 +2250,14 @@ weechat_python_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (buffer);
- python_argv[2] = (argc > 1) ? argv_eol[1] : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (buffer);
+ func_argv[2] = (argc > 1) ? argv_eol[1] : empty_arg;
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", python_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3132,8 +2266,8 @@ weechat_python_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
ret = *rc;
free (rc);
}
- if (python_argv[1])
- free (python_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -3150,17 +2284,9 @@ weechat_python_api_hook_command (PyObject *self, PyObject *args)
{
char *command, *description, *arguments, *args_description, *completion;
char *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_command");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hook_command", API_RETURN_EMPTY);
command = NULL;
description = NULL;
arguments = NULL;
@@ -3168,13 +2294,9 @@ weechat_python_api_hook_command (PyObject *self, PyObject *args)
completion = NULL;
function = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "sssssss", &command, &description, &arguments,
&args_description, &completion, &function, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_command");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_command (weechat_python_plugin,
python_current_script,
@@ -3187,7 +2309,7 @@ weechat_python_api_hook_command (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3199,7 +2321,7 @@ weechat_python_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
const char *command)
{
struct t_script_callback *script_callback;
- void *python_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3207,14 +2329,14 @@ weechat_python_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (buffer);
- python_argv[2] = (command) ? (char *)command : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (buffer);
+ func_argv[2] = (command) ? (char *)command : empty_arg;
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", python_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3223,8 +2345,8 @@ weechat_python_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
ret = *rc;
free (rc);
}
- if (python_argv[1])
- free (python_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -3240,26 +2362,14 @@ static PyObject *
weechat_python_api_hook_command_run (PyObject *self, PyObject *args)
{
char *command, *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_command_run");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hook_command_run", API_RETURN_EMPTY);
command = NULL;
function = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &command, &function, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_command_run");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_command_run (weechat_python_plugin,
python_current_script,
@@ -3268,7 +2378,7 @@ weechat_python_api_hook_command_run (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3279,7 +2389,7 @@ int
weechat_python_api_hook_timer_cb (void *data, int remaining_calls)
{
struct t_script_callback *script_callback;
- void *python_argv[2];
+ void *func_argv[2];
char str_remaining_calls[32], empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3290,13 +2400,13 @@ weechat_python_api_hook_timer_cb (void *data, int remaining_calls)
snprintf (str_remaining_calls, sizeof (str_remaining_calls),
"%d", remaining_calls);
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = str_remaining_calls;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = str_remaining_calls;
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", python_argv);
+ "ss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3321,29 +2431,17 @@ weechat_python_api_hook_timer (PyObject *self, PyObject *args)
{
int interval, align_second, max_calls;
char *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_timer");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hook_timer", API_RETURN_EMPTY);
interval = 10;
align_second = 0;
max_calls = 0;
function = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "iiiss", &interval, &align_second, &max_calls,
&function, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_timer");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_timer (weechat_python_plugin,
python_current_script,
@@ -3354,7 +2452,7 @@ weechat_python_api_hook_timer (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3365,7 +2463,7 @@ int
weechat_python_api_hook_fd_cb (void *data, int fd)
{
struct t_script_callback *script_callback;
- void *python_argv[2];
+ void *func_argv[2];
char str_fd[32], empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3375,13 +2473,13 @@ weechat_python_api_hook_fd_cb (void *data, int fd)
{
snprintf (str_fd, sizeof (str_fd), "%d", fd);
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = str_fd;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = str_fd;
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", python_argv);
+ "ss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3406,30 +2504,18 @@ weechat_python_api_hook_fd (PyObject *self, PyObject *args)
{
int fd, read, write, exception;
char *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_fd");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hook_fd", API_RETURN_EMPTY);
fd = 0;
read = 0;
write = 0;
exception = 0;
function = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "iiiiss", &fd, &read, &write, &exception,
&function, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_fd");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_fd (weechat_python_plugin,
python_current_script,
@@ -3441,7 +2527,7 @@ weechat_python_api_hook_fd (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3454,7 +2540,7 @@ weechat_python_api_hook_process_cb (void *data,
const char *out, const char *err)
{
struct t_script_callback *script_callback;
- void *python_argv[5];
+ void *func_argv[5];
char str_rc[32], empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3464,16 +2550,16 @@ weechat_python_api_hook_process_cb (void *data,
{
snprintf (str_rc, sizeof (str_rc), "%d", return_code);
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = (command) ? (char *)command : empty_arg;
- python_argv[2] = str_rc;
- python_argv[3] = (out) ? (char *)out : empty_arg;
- python_argv[4] = (err) ? (char *)err : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (command) ? (char *)command : empty_arg;
+ func_argv[2] = str_rc;
+ func_argv[3] = (out) ? (char *)out : empty_arg;
+ func_argv[4] = (err) ? (char *)err : empty_arg;
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sssss", python_argv);
+ "sssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3498,27 +2584,15 @@ weechat_python_api_hook_process (PyObject *self, PyObject *args)
{
char *command, *function, *data, *result;
int timeout;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_process");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hook_process", API_RETURN_EMPTY);
command = NULL;
timeout = 0;
function = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "siss", &command, &timeout, &function, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_process");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_process (weechat_python_plugin,
python_current_script,
@@ -3528,7 +2602,7 @@ weechat_python_api_hook_process (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3540,7 +2614,7 @@ weechat_python_api_hook_connect_cb (void *data, int status, int gnutls_rc,
const char *error, const char *ip_address)
{
struct t_script_callback *script_callback;
- void *python_argv[5];
+ void *func_argv[5];
char str_status[32], str_gnutls_rc[32], empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3551,16 +2625,16 @@ weechat_python_api_hook_connect_cb (void *data, int status, int gnutls_rc,
snprintf (str_status, sizeof (str_status), "%d", status);
snprintf (str_gnutls_rc, sizeof (str_gnutls_rc), "%d", gnutls_rc);
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = str_status;
- python_argv[2] = str_gnutls_rc;
- python_argv[3] = (ip_address) ? (char *)ip_address : empty_arg;
- python_argv[4] = (error) ? (char *)error : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = str_status;
+ func_argv[2] = str_gnutls_rc;
+ func_argv[3] = (ip_address) ? (char *)ip_address : empty_arg;
+ func_argv[4] = (error) ? (char *)error : empty_arg;
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sssss", python_argv);
+ "sssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3585,17 +2659,9 @@ weechat_python_api_hook_connect (PyObject *self, PyObject *args)
{
char *proxy, *address, *local_hostname, *function, *data, *result;
int port, sock, ipv6;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_connect");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hook_connect", API_RETURN_EMPTY);
proxy = NULL;
address = NULL;
port = 0;
@@ -3604,13 +2670,9 @@ weechat_python_api_hook_connect (PyObject *self, PyObject *args)
local_hostname = NULL;
function = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "ssiiisss", &proxy, &address, &port, &sock,
&ipv6, &local_hostname, &function, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_connect");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_connect (weechat_python_plugin,
python_current_script,
@@ -3628,7 +2690,7 @@ weechat_python_api_hook_connect (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3643,7 +2705,7 @@ weechat_python_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
const char *prefix, const char *message)
{
struct t_script_callback *script_callback;
- void *python_argv[8];
+ void *func_argv[8];
char empty_arg[1] = { '\0' };
static char timebuffer[64];
int *rc, ret;
@@ -3657,21 +2719,21 @@ weechat_python_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
{
snprintf (timebuffer, sizeof (timebuffer) - 1, "%ld", (long int)date);
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (buffer);
- python_argv[2] = timebuffer;
- python_argv[3] = weechat_string_build_with_split_string (tags, ",");
- if (!python_argv[3])
- python_argv[3] = strdup ("");
- python_argv[4] = (displayed) ? strdup ("1") : strdup ("0");
- python_argv[5] = (highlight) ? strdup ("1") : strdup ("0");
- python_argv[6] = (prefix) ? (char *)prefix : empty_arg;
- python_argv[7] = (message) ? (char *)message : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (buffer);
+ func_argv[2] = timebuffer;
+ func_argv[3] = weechat_string_build_with_split_string (tags, ",");
+ if (!func_argv[3])
+ func_argv[3] = strdup ("");
+ func_argv[4] = (displayed) ? strdup ("1") : strdup ("0");
+ func_argv[5] = (highlight) ? strdup ("1") : strdup ("0");
+ func_argv[6] = (prefix) ? (char *)prefix : empty_arg;
+ func_argv[7] = (message) ? (char *)message : empty_arg;
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ssssssss", python_argv);
+ "ssssssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3680,14 +2742,14 @@ weechat_python_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
ret = *rc;
free (rc);
}
- if (python_argv[1])
- free (python_argv[1]);
- if (python_argv[3])
- free (python_argv[3]);
- if (python_argv[4])
- free (python_argv[4]);
- if (python_argv[5])
- free (python_argv[5]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[3])
+ free (func_argv[3]);
+ if (func_argv[4])
+ free (func_argv[4]);
+ if (func_argv[5])
+ free (func_argv[5]);
return ret;
}
@@ -3704,30 +2766,18 @@ weechat_python_api_hook_print (PyObject *self, PyObject *args)
{
char *buffer, *tags, *message, *function, *data, *result;
int strip_colors;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_print");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hook_print", API_RETURN_EMPTY);
buffer = NULL;
tags = NULL;
message = NULL;
strip_colors = 0;
function = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "sssiss", &buffer, &tags, &message,
&strip_colors, &function, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_print");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_print (weechat_python_plugin,
python_current_script,
@@ -3739,7 +2789,7 @@ weechat_python_api_hook_print (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3751,7 +2801,7 @@ weechat_python_api_hook_signal_cb (void *data, const char *signal, const char *t
void *signal_data)
{
struct t_script_callback *script_callback;
- void *python_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
static char value_str[64];
int *rc, ret, free_needed;
@@ -3760,31 +2810,31 @@ weechat_python_api_hook_signal_cb (void *data, const char *signal, const char *t
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = (signal) ? (char *)signal : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (signal) ? (char *)signal : empty_arg;
free_needed = 0;
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
{
- python_argv[2] = (signal_data) ? (char *)signal_data : empty_arg;
+ func_argv[2] = (signal_data) ? (char *)signal_data : empty_arg;
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_INT) == 0)
{
snprintf (value_str, sizeof (value_str) - 1,
"%d", *((int *)signal_data));
- python_argv[2] = value_str;
+ func_argv[2] = value_str;
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_POINTER) == 0)
{
- python_argv[2] = script_ptr2str (signal_data);
+ func_argv[2] = script_ptr2str (signal_data);
free_needed = 1;
}
else
- python_argv[2] = empty_arg;
+ func_argv[2] = empty_arg;
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", python_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3793,8 +2843,8 @@ weechat_python_api_hook_signal_cb (void *data, const char *signal, const char *t
ret = *rc;
free (rc);
}
- if (free_needed && python_argv[2])
- free (python_argv[2]);
+ if (free_needed && func_argv[2])
+ free (func_argv[2]);
return ret;
}
@@ -3810,26 +2860,14 @@ static PyObject *
weechat_python_api_hook_signal (PyObject *self, PyObject *args)
{
char *signal, *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_signal");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hook_signal", API_RETURN_EMPTY);
signal = NULL;
function = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &signal, &function, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_signal");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_signal (weechat_python_plugin,
python_current_script,
@@ -3838,7 +2876,7 @@ weechat_python_api_hook_signal (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3851,29 +2889,17 @@ weechat_python_api_hook_signal_send (PyObject *self, PyObject *args)
char *signal, *type_data, *signal_data, *error;
int number;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_signal_send");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "hook_signal_send", API_RETURN_ERROR);
signal = NULL;
type_data = NULL;
signal_data = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &signal, &type_data, &signal_data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_signal_send");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
{
weechat_hook_signal_send (signal, type_data, signal_data);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_INT) == 0)
{
@@ -3883,16 +2909,16 @@ weechat_python_api_hook_signal_send (PyObject *self, PyObject *args)
{
weechat_hook_signal_send (signal, type_data, &number);
}
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_POINTER) == 0)
{
weechat_hook_signal_send (signal, type_data,
script_str2ptr (signal_data));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
- PYTHON_RETURN_ERROR;
+ API_RETURN_ERROR;
}
/*
@@ -3904,7 +2930,7 @@ weechat_python_api_hook_hsignal_cb (void *data, const char *signal,
struct t_hashtable *hashtable)
{
struct t_script_callback *script_callback;
- void *python_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3912,14 +2938,14 @@ weechat_python_api_hook_hsignal_cb (void *data, const char *signal,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = (signal) ? (char *)signal : empty_arg;
- python_argv[2] = weechat_python_hashtable_to_dict (hashtable);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (signal) ? (char *)signal : empty_arg;
+ func_argv[2] = weechat_python_hashtable_to_dict (hashtable);
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ssO", python_argv);
+ "ssO", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3928,9 +2954,9 @@ weechat_python_api_hook_hsignal_cb (void *data, const char *signal,
ret = *rc;
free (rc);
}
- if (python_argv[2])
+ if (func_argv[2])
{
- Py_XDECREF((PyObject *)python_argv[2]);
+ Py_XDECREF((PyObject *)func_argv[2]);
}
return ret;
@@ -3947,26 +2973,14 @@ static PyObject *
weechat_python_api_hook_hsignal (PyObject *self, PyObject *args)
{
char *signal, *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_hsignal");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hook_hsignal", API_RETURN_EMPTY);
signal = NULL;
function = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &signal, &function, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_hsignal");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_hsignal (weechat_python_plugin,
python_current_script,
@@ -3975,7 +2989,7 @@ weechat_python_api_hook_hsignal (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3989,22 +3003,10 @@ weechat_python_api_hook_hsignal_send (PyObject *self, PyObject *args)
struct t_hashtable *hashtable;
PyObject *dict;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_hsignal_send");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "hook_hsignal_send", API_RETURN_ERROR);
signal = NULL;
-
if (!PyArg_ParseTuple (args, "sO", &signal, &dict))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_hsignal_send");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
hashtable = weechat_python_dict_to_hashtable (dict,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
@@ -4014,7 +3016,7 @@ weechat_python_api_hook_hsignal_send (PyObject *self, PyObject *args)
if (hashtable)
weechat_hashtable_free (hashtable);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4025,7 +3027,7 @@ int
weechat_python_api_hook_config_cb (void *data, const char *option, const char *value)
{
struct t_script_callback *script_callback;
- void *python_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -4033,14 +3035,14 @@ weechat_python_api_hook_config_cb (void *data, const char *option, const char *v
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = (option) ? (char *)option : empty_arg;
- python_argv[2] = (value) ? (char *)value : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (option) ? (char *)option : empty_arg;
+ func_argv[2] = (value) ? (char *)value : empty_arg;
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", python_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -4064,26 +3066,14 @@ static PyObject *
weechat_python_api_hook_config (PyObject *self, PyObject *args)
{
char *option, *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_config");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hook_config", API_RETURN_EMPTY);
option = NULL;
function = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &option, &function, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_config");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_config (weechat_python_plugin,
python_current_script,
@@ -4092,7 +3082,7 @@ weechat_python_api_hook_config (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4105,7 +3095,7 @@ weechat_python_api_hook_completion_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
struct t_script_callback *script_callback;
- void *python_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -4113,15 +3103,15 @@ weechat_python_api_hook_completion_cb (void *data, const char *completion_item,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = (completion_item) ? (char *)completion_item : empty_arg;
- python_argv[2] = script_ptr2str (buffer);
- python_argv[3] = script_ptr2str (completion);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (completion_item) ? (char *)completion_item : empty_arg;
+ func_argv[2] = script_ptr2str (buffer);
+ func_argv[3] = script_ptr2str (completion);
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ssss", python_argv);
+ "ssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -4130,10 +3120,10 @@ weechat_python_api_hook_completion_cb (void *data, const char *completion_item,
ret = *rc;
free (rc);
}
- if (python_argv[2])
- free (python_argv[2]);
- if (python_argv[3])
- free (python_argv[3]);
+ if (func_argv[2])
+ free (func_argv[2]);
+ if (func_argv[3])
+ free (func_argv[3]);
return ret;
}
@@ -4149,28 +3139,16 @@ static PyObject *
weechat_python_api_hook_completion (PyObject *self, PyObject *args)
{
char *completion, *description, *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_completion");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hook_completion", API_RETURN_EMPTY);
completion = NULL;
description = NULL;
function = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "ssss", &completion, &description, &function,
&data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_completion");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_completion (weechat_python_plugin,
python_current_script,
@@ -4180,7 +3158,7 @@ weechat_python_api_hook_completion (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4193,33 +3171,21 @@ weechat_python_api_hook_completion_list_add (PyObject *self, PyObject *args)
char *completion, *word, *where;
int nick_completion;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_completion_list_add");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "hook_completion_list_add", API_RETURN_ERROR);
completion = NULL;
word = NULL;
nick_completion = 0;
where = NULL;
-
if (!PyArg_ParseTuple (args, "ssis", &completion, &word, &nick_completion,
&where))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_completion_list_add");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_hook_completion_list_add (script_str2ptr (completion),
word,
nick_completion,
where);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4231,22 +3197,22 @@ weechat_python_api_hook_modifier_cb (void *data, const char *modifier,
const char *modifier_data, const char *string)
{
struct t_script_callback *script_callback;
- void *python_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' };
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = (modifier) ? (char *)modifier : empty_arg;
- python_argv[2] = (modifier_data) ? (char *)modifier_data : empty_arg;
- python_argv[3] = (string) ? (char *)string : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (modifier) ? (char *)modifier : empty_arg;
+ func_argv[2] = (modifier_data) ? (char *)modifier_data : empty_arg;
+ func_argv[3] = (string) ? (char *)string : empty_arg;
return (char *)weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
- "ssss", python_argv);
+ "ssss", func_argv);
}
return NULL;
@@ -4260,26 +3226,14 @@ static PyObject *
weechat_python_api_hook_modifier (PyObject *self, PyObject *args)
{
char *modifier, *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_modifier");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hook_modifier", API_RETURN_EMPTY);
modifier = NULL;
function = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &modifier, &function, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_modifier");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_modifier (weechat_python_plugin,
python_current_script,
@@ -4288,7 +3242,7 @@ weechat_python_api_hook_modifier (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4299,30 +3253,18 @@ static PyObject *
weechat_python_api_hook_modifier_exec (PyObject *self, PyObject *args)
{
char *modifier, *modifier_data, *string, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_modifier_exec");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hook_modifier_exec", API_RETURN_EMPTY);
modifier = NULL;
modifier_data = NULL;
string = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &modifier, &modifier_data, &string))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_modifier_exec");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_hook_modifier_exec (modifier, modifier_data, string);
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4334,21 +3276,21 @@ weechat_python_api_hook_info_cb (void *data, const char *info_name,
const char *arguments)
{
struct t_script_callback *script_callback;
- void *python_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = (info_name) ? (char *)info_name : empty_arg;
- python_argv[2] = (arguments) ? (char *)arguments : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
+ func_argv[2] = (arguments) ? (char *)arguments : empty_arg;
return (const char *)weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
- "sss", python_argv);
+ "sss", func_argv);
}
return NULL;
@@ -4362,29 +3304,17 @@ static PyObject *
weechat_python_api_hook_info (PyObject *self, PyObject *args)
{
char *info_name, *description, *args_description, *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_info");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hook_info", API_RETURN_EMPTY);
info_name = NULL;
description = NULL;
args_description = NULL;
function = NULL;
data = NULL;
-
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;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_info (weechat_python_plugin,
python_current_script,
@@ -4395,7 +3325,7 @@ weechat_python_api_hook_info (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4407,7 +3337,7 @@ weechat_python_api_hook_info_hashtable_cb (void *data, const char *info_name,
struct t_hashtable *hashtable)
{
struct t_script_callback *script_callback;
- void *python_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
struct t_hashtable *ret_hashtable;
@@ -4415,18 +3345,18 @@ weechat_python_api_hook_info_hashtable_cb (void *data, const char *info_name,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = (info_name) ? (char *)info_name : empty_arg;
- python_argv[2] = weechat_python_hashtable_to_dict (hashtable);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
+ func_argv[2] = weechat_python_hashtable_to_dict (hashtable);
ret_hashtable = weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
script_callback->function,
- "ssO", python_argv);
+ "ssO", func_argv);
- if (python_argv[2])
+ if (func_argv[2])
{
- Py_XDECREF((PyObject *)python_argv[2]);
+ Py_XDECREF((PyObject *)func_argv[2]);
}
return ret_hashtable;
@@ -4444,31 +3374,19 @@ weechat_python_api_hook_info_hashtable (PyObject *self, PyObject *args)
{
char *info_name, *description, *args_description, *output_description;
char *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_info_hashtable");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hook_info_hashtable", API_RETURN_EMPTY);
info_name = NULL;
description = NULL;
args_description = NULL;
output_description = NULL;
function = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "ssssss", &info_name, &description,
&args_description, &output_description,
&function, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_info_hashtable");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_info_hashtable (weechat_python_plugin,
python_current_script,
@@ -4480,7 +3398,7 @@ weechat_python_api_hook_info_hashtable (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4492,7 +3410,7 @@ weechat_python_api_hook_infolist_cb (void *data, const char *infolist_name,
void *pointer, const char *arguments)
{
struct t_script_callback *script_callback;
- void *python_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' };
struct t_infolist *result;
@@ -4500,18 +3418,18 @@ weechat_python_api_hook_infolist_cb (void *data, const char *infolist_name,
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = (infolist_name) ? (char *)infolist_name : empty_arg;
- python_argv[2] = script_ptr2str (pointer);
- python_argv[3] = (arguments) ? (char *)arguments : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (infolist_name) ? (char *)infolist_name : empty_arg;
+ func_argv[2] = script_ptr2str (pointer);
+ func_argv[3] = (arguments) ? (char *)arguments : empty_arg;
result = (struct t_infolist *)weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
- "ssss", python_argv);
+ "ssss", func_argv);
- if (python_argv[2])
- free (python_argv[2]);
+ if (func_argv[2])
+ free (func_argv[2]);
return result;
}
@@ -4528,31 +3446,19 @@ weechat_python_api_hook_infolist (PyObject *self, PyObject *args)
{
char *infolist_name, *description, *pointer_description, *args_description;
char *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_infolist");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hook_infolist", API_RETURN_EMPTY);
infolist_name = NULL;
description = NULL;
pointer_description = NULL;
args_description = NULL;
function = NULL;
data = NULL;
-
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;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_infolist (weechat_python_plugin,
python_current_script,
@@ -4564,7 +3470,7 @@ weechat_python_api_hook_infolist (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4576,20 +3482,27 @@ weechat_python_api_hook_focus_cb (void *data,
struct t_hashtable *info)
{
struct t_script_callback *script_callback;
- void *python_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
+ struct t_hashtable *ret_hashtable;
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = info;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = weechat_python_hashtable_to_dict (info);
- return (struct t_hashtable *)weechat_python_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_HASHTABLE,
- script_callback->function,
- "sh", python_argv);
+ ret_hashtable = weechat_python_exec (script_callback->script,
+ WEECHAT_SCRIPT_EXEC_HASHTABLE,
+ script_callback->function,
+ "sO", func_argv);
+ if (func_argv[1])
+ {
+ Py_XDECREF((PyObject *)func_argv[1]);
+ }
+
+ return ret_hashtable;
}
return NULL;
@@ -4603,26 +3516,14 @@ static PyObject *
weechat_python_api_hook_focus (PyObject *self, PyObject *args)
{
char *area, *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hook_focus");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hook_focus", API_RETURN_EMPTY);
area = NULL;
function = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &area, &function, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_focus");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_focus (weechat_python_plugin,
python_current_script,
@@ -4631,7 +3532,7 @@ weechat_python_api_hook_focus (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4643,28 +3544,16 @@ weechat_python_api_unhook (PyObject *self, PyObject *args)
{
char *hook;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "unhook");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "unhook", API_RETURN_ERROR);
hook = NULL;
-
if (!PyArg_ParseTuple (args, "s", &hook))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "unhook");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_unhook (weechat_python_plugin,
python_current_script,
script_str2ptr (hook));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4675,18 +3564,13 @@ static PyObject *
weechat_python_api_unhook_all (PyObject *self, PyObject *args)
{
/* make C compiler happy */
- (void) self;
(void) args;
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "unhook_all");
- PYTHON_RETURN_ERROR;
- }
+ API_FUNC(1, "unhook_all", API_RETURN_ERROR);
script_api_unhook_all (python_current_script);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4698,7 +3582,7 @@ weechat_python_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer
const char *input_data)
{
struct t_script_callback *script_callback;
- void *python_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -4706,14 +3590,14 @@ weechat_python_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (buffer);
- python_argv[2] = (input_data) ? (char *)input_data : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (buffer);
+ func_argv[2] = (input_data) ? (char *)input_data : empty_arg;
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", python_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -4721,8 +3605,8 @@ weechat_python_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer
ret = *rc;
free (rc);
}
- if (python_argv[1])
- free (python_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -4738,7 +3622,7 @@ int
weechat_python_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
{
struct t_script_callback *script_callback;
- void *python_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -4746,13 +3630,13 @@ weechat_python_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (buffer);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (buffer);
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", python_argv);
+ "ss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -4760,8 +3644,8 @@ weechat_python_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
ret = *rc;
free (rc);
}
- if (python_argv[1])
- free (python_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -4778,29 +3662,17 @@ weechat_python_api_buffer_new (PyObject *self, PyObject *args)
{
char *name, *function_input, *data_input, *function_close, *data_close;
char *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_new");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "buffer_new", API_RETURN_EMPTY);
name = NULL;
function_input = NULL;
data_input = NULL;
function_close = NULL;
data_close = NULL;
-
if (!PyArg_ParseTuple (args, "sssss", &name, &function_input, &data_input,
&function_close, &data_close))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "buffer_new");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_buffer_new (weechat_python_plugin,
python_current_script,
@@ -4812,7 +3684,7 @@ weechat_python_api_buffer_new (PyObject *self, PyObject *args)
function_close,
data_close));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4824,29 +3696,17 @@ weechat_python_api_buffer_search (PyObject *self, PyObject *args)
{
char *plugin, *name;
char *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_search");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "buffer_search", API_RETURN_EMPTY);
plugin = NULL;
name = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &plugin, &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "buffer_search");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_buffer_search (plugin, name));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4857,21 +3717,16 @@ static PyObject *
weechat_python_api_buffer_search_main (PyObject *self, PyObject *args)
{
char *result;
- PyObject *object;
+ PyObject *return_value;
/* make C compiler happy */
- (void) self;
(void) args;
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_search_main");
- PYTHON_RETURN_EMPTY;
- }
+ API_FUNC(1, "buffer_search_main", API_RETURN_EMPTY);
result = script_ptr2str (weechat_buffer_search_main ());
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4882,21 +3737,16 @@ static PyObject *
weechat_python_api_current_buffer (PyObject *self, PyObject *args)
{
char *result;
- PyObject *object;
+ PyObject *return_value;
/* make C compiler happy */
- (void) self;
(void) args;
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "current_buffer");
- PYTHON_RETURN_EMPTY;
- }
+ API_FUNC(1, "current_buffer", API_RETURN_EMPTY);
result = script_ptr2str (weechat_current_buffer ());
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4908,26 +3758,14 @@ weechat_python_api_buffer_clear (PyObject *self, PyObject *args)
{
char *buffer;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_clear");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_clear", API_RETURN_ERROR);
buffer = NULL;
-
if (!PyArg_ParseTuple (args, "s", &buffer))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "buffer_clear");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_buffer_clear (script_str2ptr (buffer));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4939,28 +3777,16 @@ weechat_python_api_buffer_close (PyObject *self, PyObject *args)
{
char *buffer;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_close");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_close", API_RETURN_ERROR);
buffer = NULL;
-
if (!PyArg_ParseTuple (args, "s", &buffer))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "buffer_close");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_buffer_close (weechat_python_plugin,
python_current_script,
script_str2ptr (buffer));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4972,28 +3798,16 @@ weechat_python_api_buffer_merge (PyObject *self, PyObject *args)
{
char *buffer, *target_buffer;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_merge");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_merge", API_RETURN_ERROR);
buffer = NULL;
target_buffer = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &buffer, &target_buffer))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "buffer_merge");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_buffer_merge (script_str2ptr (buffer),
script_str2ptr (target_buffer));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5007,27 +3821,15 @@ weechat_python_api_buffer_unmerge (PyObject *self, PyObject *args)
char *buffer;
int number;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_unmerge");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_unmerge", API_RETURN_ERROR);
buffer = NULL;
number = 0;
-
if (!PyArg_ParseTuple (args, "si", &buffer, &number))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "buffer_unmerge");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_buffer_unmerge (script_str2ptr (buffer), number);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5040,27 +3842,15 @@ weechat_python_api_buffer_get_integer (PyObject *self, PyObject *args)
char *buffer, *property;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_get_integer");
- PYTHON_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "buffer_get_integer", API_RETURN_INT(-1));
buffer = NULL;
property = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &buffer, &property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "buffer_get_integer");
- PYTHON_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
value = weechat_buffer_get_integer (script_str2ptr (buffer), property);
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -5073,27 +3863,15 @@ weechat_python_api_buffer_get_string (PyObject *self, PyObject *args)
char *buffer, *property;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_get_string");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_get_string", API_RETURN_ERROR);
buffer = NULL;
property = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &buffer, &property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "buffer_get_string");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_buffer_get_string (script_str2ptr (buffer), property);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -5104,30 +3882,18 @@ static PyObject *
weechat_python_api_buffer_get_pointer (PyObject *self, PyObject *args)
{
char *buffer, *property, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_get_pointer");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "buffer_get_pointer", API_RETURN_EMPTY);
buffer = NULL;
property = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &buffer, &property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "buffer_get_pointer");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_buffer_get_pointer (script_str2ptr (buffer),
property));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5139,30 +3905,18 @@ weechat_python_api_buffer_set (PyObject *self, PyObject *args)
{
char *buffer, *property, *value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_set");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_set", API_RETURN_ERROR);
buffer = NULL;
property = NULL;
value = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &buffer, &property, &value))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "buffer_set");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_buffer_set (script_str2ptr (buffer),
property,
value);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5174,29 +3928,17 @@ static PyObject *
weechat_python_api_buffer_string_replace_local_var (PyObject *self, PyObject *args)
{
char *buffer, *string, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_string_replace_local_var");
- PYTHON_RETURN_ERROR;
- }
+ PyObject *return_value;
+ API_FUNC(1, "buffer_string_replace_local_var", API_RETURN_ERROR);
buffer = NULL;
string = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &buffer, &string))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "buffer_string_replace_local_var");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
result = weechat_buffer_string_replace_local_var (script_str2ptr (buffer), string);
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5210,27 +3952,15 @@ weechat_python_api_buffer_match_list (PyObject *self, PyObject *args)
char *buffer, *string;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_match_list");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "buffer_match_list", API_RETURN_INT(0));
buffer = NULL;
string = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &buffer, &string))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "buffer_match_list");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_buffer_match_list (script_str2ptr (buffer), string);
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -5241,21 +3971,16 @@ static PyObject *
weechat_python_api_current_window (PyObject *self, PyObject *args)
{
char *result;
- PyObject *object;
+ PyObject *return_value;
/* make C compiler happy */
- (void) self;
(void) args;
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "current_window");
- PYTHON_RETURN_EMPTY;
- }
+ API_FUNC(1, "current_window", API_RETURN_EMPTY);
result = script_ptr2str (weechat_current_window ());
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5267,28 +3992,16 @@ static PyObject *
weechat_python_api_window_search_with_buffer (PyObject *self, PyObject *args)
{
char *buffer, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "window_search_with_buffer");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "window_search_with_buffer", API_RETURN_EMPTY);
buffer = NULL;
-
if (!PyArg_ParseTuple (args, "s", &buffer))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "window_search_with_buffer");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_window_search_with_buffer (script_str2ptr (buffer)));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5301,27 +4014,15 @@ weechat_python_api_window_get_integer (PyObject *self, PyObject *args)
char *window, *property;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "window_get_integer");
- PYTHON_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "window_get_integer", API_RETURN_INT(-1));
window = NULL;
property = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &window, &property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "window_get_integer");
- PYTHON_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
value = weechat_window_get_integer (script_str2ptr (window), property);
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -5334,27 +4035,15 @@ weechat_python_api_window_get_string (PyObject *self, PyObject *args)
char *window, *property;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "window_get_string");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "window_get_string", API_RETURN_EMPTY);
window = NULL;
property = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &window, &property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "window_get_string");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_window_get_string (script_str2ptr (window), property);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -5365,30 +4054,18 @@ static PyObject *
weechat_python_api_window_get_pointer (PyObject *self, PyObject *args)
{
char *window, *property, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "window_get_pointer");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "window_get_pointer", API_RETURN_EMPTY);
window = NULL;
property = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &window, &property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "window_get_pointer");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_window_get_pointer (script_str2ptr (window),
property));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5400,26 +4077,14 @@ weechat_python_api_window_set_title (PyObject *self, PyObject *args)
{
char *title;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "window_set_title");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "window_set_title", API_RETURN_ERROR);
title = NULL;
-
if (!PyArg_ParseTuple (args, "s", &title))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "window_set_title");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_window_set_title (title);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5431,29 +4096,17 @@ weechat_python_api_nicklist_add_group (PyObject *self, PyObject *args)
{
char *buffer, *parent_group, *name, *color, *result;
int visible;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_add_group");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "nicklist_add_group", API_RETURN_EMPTY);
buffer = NULL;
parent_group = NULL;
name = NULL;
color = NULL;
visible = 0;
-
if (!PyArg_ParseTuple (args, "ssssi", &buffer, &parent_group, &name,
&color, &visible))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_add_group");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_nicklist_add_group (script_str2ptr (buffer),
script_str2ptr (parent_group),
@@ -5461,7 +4114,7 @@ weechat_python_api_nicklist_add_group (PyObject *self, PyObject *args)
color,
visible));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5472,32 +4125,20 @@ static PyObject *
weechat_python_api_nicklist_search_group (PyObject *self, PyObject *args)
{
char *buffer, *from_group, *name, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_search_group");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "nicklist_search_group", API_RETURN_EMPTY);
buffer = NULL;
from_group = NULL;
name = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &buffer, &from_group, &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_search_group");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_nicklist_search_group (script_str2ptr (buffer),
script_str2ptr (from_group),
name));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5509,17 +4150,9 @@ weechat_python_api_nicklist_add_nick (PyObject *self, PyObject *args)
{
char *buffer, *group, *name, *color, *prefix, *prefix_color, *result;
int visible;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_add_nick");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "nicklist_add_nick", API_RETURN_EMPTY);
buffer = NULL;
group = NULL;
name = NULL;
@@ -5527,13 +4160,9 @@ weechat_python_api_nicklist_add_nick (PyObject *self, PyObject *args)
prefix = NULL;
prefix_color = NULL;
visible = 0;
-
if (!PyArg_ParseTuple (args, "ssssssi", &buffer, &group, &name, &color,
&prefix, &prefix_color, &visible))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_add_nick");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_nicklist_add_nick (script_str2ptr (buffer),
script_str2ptr (group),
@@ -5543,7 +4172,7 @@ weechat_python_api_nicklist_add_nick (PyObject *self, PyObject *args)
prefix_color,
visible));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5554,32 +4183,20 @@ static PyObject *
weechat_python_api_nicklist_search_nick (PyObject *self, PyObject *args)
{
char *buffer, *from_group, *name, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_search_nick");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "nicklist_search_nick", API_RETURN_EMPTY);
buffer = NULL;
from_group = NULL;
name = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &buffer, &from_group, &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_search_nick");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_nicklist_search_nick (script_str2ptr (buffer),
script_str2ptr (from_group),
name));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5591,28 +4208,16 @@ weechat_python_api_nicklist_remove_group (PyObject *self, PyObject *args)
{
char *buffer, *group;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_remove_group");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_remove_group", API_RETURN_ERROR);
buffer = NULL;
group = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &buffer, &group))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_remove_group");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_nicklist_remove_group (script_str2ptr (buffer),
script_str2ptr (group));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5624,28 +4229,16 @@ weechat_python_api_nicklist_remove_nick (PyObject *self, PyObject *args)
{
char *buffer, *nick;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_remove_nick");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_remove_nick", API_RETURN_ERROR);
buffer = NULL;
nick = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &buffer, &nick))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_remove_nick");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_nicklist_remove_nick (script_str2ptr (buffer),
script_str2ptr (nick));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5657,26 +4250,14 @@ weechat_python_api_nicklist_remove_all (PyObject *self, PyObject *args)
{
char *buffer;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_remove_all");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_remove_all", API_RETURN_ERROR);
buffer = NULL;
-
if (!PyArg_ParseTuple (args, "s", &buffer))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_remove_all");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_nicklist_remove_all (script_str2ptr (buffer));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5689,30 +4270,18 @@ weechat_python_api_nicklist_group_get_integer (PyObject *self, PyObject *args)
char *buffer, *group, *property;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_group_get_integer");
- PYTHON_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "nicklist_group_get_integer", API_RETURN_INT(-1));
buffer = NULL;
group = NULL;
property = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &buffer, &group, &property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_group_get_integer");
- PYTHON_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
value = weechat_nicklist_group_get_integer (script_str2ptr (buffer),
script_str2ptr (group),
property);
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -5725,30 +4294,18 @@ weechat_python_api_nicklist_group_get_string (PyObject *self, PyObject *args)
char *buffer, *group, *property;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_group_get_string");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_group_get_string", API_RETURN_ERROR);
buffer = NULL;
group = NULL;
property = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &buffer, &group, &property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_group_get_string");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_nicklist_group_get_string (script_str2ptr (buffer),
script_str2ptr (group),
property);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -5759,32 +4316,20 @@ static PyObject *
weechat_python_api_nicklist_group_get_pointer (PyObject *self, PyObject *args)
{
char *buffer, *group, *property, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_group_get_pointer");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "nicklist_group_get_pointer", API_RETURN_EMPTY);
buffer = NULL;
group = NULL;
property = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &buffer, &group, &property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_group_get_pointer");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_nicklist_group_get_pointer (script_str2ptr (buffer),
script_str2ptr (group),
property));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5796,32 +4341,20 @@ weechat_python_api_nicklist_group_set (PyObject *self, PyObject *args)
{
char *buffer, *group, *property, *value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_group_set");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_group_set", API_RETURN_ERROR);
buffer = NULL;
group = NULL;
property = NULL;
value = NULL;
-
if (!PyArg_ParseTuple (args, "ssss", &buffer, &group, &property, &value))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_group_set");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_nicklist_group_set (script_str2ptr (buffer),
script_str2ptr (group),
property,
value);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5834,30 +4367,18 @@ weechat_python_api_nicklist_nick_get_integer (PyObject *self, PyObject *args)
char *buffer, *nick, *property;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_nick_get_integer");
- PYTHON_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "nicklist_nick_get_integer", API_RETURN_INT(-1));
buffer = NULL;
nick = NULL;
property = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &buffer, &nick, &property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_nick_get_integer");
- PYTHON_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
value = weechat_nicklist_nick_get_integer (script_str2ptr (buffer),
script_str2ptr (nick),
property);
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -5870,30 +4391,18 @@ weechat_python_api_nicklist_nick_get_string (PyObject *self, PyObject *args)
char *buffer, *nick, *property;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_nick_get_string");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_nick_get_string", API_RETURN_ERROR);
buffer = NULL;
nick = NULL;
property = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &buffer, &nick, &property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_nick_get_string");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_nicklist_nick_get_string (script_str2ptr (buffer),
script_str2ptr (nick),
property);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -5904,32 +4413,20 @@ static PyObject *
weechat_python_api_nicklist_nick_get_pointer (PyObject *self, PyObject *args)
{
char *buffer, *nick, *property, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_nick_get_pointer");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "nicklist_nick_get_pointer", API_RETURN_EMPTY);
buffer = NULL;
nick = NULL;
property = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &buffer, &nick, &property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_nick_get_pointer");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_nicklist_nick_get_pointer (script_str2ptr (buffer),
script_str2ptr (nick),
property));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5941,32 +4438,20 @@ weechat_python_api_nicklist_nick_set (PyObject *self, PyObject *args)
{
char *buffer, *nick, *property, *value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_nick_set");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_nick_set", API_RETURN_ERROR);
buffer = NULL;
nick = NULL;
property = NULL;
value = NULL;
-
if (!PyArg_ParseTuple (args, "ssss", &buffer, &nick, &property, &value))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_nick_set");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_nicklist_nick_set (script_str2ptr (buffer),
script_str2ptr (nick),
property,
value);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5977,28 +4462,16 @@ static PyObject *
weechat_python_api_bar_item_search (PyObject *self, PyObject *args)
{
char *name, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "bar_item_search");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "bar_item_search", API_RETURN_EMPTY);
name = NULL;
-
if (!PyArg_ParseTuple (args, "s", &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "bar_item_search");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_bar_item_search (name));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6010,26 +4483,26 @@ weechat_python_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
{
struct t_script_callback *script_callback;
- void *python_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' }, *ret;
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (item);
- python_argv[2] = script_ptr2str (window);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (item);
+ func_argv[2] = script_ptr2str (window);
ret = (char *)weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
- "sss", python_argv);
+ "sss", func_argv);
- if (python_argv[1])
- free (python_argv[1]);
- if (python_argv[2])
- free (python_argv[2]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[2])
+ free (func_argv[2]);
return ret;
}
@@ -6045,26 +4518,14 @@ static PyObject *
weechat_python_api_bar_item_new (PyObject *self, PyObject *args)
{
char *name, *function, *data, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "bar_item_new");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "bar_item_new", API_RETURN_EMPTY);
name = NULL;
function = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &name, &function, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "bar_item_new");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_bar_item_new (weechat_python_plugin,
python_current_script,
@@ -6073,7 +4534,7 @@ weechat_python_api_bar_item_new (PyObject *self, PyObject *args)
function,
data));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6085,26 +4546,14 @@ weechat_python_api_bar_item_update (PyObject *self, PyObject *args)
{
char *name;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "bar_item_update");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "bar_item_update", API_RETURN_ERROR);
name = NULL;
-
if (!PyArg_ParseTuple (args, "s", &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "bar_item_update");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_bar_item_update (name);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6116,28 +4565,16 @@ weechat_python_api_bar_item_remove (PyObject *self, PyObject *args)
{
char *item;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "bar_item_remove");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "bar_item_remove", API_RETURN_ERROR);
item = NULL;
-
if (!PyArg_ParseTuple (args, "s", &item))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "bar_item_remove");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_bar_item_remove (weechat_python_plugin,
python_current_script,
script_str2ptr (item));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6148,28 +4585,16 @@ static PyObject *
weechat_python_api_bar_search (PyObject *self, PyObject *args)
{
char *name, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "bar_search");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "bar_search", API_RETURN_EMPTY);
name = NULL;
-
if (!PyArg_ParseTuple (args, "s", &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "bar_search");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_bar_search (name));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6182,17 +4607,9 @@ weechat_python_api_bar_new (PyObject *self, PyObject *args)
char *name, *hidden, *priority, *type, *conditions, *position;
char *filling_top_bottom, *filling_left_right, *size, *size_max;
char *color_fg, *color_delim, *color_bg, *separator, *items, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "bar_new");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "bar_new", API_RETURN_EMPTY);
name = NULL;
hidden = NULL;
priority = NULL;
@@ -6208,15 +4625,11 @@ weechat_python_api_bar_new (PyObject *self, PyObject *args)
color_bg = NULL;
separator = NULL;
items = NULL;
-
if (!PyArg_ParseTuple (args, "sssssssssssssss", &name, &hidden, &priority,
&type, &conditions, &position, &filling_top_bottom,
&filling_left_right, &size, &size_max, &color_fg,
&color_delim, &color_bg, &separator, &items))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "bar_new");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_bar_new (name,
hidden,
@@ -6234,7 +4647,7 @@ weechat_python_api_bar_new (PyObject *self, PyObject *args)
separator,
items));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6246,30 +4659,18 @@ weechat_python_api_bar_set (PyObject *self, PyObject *args)
{
char *bar, *property, *value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "bar_set");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "bar_set", API_RETURN_ERROR);
bar = NULL;
property = NULL;
value = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &bar, &property, &value))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "bar_set");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_bar_set (script_str2ptr (bar),
property,
value);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6281,26 +4682,14 @@ weechat_python_api_bar_update (PyObject *self, PyObject *args)
{
char *name;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "bar_item");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "bar_item", API_RETURN_ERROR);
name = NULL;
-
if (!PyArg_ParseTuple (args, "s", &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "bar_item");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_bar_update (name);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6312,26 +4701,14 @@ weechat_python_api_bar_remove (PyObject *self, PyObject *args)
{
char *bar;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "bar_remove");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "bar_remove", API_RETURN_ERROR);
bar = NULL;
-
if (!PyArg_ParseTuple (args, "s", &bar))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "bar_remove");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_bar_remove (script_str2ptr (bar));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6343,30 +4720,18 @@ weechat_python_api_command (PyObject *self, PyObject *args)
{
char *buffer, *command;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "command");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "command", API_RETURN_ERROR);
buffer = NULL;
command = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &buffer, &command))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "command");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_command (weechat_python_plugin,
python_current_script,
script_str2ptr (buffer),
command);
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6379,27 +4744,15 @@ weechat_python_api_info_get (PyObject *self, PyObject *args)
char *info_name, *arguments;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "info_get");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "info_get", API_RETURN_EMPTY);
info_name = NULL;
arguments = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &info_name, &arguments))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "info_get");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_info_get (info_name, arguments);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -6413,22 +4766,10 @@ weechat_python_api_info_get_hashtable (PyObject *self, PyObject *args)
struct t_hashtable *hashtable, *result_hashtable;
PyObject *dict, *result_dict;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "info_get_hashtable");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "info_get_hashtable", API_RETURN_EMPTY);
info_name = NULL;
-
if (!PyArg_ParseTuple (args, "sO", &info_name, &dict))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "info_get_hashtable");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
hashtable = weechat_python_dict_to_hashtable (dict,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
@@ -6451,21 +4792,15 @@ static PyObject *
weechat_python_api_infolist_new (PyObject *self, PyObject *args)
{
char *result;
- PyObject *object;
+ PyObject *return_value;
/* make C compiler happy */
- (void) self;
(void) args;
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_new");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_new", API_RETURN_EMPTY);
result = script_ptr2str (weechat_infolist_new ());
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6476,28 +4811,16 @@ static PyObject *
weechat_python_api_infolist_new_item (PyObject *self, PyObject *args)
{
char *infolist, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_new_item");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "infolist_new_item", API_RETURN_EMPTY);
infolist = NULL;
-
if (!PyArg_ParseTuple (args, "s", &infolist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_new_item");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_infolist_new_item (script_str2ptr (infolist)));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6510,32 +4833,20 @@ weechat_python_api_infolist_new_var_integer (PyObject *self, PyObject *args)
{
char *infolist, *name, *result;
int value;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_new_var_integer");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "infolist_new_var_integer", API_RETURN_EMPTY);
infolist = NULL;
name = NULL;
value = 0;
-
if (!PyArg_ParseTuple (args, "ssi", &infolist, &name, &value))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_new_var_integer");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_infolist_new_var_integer (script_str2ptr (infolist),
name,
value));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6547,32 +4858,20 @@ static PyObject *
weechat_python_api_infolist_new_var_string (PyObject *self, PyObject *args)
{
char *infolist, *name, *value, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_new_var_string");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "infolist_new_var_string", API_RETURN_EMPTY);
infolist = NULL;
name = NULL;
value = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &infolist, &name, &value))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_new_var_string");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_infolist_new_var_string (script_str2ptr (infolist),
name,
value));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6584,32 +4883,20 @@ static PyObject *
weechat_python_api_infolist_new_var_pointer (PyObject *self, PyObject *args)
{
char *infolist, *name, *value, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_new_var_pointer");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "infolist_new_var_pointer", API_RETURN_EMPTY);
infolist = NULL;
name = NULL;
value = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &infolist, &name, &value))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_new_var_pointer");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_infolist_new_var_pointer (script_str2ptr (infolist),
name,
script_str2ptr (value)));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6622,32 +4909,20 @@ weechat_python_api_infolist_new_var_time (PyObject *self, PyObject *args)
{
char *infolist, *name, *result;
int value;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_new_var_time");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "infolist_new_var_time", API_RETURN_EMPTY);
infolist = NULL;
name = NULL;
value = 0;
-
if (!PyArg_ParseTuple (args, "ssi", &infolist, &name, &value))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_new_var_time");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_infolist_new_var_time (script_str2ptr (infolist),
name,
value));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6658,32 +4933,20 @@ static PyObject *
weechat_python_api_infolist_get (PyObject *self, PyObject *args)
{
char *name, *pointer, *arguments, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_get");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "infolist_get", API_RETURN_EMPTY);
name = NULL;
pointer = NULL;
arguments = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &name, &pointer, &arguments))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_get");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_infolist_get (name,
script_str2ptr (pointer),
arguments));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6696,26 +4959,14 @@ weechat_python_api_infolist_next (PyObject *self, PyObject *args)
char *infolist;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_next");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "infolist_next", API_RETURN_INT(0));
infolist = NULL;
-
if (!PyArg_ParseTuple (args, "s", &infolist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_next");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_infolist_next (script_str2ptr (infolist));
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -6728,26 +4979,14 @@ weechat_python_api_infolist_prev (PyObject *self, PyObject *args)
char *infolist;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_prev");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "infolist_prev", API_RETURN_INT(0));
infolist = NULL;
-
if (!PyArg_ParseTuple (args, "s", &infolist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_prev");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_infolist_prev (script_str2ptr (infolist));
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -6760,26 +4999,14 @@ weechat_python_api_infolist_reset_item_cursor (PyObject *self, PyObject *args)
{
char *infolist;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_reset_item_cursor");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "infolist_reset_item_cursor", API_RETURN_ERROR);
infolist = NULL;
-
if (!PyArg_ParseTuple (args, "s", &infolist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_reset_item_cursor");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_infolist_reset_item_cursor (script_str2ptr (infolist));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6792,26 +5019,14 @@ weechat_python_api_infolist_fields (PyObject *self, PyObject *args)
char *infolist;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_fields");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_fields", API_RETURN_EMPTY);
infolist = NULL;
-
if (!PyArg_ParseTuple (args, "s", &infolist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_fields");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_infolist_fields (script_str2ptr (infolist));
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -6824,28 +5039,16 @@ weechat_python_api_infolist_integer (PyObject *self, PyObject *args)
char *infolist, *variable;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_integer");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "infolist_integer", API_RETURN_INT(0));
infolist = NULL;
variable = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &infolist, &variable))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_integer");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_infolist_integer (script_str2ptr (infolist),
variable);
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -6858,28 +5061,16 @@ weechat_python_api_infolist_string (PyObject *self, PyObject *args)
char *infolist, *variable;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_string");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_string", API_RETURN_EMPTY);
infolist = NULL;
variable = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &infolist, &variable))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_string");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_infolist_string (script_str2ptr (infolist),
variable);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -6890,30 +5081,18 @@ static PyObject *
weechat_python_api_infolist_pointer (PyObject *self, PyObject *args)
{
char *infolist, *variable, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_pointer");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "infolist_pointer", API_RETURN_EMPTY);
infolist = NULL;
variable = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &infolist, &variable))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_pointer");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_infolist_pointer (script_str2ptr (infolist),
variable));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6925,32 +5104,20 @@ weechat_python_api_infolist_time (PyObject *self, PyObject *args)
{
char *infolist, *variable, timebuffer[64], *result;
time_t time;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_time");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "infolist_time", API_RETURN_EMPTY);
infolist = NULL;
variable = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &infolist, &variable))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_time");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
time = weechat_infolist_time (script_str2ptr (infolist),
variable);
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
result = strdup (timebuffer);
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6962,26 +5129,14 @@ weechat_python_api_infolist_free (PyObject *self, PyObject *args)
{
char *infolist;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_free");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "infolist_free", API_RETURN_ERROR);
infolist = NULL;
-
if (!PyArg_ParseTuple (args, "s", &infolist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_free");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_infolist_free (script_str2ptr (infolist));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6992,28 +5147,16 @@ static PyObject *
weechat_python_api_hdata_get (PyObject *self, PyObject *args)
{
char *name, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hdata_get", API_RETURN_EMPTY);
name = NULL;
-
if (!PyArg_ParseTuple (args, "s", &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_hdata_get (name));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7026,27 +5169,15 @@ weechat_python_api_hdata_get_var_offset (PyObject *self, PyObject *args)
char *hdata, *name;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get_var_offset");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "hdata_get_var_offset", API_RETURN_INT(0));
hdata = NULL;
name = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &hdata, &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get_var_offset");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_hdata_get_var_offset (script_str2ptr (hdata), name);
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -7060,27 +5191,15 @@ weechat_python_api_hdata_get_var_type_string (PyObject *self, PyObject *args)
char *hdata, *name;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get_var_type_string");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_get_var_type_string", API_RETURN_EMPTY);
hdata = NULL;
name = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &hdata, &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get_var_type_string");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_hdata_get_var_type_string (script_str2ptr (hdata), name);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -7093,27 +5212,15 @@ weechat_python_api_hdata_get_var_hdata (PyObject *self, PyObject *args)
char *hdata, *name;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get_var_hdata");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_get_var_hdata", API_RETURN_EMPTY);
hdata = NULL;
name = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &hdata, &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get_var_hdata");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_hdata_get_var_hdata (script_str2ptr (hdata), name);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -7124,30 +5231,18 @@ static PyObject *
weechat_python_api_hdata_get_list (PyObject *self, PyObject *args)
{
char *hdata, *name, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get_list");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hdata_get_list", API_RETURN_EMPTY);
hdata = NULL;
name = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &hdata, &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get_list");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_hdata_get_list (script_str2ptr (hdata),
name));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7159,32 +5254,20 @@ weechat_python_api_hdata_move (PyObject *self, PyObject *args)
{
char *result, *hdata, *pointer;
int count;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_move");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hdata_move", API_RETURN_EMPTY);
hdata = NULL;
pointer = NULL;
count = 0;
-
if (!PyArg_ParseTuple (args, "ssi", &hdata, &pointer, &count))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_move");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_hdata_move (script_str2ptr (hdata),
script_str2ptr (pointer),
count));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7198,30 +5281,18 @@ weechat_python_api_hdata_integer (PyObject *self, PyObject *args)
char *hdata, *pointer, *name;
int value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_integer");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "hdata_integer", API_RETURN_INT(0));
hdata = NULL;
pointer = NULL;
name = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_integer");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
value = weechat_hdata_integer (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
- PYTHON_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -7235,30 +5306,18 @@ weechat_python_api_hdata_long (PyObject *self, PyObject *args)
char *hdata, *pointer, *name;
long value;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_long");
- PYTHON_RETURN_LONG(0);
- }
-
+ API_FUNC(1, "hdata_long", API_RETURN_LONG(0));
hdata = NULL;
pointer = NULL;
name = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_long");
- PYTHON_RETURN_LONG(0);
- }
+ API_WRONG_ARGS(API_RETURN_LONG(0));
value = weechat_hdata_long (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
- PYTHON_RETURN_LONG(value);
+ API_RETURN_LONG(value);
}
/*
@@ -7272,30 +5331,18 @@ weechat_python_api_hdata_string (PyObject *self, PyObject *args)
char *hdata, *pointer, *name;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_string");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_string", API_RETURN_EMPTY);
hdata = NULL;
pointer = NULL;
name = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_string");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_hdata_string (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -7307,32 +5354,20 @@ static PyObject *
weechat_python_api_hdata_pointer (PyObject *self, PyObject *args)
{
char *hdata, *pointer, *name, *result;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_pointer");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hdata_pointer", API_RETURN_EMPTY);
hdata = NULL;
pointer = NULL;
name = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_pointer");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_hdata_pointer (script_str2ptr (hdata),
script_str2ptr (pointer),
name));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7345,26 +5380,14 @@ weechat_python_api_hdata_time (PyObject *self, PyObject *args)
{
char *hdata, *pointer, *name, timebuffer[64], *result;
time_t time;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_time");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "hdata_time", API_RETURN_EMPTY);
hdata = NULL;
pointer = NULL;
name = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_time");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
time = weechat_hdata_time (script_str2ptr (hdata),
script_str2ptr (pointer),
@@ -7372,7 +5395,7 @@ weechat_python_api_hdata_time (PyObject *self, PyObject *args)
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
result = strdup (timebuffer);
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7385,27 +5408,15 @@ weechat_python_api_hdata_get_string (PyObject *self, PyObject *args)
char *hdata, *property;
const char *result;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get_string");
- PYTHON_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_get_string", API_RETURN_EMPTY);
hdata = NULL;
property = NULL;
-
if (!PyArg_ParseTuple (args, "ss", &hdata, &property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get_string");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_hdata_get_string (script_str2ptr (hdata), property);
- PYTHON_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -7417,29 +5428,17 @@ weechat_python_api_upgrade_new (PyObject *self, PyObject *args)
{
char *filename, *result;
int write;
- PyObject *object;
-
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "upgrade_new");
- PYTHON_RETURN_EMPTY;
- }
+ PyObject *return_value;
+ API_FUNC(1, "upgrade_new", API_RETURN_EMPTY);
filename = NULL;
write = 0;
-
if (!PyArg_ParseTuple (args, "si", &filename, &write))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "upgrade_new");
- PYTHON_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_upgrade_new (filename, write));
- PYTHON_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7452,30 +5451,18 @@ weechat_python_api_upgrade_write_object (PyObject *self, PyObject *args)
char *upgrade_file, *infolist;
int object_id, rc;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "upgrade_write_object");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "upgrade_write_object", API_RETURN_INT(0));
upgrade_file = NULL;
object_id = 0;
infolist = NULL;
-
if (!PyArg_ParseTuple (args, "sis", &upgrade_file, &object_id, &infolist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "upgrade_write_object");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
rc = weechat_upgrade_write_object (script_str2ptr (upgrade_file),
object_id,
script_str2ptr (infolist));
- PYTHON_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -7489,7 +5476,7 @@ weechat_python_api_upgrade_read_cb (void *data,
struct t_infolist *infolist)
{
struct t_script_callback *script_callback;
- void *python_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' }, str_object_id[32];
int *rc, ret;
@@ -7499,15 +5486,15 @@ weechat_python_api_upgrade_read_cb (void *data,
{
snprintf (str_object_id, sizeof (str_object_id), "%d", object_id);
- python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- python_argv[1] = script_ptr2str (upgrade_file);
- python_argv[2] = str_object_id;
- python_argv[3] = script_ptr2str (infolist);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (upgrade_file);
+ func_argv[2] = str_object_id;
+ func_argv[3] = script_ptr2str (infolist);
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ssss", python_argv);
+ "ssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -7516,10 +5503,10 @@ weechat_python_api_upgrade_read_cb (void *data,
ret = *rc;
free (rc);
}
- if (python_argv[1])
- free (python_argv[1]);
- if (python_argv[3])
- free (python_argv[3]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[3])
+ free (func_argv[3]);
return ret;
}
@@ -7537,24 +5524,12 @@ weechat_python_api_upgrade_read (PyObject *self, PyObject *args)
char *upgrade_file, *function, *data;
int rc;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "upgrade_read");
- PYTHON_RETURN_INT(0);
- }
-
+ API_FUNC(1, "upgrade_read", API_RETURN_INT(0));
upgrade_file = NULL;
function = NULL;
data = NULL;
-
if (!PyArg_ParseTuple (args, "sss", &upgrade_file, &function, &data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "upgrade_read");
- PYTHON_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
rc = script_api_upgrade_read (weechat_python_plugin,
python_current_script,
@@ -7563,7 +5538,7 @@ weechat_python_api_upgrade_read (PyObject *self, PyObject *args)
function,
data);
- PYTHON_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -7575,26 +5550,14 @@ weechat_python_api_upgrade_close (PyObject *self, PyObject *args)
{
char *upgrade_file;
- /* make C compiler happy */
- (void) self;
-
- if (!python_current_script || !python_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "upgrade_close");
- PYTHON_RETURN_ERROR;
- }
-
+ API_FUNC(1, "upgrade_close", API_RETURN_ERROR);
upgrade_file = NULL;
-
if (!PyArg_ParseTuple (args, "s", &upgrade_file))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "upgrade_close");
- PYTHON_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_upgrade_close (script_str2ptr (upgrade_file));
- PYTHON_RETURN_OK;
+ API_RETURN_OK;
}
/*
diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c
index 30866b60d..a6fe6f663 100644
--- a/src/plugins/scripts/python/weechat-python.c
+++ b/src/plugins/scripts/python/weechat-python.c
@@ -642,7 +642,7 @@ weechat_python_load_cb (void *data, const char *filename)
void
weechat_python_unload (struct t_plugin_script *script)
{
- int *r;
+ int *rc;
void *interpreter;
PyThreadState *old_interpreter;
@@ -655,12 +655,12 @@ weechat_python_unload (struct t_plugin_script *script)
if (script->shutdown_func && script->shutdown_func[0])
{
- r = (int *) weechat_python_exec (script, WEECHAT_SCRIPT_EXEC_INT,
- script->shutdown_func, NULL, NULL);
- if (r)
- free (r);
+ rc = (int *) weechat_python_exec (script, WEECHAT_SCRIPT_EXEC_INT,
+ script->shutdown_func, NULL, NULL);
+ if (rc)
+ free (rc);
}
-
+
old_interpreter = PyThreadState_Swap (NULL);
interpreter = script->interpreter;
diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c
index 3df1fa97b..ba743c862 100644
--- a/src/plugins/scripts/ruby/weechat-ruby-api.c
+++ b/src/plugins/scripts/ruby/weechat-ruby-api.c
@@ -33,14 +33,31 @@
#include "../script-callback.h"
#include "weechat-ruby.h"
-#define RUBY_RETURN_OK return INT2FIX (1);
-#define RUBY_RETURN_ERROR return INT2FIX (0);
-#define RUBY_RETURN_EMPTY return Qnil;
-#define RUBY_RETURN_STRING(__string) \
+
+#define API_FUNC(__init, __name, __ret) \
+ char *ruby_function_name = __name; \
+ (void) class; \
+ if (__init \
+ && (!ruby_current_script || !ruby_current_script->name)) \
+ { \
+ WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, \
+ ruby_function_name); \
+ __ret; \
+ }
+#define API_WRONG_ARGS(__ret) \
+ { \
+ WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, \
+ ruby_function_name); \
+ __ret; \
+ }
+#define API_RETURN_OK return INT2FIX (1);
+#define API_RETURN_ERROR return INT2FIX (0);
+#define API_RETURN_EMPTY return Qnil;
+#define API_RETURN_STRING(__string) \
if (__string) \
return rb_str_new2 (__string); \
return rb_str_new2 ("")
-#define RUBY_RETURN_STRING_FREE(__string) \
+#define API_RETURN_STRING_FREE(__string) \
if (__string) \
{ \
return_value = rb_str_new2 (__string); \
@@ -48,10 +65,10 @@
return return_value; \
} \
return rb_str_new2 ("")
-#define RUBY_RETURN_INT(__int) \
- return INT2FIX(__int);
-#define RUBY_RETURN_LONG(__long) \
- return LONG2FIX(__long);
+#define API_RETURN_INT(__int) \
+ return INT2FIX (__int);
+#define API_RETURN_LONG(__long) \
+ return LONG2FIX (__long);
/*
@@ -66,19 +83,13 @@ weechat_ruby_api_register (VALUE class, VALUE name, VALUE author,
char *c_name, *c_author, *c_version, *c_license, *c_description;
char *c_shutdown_func, *c_charset;
- /* make C compiler happy */
- (void) class;
-
+ API_FUNC(0, "register", API_RETURN_ERROR);
ruby_current_script = NULL;
ruby_registered_script = NULL;
-
if (NIL_P (name) || NIL_P (author) || NIL_P (version)
|| NIL_P (license) || NIL_P (description) || NIL_P (shutdown_func)
|| NIL_P (charset))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(ruby_current_script_filename, "register");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (name, T_STRING);
Check_Type (author, T_STRING);
@@ -104,7 +115,7 @@ weechat_ruby_api_register (VALUE class, VALUE name, VALUE author,
"\"%s\" (another script already "
"exists with this name)"),
weechat_prefix ("error"), RUBY_PLUGIN_NAME, c_name);
- RUBY_RETURN_ERROR;
+ API_RETURN_ERROR;
}
/* register script */
@@ -129,10 +140,10 @@ weechat_ruby_api_register (VALUE class, VALUE name, VALUE author,
}
else
{
- RUBY_RETURN_ERROR;
+ API_RETURN_ERROR;
}
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -146,20 +157,9 @@ weechat_ruby_api_plugin_get_name (VALUE class, VALUE plugin)
char *c_plugin;
const char *result;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "plugin_get_name");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "plugin_get_name", API_RETURN_EMPTY);
if (NIL_P (plugin))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "plugin_get_name");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (plugin, T_STRING);
@@ -167,7 +167,7 @@ weechat_ruby_api_plugin_get_name (VALUE class, VALUE plugin)
result = weechat_plugin_get_name (script_str2ptr (c_plugin));
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -179,20 +179,9 @@ weechat_ruby_api_charset_set (VALUE class, VALUE charset)
{
char *c_charset;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "charset_set");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "charset_set", API_RETURN_ERROR);
if (NIL_P (charset))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "charset_set");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (charset, T_STRING);
@@ -200,7 +189,7 @@ weechat_ruby_api_charset_set (VALUE class, VALUE charset)
script_api_charset_set (ruby_current_script, c_charset);
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -213,20 +202,9 @@ weechat_ruby_api_iconv_to_internal (VALUE class, VALUE charset, VALUE string)
char *c_charset, *c_string, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "iconv_to_internal");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "iconv_to_internal", API_RETURN_EMPTY);
if (NIL_P (charset) || NIL_P (string))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "iconv_to_internal");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (charset, T_STRING);
Check_Type (string, T_STRING);
@@ -236,7 +214,7 @@ weechat_ruby_api_iconv_to_internal (VALUE class, VALUE charset, VALUE string)
result = weechat_iconv_to_internal (c_charset, c_string);
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -250,20 +228,9 @@ weechat_ruby_api_iconv_from_internal (VALUE class, VALUE charset, VALUE string)
char *c_charset, *c_string, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "iconv_from_internal");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "iconv_from_internal", API_RETURN_EMPTY);
if (NIL_P (charset) || NIL_P (string))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "iconv_from_internal");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (charset, T_STRING);
Check_Type (string, T_STRING);
@@ -273,7 +240,7 @@ weechat_ruby_api_iconv_from_internal (VALUE class, VALUE charset, VALUE string)
result = weechat_iconv_from_internal (c_charset, c_string);
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -286,20 +253,9 @@ weechat_ruby_api_gettext (VALUE class, VALUE string)
char *c_string;
const char *result;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "gettext");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "gettext", API_RETURN_EMPTY);
if (NIL_P (string))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "gettext");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (string, T_STRING);
@@ -307,7 +263,7 @@ weechat_ruby_api_gettext (VALUE class, VALUE string)
result = weechat_gettext (c_string);
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -322,20 +278,9 @@ weechat_ruby_api_ngettext (VALUE class, VALUE single, VALUE plural,
const char *result;
int c_count;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "ngettext");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "ngettext", API_RETURN_EMPTY);
if (NIL_P (single) || NIL_P (plural) || NIL_P (count))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "ngettext");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (single, T_STRING);
Check_Type (plural, T_STRING);
@@ -347,7 +292,7 @@ weechat_ruby_api_ngettext (VALUE class, VALUE single, VALUE plural,
result = weechat_ngettext (c_single, c_plural, c_count);
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -363,20 +308,9 @@ weechat_ruby_api_string_match (VALUE class, VALUE string, VALUE mask,
char *c_string, *c_mask;
int c_case_sensitive, value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "string_match");
- RUBY_RETURN_INT(0);
- }
-
+ API_FUNC(1, "string_match", API_RETURN_INT(0));
if (NIL_P (string) || NIL_P (mask) || NIL_P (case_sensitive))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "string_match");
- RUBY_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (string, T_STRING);
Check_Type (mask, T_STRING);
@@ -388,7 +322,7 @@ weechat_ruby_api_string_match (VALUE class, VALUE string, VALUE mask,
value = weechat_string_match (c_string, c_mask, c_case_sensitive);
- RUBY_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -406,20 +340,9 @@ weechat_ruby_api_string_has_highlight (VALUE class, VALUE string,
char *c_string, *c_highlight_words;
int value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "string_has_highlight");
- RUBY_RETURN_INT(0);
- }
-
+ API_FUNC(1, "string_has_highlight", API_RETURN_INT(0));
if (NIL_P (string) || NIL_P (highlight_words))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "string_has_highlight");
- RUBY_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (string, T_STRING);
Check_Type (highlight_words, T_STRING);
@@ -429,7 +352,7 @@ weechat_ruby_api_string_has_highlight (VALUE class, VALUE string,
value = weechat_string_has_highlight (c_string, c_highlight_words);
- RUBY_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -447,20 +370,9 @@ weechat_ruby_api_string_has_highlight_regex (VALUE class, VALUE string,
char *c_string, *c_regex;
int value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "string_has_highlight_regex");
- RUBY_RETURN_INT(0);
- }
-
+ API_FUNC(1, "string_has_highlight_regex", API_RETURN_INT(0));
if (NIL_P (string) || NIL_P (regex))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "string_has_highlight_regex");
- RUBY_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (string, T_STRING);
Check_Type (regex, T_STRING);
@@ -470,7 +382,7 @@ weechat_ruby_api_string_has_highlight_regex (VALUE class, VALUE string,
value = weechat_string_has_highlight_regex (c_string, c_regex);
- RUBY_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -486,20 +398,9 @@ weechat_ruby_api_string_mask_to_regex (VALUE class, VALUE mask)
char *c_mask, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "string_mask_to_regex");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "string_mask_to_regex", API_RETURN_EMPTY);
if (NIL_P (mask))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "string_mask_to_regex");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (mask, T_STRING);
@@ -507,7 +408,7 @@ weechat_ruby_api_string_mask_to_regex (VALUE class, VALUE mask)
result = weechat_string_mask_to_regex (c_mask);
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -521,20 +422,9 @@ weechat_ruby_api_string_remove_color (VALUE class, VALUE string,
char *c_string, *c_replacement, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "string_remove_color");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "string_remove_color", API_RETURN_EMPTY);
if (NIL_P (string) || NIL_P (replacement))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "string_remove_color");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (string, T_STRING);
Check_Type (replacement, T_STRING);
@@ -544,7 +434,7 @@ weechat_ruby_api_string_remove_color (VALUE class, VALUE string,
result = weechat_string_remove_color (c_string, c_replacement);
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -558,20 +448,9 @@ weechat_ruby_api_string_is_command_char (VALUE class, VALUE string)
char *c_string;
int value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "string_is_command_char");
- RUBY_RETURN_INT(0);
- }
-
+ API_FUNC(1, "string_is_command_char", API_RETURN_INT(0));
if (NIL_P (string))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "string_is_command_char");
- RUBY_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (string, T_STRING);
@@ -579,7 +458,7 @@ weechat_ruby_api_string_is_command_char (VALUE class, VALUE string)
value = weechat_string_is_command_char (c_string);
- RUBY_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -594,20 +473,9 @@ weechat_ruby_api_string_input_for_buffer (VALUE class, VALUE string)
char *c_string;
const char *result;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "string_input_for_buffer");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "string_input_for_buffer", API_RETURN_EMPTY);
if (NIL_P (string))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "string_input_for_buffer");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (string, T_STRING);
@@ -615,7 +483,7 @@ weechat_ruby_api_string_input_for_buffer (VALUE class, VALUE string)
result = weechat_string_input_for_buffer (c_string);
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -628,20 +496,9 @@ weechat_ruby_api_mkdir_home (VALUE class, VALUE directory, VALUE mode)
char *c_directory;
int c_mode;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "mkdir_home");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "mkdir_home", API_RETURN_ERROR);
if (NIL_P (directory) || NIL_P (mode))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "mkdir_home");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (directory, T_STRING);
Check_Type (mode, T_FIXNUM);
@@ -650,9 +507,9 @@ weechat_ruby_api_mkdir_home (VALUE class, VALUE directory, VALUE mode)
c_mode = FIX2INT (mode);
if (weechat_mkdir_home (c_directory, c_mode))
- RUBY_RETURN_OK;
+ API_RETURN_OK;
- RUBY_RETURN_ERROR;
+ API_RETURN_ERROR;
}
/*
@@ -665,20 +522,9 @@ weechat_ruby_api_mkdir (VALUE class, VALUE directory, VALUE mode)
char *c_directory;
int c_mode;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "mkdir");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "mkdir", API_RETURN_ERROR);
if (NIL_P (directory) || NIL_P (mode))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "mkdir");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (directory, T_STRING);
Check_Type (mode, T_FIXNUM);
@@ -687,9 +533,9 @@ weechat_ruby_api_mkdir (VALUE class, VALUE directory, VALUE mode)
c_mode = FIX2INT (mode);
if (weechat_mkdir (c_directory, c_mode))
- RUBY_RETURN_OK;
+ API_RETURN_OK;
- RUBY_RETURN_ERROR;
+ API_RETURN_ERROR;
}
/*
@@ -703,20 +549,9 @@ weechat_ruby_api_mkdir_parents (VALUE class, VALUE directory, VALUE mode)
char *c_directory;
int c_mode;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "mkdir_parents");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "mkdir_parents", API_RETURN_ERROR);
if (NIL_P (directory) || NIL_P (mode))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "mkdir_parents");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (directory, T_STRING);
Check_Type (mode, T_FIXNUM);
@@ -725,9 +560,9 @@ weechat_ruby_api_mkdir_parents (VALUE class, VALUE directory, VALUE mode)
c_mode = FIX2INT (mode);
if (weechat_mkdir_parents (c_directory, c_mode))
- RUBY_RETURN_OK;
+ API_RETURN_OK;
- RUBY_RETURN_ERROR;
+ API_RETURN_ERROR;
}
/*
@@ -739,18 +574,11 @@ weechat_ruby_api_list_new (VALUE class)
{
char *result;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "list_new");
- RUBY_RETURN_EMPTY;
- }
+ API_FUNC(1, "list_new", API_RETURN_EMPTY);
result = script_ptr2str (weechat_list_new ());
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -763,20 +591,9 @@ weechat_ruby_api_list_add (VALUE class, VALUE weelist, VALUE data, VALUE where,
{
char *c_weelist, *c_data, *c_where, *c_user_data, *result;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "list_add");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "list_add", API_RETURN_EMPTY);
if (NIL_P (weelist) || NIL_P (data) || NIL_P (where) || NIL_P (user_data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "list_add");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (weelist, T_STRING);
Check_Type (data, T_STRING);
@@ -788,12 +605,12 @@ weechat_ruby_api_list_add (VALUE class, VALUE weelist, VALUE data, VALUE where,
c_where = StringValuePtr (where);
c_user_data = StringValuePtr (user_data);
- result = script_ptr2str (weechat_list_add (script_str2ptr(c_weelist),
+ result = script_ptr2str (weechat_list_add (script_str2ptr (c_weelist),
c_data,
c_where,
script_str2ptr (c_user_data)));
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -805,20 +622,9 @@ weechat_ruby_api_list_search (VALUE class, VALUE weelist, VALUE data)
{
char *c_weelist, *c_data, *result;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "list_search");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "list_search", API_RETURN_EMPTY);
if (NIL_P (weelist) || NIL_P (data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "list_search");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (weelist, T_STRING);
Check_Type (data, T_STRING);
@@ -826,10 +632,10 @@ weechat_ruby_api_list_search (VALUE class, VALUE weelist, VALUE data)
c_weelist = StringValuePtr (weelist);
c_data = StringValuePtr (data);
- result = script_ptr2str (weechat_list_search (script_str2ptr(c_weelist),
+ result = script_ptr2str (weechat_list_search (script_str2ptr (c_weelist),
c_data));
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -842,20 +648,9 @@ weechat_ruby_api_list_search_pos (VALUE class, VALUE weelist, VALUE data)
char *c_weelist, *c_data;
int pos;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "list_search_pos");
- RUBY_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "list_search_pos", API_RETURN_INT(-1));
if (NIL_P (weelist) || NIL_P (data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "list_search_pos");
- RUBY_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
Check_Type (weelist, T_STRING);
Check_Type (data, T_STRING);
@@ -863,9 +658,9 @@ weechat_ruby_api_list_search_pos (VALUE class, VALUE weelist, VALUE data)
c_weelist = StringValuePtr (weelist);
c_data = StringValuePtr (data);
- pos = weechat_list_search_pos (script_str2ptr(c_weelist), c_data);
+ pos = weechat_list_search_pos (script_str2ptr (c_weelist), c_data);
- RUBY_RETURN_INT(pos);
+ API_RETURN_INT(pos);
}
/*
@@ -877,20 +672,9 @@ weechat_ruby_api_list_casesearch (VALUE class, VALUE weelist, VALUE data)
{
char *c_weelist, *c_data, *result;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "list_casesearch");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "list_casesearch", API_RETURN_EMPTY);
if (NIL_P (weelist) || NIL_P (data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "list_casesearch");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (weelist, T_STRING);
Check_Type (data, T_STRING);
@@ -898,10 +682,10 @@ weechat_ruby_api_list_casesearch (VALUE class, VALUE weelist, VALUE data)
c_weelist = StringValuePtr (weelist);
c_data = StringValuePtr (data);
- result = script_ptr2str (weechat_list_casesearch (script_str2ptr(c_weelist),
+ result = script_ptr2str (weechat_list_casesearch (script_str2ptr (c_weelist),
c_data));
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -915,20 +699,9 @@ weechat_ruby_api_list_casesearch_pos (VALUE class, VALUE weelist, VALUE data)
char *c_weelist, *c_data;
int pos;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "list_casesearch_pos");
- RUBY_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "list_casesearch_pos", API_RETURN_INT(-1));
if (NIL_P (weelist) || NIL_P (data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "list_casesearch_pos");
- RUBY_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
Check_Type (weelist, T_STRING);
Check_Type (data, T_STRING);
@@ -936,9 +709,9 @@ weechat_ruby_api_list_casesearch_pos (VALUE class, VALUE weelist, VALUE data)
c_weelist = StringValuePtr (weelist);
c_data = StringValuePtr (data);
- pos = weechat_list_casesearch_pos (script_str2ptr(c_weelist), c_data);
+ pos = weechat_list_casesearch_pos (script_str2ptr (c_weelist), c_data);
- RUBY_RETURN_INT(pos);
+ API_RETURN_INT(pos);
}
/*
@@ -951,20 +724,9 @@ weechat_ruby_api_list_get (VALUE class, VALUE weelist, VALUE position)
char *c_weelist, *result;
int c_position;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "list_get");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "list_get", API_RETURN_EMPTY);
if (NIL_P (weelist) || NIL_P (position))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "list_get");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (weelist, T_STRING);
Check_Type (position, T_FIXNUM);
@@ -972,10 +734,10 @@ weechat_ruby_api_list_get (VALUE class, VALUE weelist, VALUE position)
c_weelist = StringValuePtr (weelist);
c_position = FIX2INT (position);
- result = script_ptr2str (weechat_list_get (script_str2ptr(c_weelist),
+ result = script_ptr2str (weechat_list_get (script_str2ptr (c_weelist),
c_position));
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -987,20 +749,9 @@ weechat_ruby_api_list_set (VALUE class, VALUE item, VALUE new_value)
{
char *c_item, *c_new_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "list_set");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "list_set", API_RETURN_ERROR);
if (NIL_P (item) || NIL_P (new_value))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "list_set");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (item, T_STRING);
Check_Type (new_value, T_STRING);
@@ -1008,10 +759,10 @@ weechat_ruby_api_list_set (VALUE class, VALUE item, VALUE new_value)
c_item = StringValuePtr (item);
c_new_value = StringValuePtr (new_value);
- weechat_list_set (script_str2ptr(c_item),
+ weechat_list_set (script_str2ptr (c_item),
c_new_value);
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -1023,28 +774,17 @@ weechat_ruby_api_list_next (VALUE class, VALUE item)
{
char *c_item, *result;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "list_next");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "list_next", API_RETURN_EMPTY);
if (NIL_P (item))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "list_next");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (item, T_STRING);
c_item = StringValuePtr (item);
- result = script_ptr2str (weechat_list_next (script_str2ptr(c_item)));
+ result = script_ptr2str (weechat_list_next (script_str2ptr (c_item)));
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -1056,28 +796,17 @@ weechat_ruby_api_list_prev (VALUE class, VALUE item)
{
char *c_item, *result;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "list_prev");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "list_prev", API_RETURN_EMPTY);
if (NIL_P (item))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "list_prev");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (item, T_STRING);
c_item = StringValuePtr (item);
- result = script_ptr2str (weechat_list_prev (script_str2ptr(c_item)));
+ result = script_ptr2str (weechat_list_prev (script_str2ptr (c_item)));
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -1090,28 +819,17 @@ weechat_ruby_api_list_string (VALUE class, VALUE item)
char *c_item;
const char *result;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "list_string");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "list_string", API_RETURN_EMPTY);
if (NIL_P (item))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "list_string");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (item, T_STRING);
c_item = StringValuePtr (item);
- result = weechat_list_string (script_str2ptr(c_item));
+ result = weechat_list_string (script_str2ptr (c_item));
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -1124,28 +842,17 @@ weechat_ruby_api_list_size (VALUE class, VALUE weelist)
char *c_weelist;
int size;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "list_size");
- RUBY_RETURN_INT(0);
- }
-
+ API_FUNC(1, "list_size", API_RETURN_INT(0));
if (NIL_P (weelist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "list_size");
- RUBY_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (weelist, T_STRING);
c_weelist = StringValuePtr (weelist);
- size = weechat_list_size (script_str2ptr(c_weelist));
+ size = weechat_list_size (script_str2ptr (c_weelist));
- RUBY_RETURN_INT(size);
+ API_RETURN_INT(size);
}
/*
@@ -1157,20 +864,9 @@ weechat_ruby_api_list_remove (VALUE class, VALUE weelist, VALUE item)
{
char *c_weelist, *c_item;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "list_remove");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "list_remove", API_RETURN_ERROR);
if (NIL_P (weelist) || NIL_P (item))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "list_remove");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (weelist, T_STRING);
Check_Type (item, T_STRING);
@@ -1181,7 +877,7 @@ weechat_ruby_api_list_remove (VALUE class, VALUE weelist, VALUE item)
weechat_list_remove (script_str2ptr (c_weelist),
script_str2ptr (c_item));
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -1193,20 +889,9 @@ weechat_ruby_api_list_remove_all (VALUE class, VALUE weelist)
{
char *c_weelist;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "list_remove_all");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "list_remove_all", API_RETURN_ERROR);
if (NIL_P (weelist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "list_remove_all");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (weelist, T_STRING);
@@ -1214,7 +899,7 @@ weechat_ruby_api_list_remove_all (VALUE class, VALUE weelist)
weechat_list_remove_all (script_str2ptr (c_weelist));
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -1226,20 +911,9 @@ weechat_ruby_api_list_free (VALUE class, VALUE weelist)
{
char *c_weelist;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "list_free");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "list_free", API_RETURN_ERROR);
if (NIL_P (weelist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "list_free");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (weelist, T_STRING);
@@ -1247,7 +921,7 @@ weechat_ruby_api_list_free (VALUE class, VALUE weelist)
weechat_list_free (script_str2ptr (c_weelist));
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -1259,7 +933,7 @@ weechat_ruby_api_config_reload_cb (void *data,
struct t_config_file *config_file)
{
struct t_script_callback *script_callback;
- void *ruby_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1267,13 +941,13 @@ weechat_ruby_api_config_reload_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = script_ptr2str (config_file);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", ruby_argv);
+ "ss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
@@ -1282,8 +956,8 @@ weechat_ruby_api_config_reload_cb (void *data,
ret = *rc;
free (rc);
}
- if (ruby_argv[1])
- free (ruby_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -1302,20 +976,9 @@ weechat_ruby_api_config_new (VALUE class, VALUE name, VALUE function,
char *c_name, *c_function, *c_data, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_new");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_new", API_RETURN_EMPTY);
if (NIL_P (name) || NIL_P (function) || NIL_P (data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_new");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (name, T_STRING);
Check_Type (function, T_STRING);
@@ -1332,7 +995,7 @@ weechat_ruby_api_config_new (VALUE class, VALUE name, VALUE function,
c_function,
c_data));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1346,7 +1009,7 @@ weechat_ruby_api_config_read_cb (void *data,
const char *option_name, const char *value)
{
struct t_script_callback *script_callback;
- void *ruby_argv[5];
+ void *func_argv[5];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1354,16 +1017,16 @@ weechat_ruby_api_config_read_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = script_ptr2str (config_file);
- ruby_argv[2] = script_ptr2str (section);
- ruby_argv[3] = (option_name) ? (char *)option_name : empty_arg;
- ruby_argv[4] = (value) ? (char *)value : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
+ func_argv[2] = script_ptr2str (section);
+ func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
+ func_argv[4] = (value) ? (char *)value : empty_arg;
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sssss", ruby_argv);
+ "sssss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
@@ -1372,10 +1035,10 @@ weechat_ruby_api_config_read_cb (void *data,
ret = *rc;
free (rc);
}
- if (ruby_argv[1])
- free (ruby_argv[1]);
- if (ruby_argv[2])
- free (ruby_argv[2]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[2])
+ free (func_argv[2]);
return ret;
}
@@ -1393,7 +1056,7 @@ weechat_ruby_api_config_section_write_cb (void *data,
const char *section_name)
{
struct t_script_callback *script_callback;
- void *ruby_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1401,14 +1064,14 @@ weechat_ruby_api_config_section_write_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = script_ptr2str (config_file);
- ruby_argv[2] = (section_name) ? (char *)section_name : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
+ func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", ruby_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_WRITE_ERROR;
@@ -1417,8 +1080,8 @@ weechat_ruby_api_config_section_write_cb (void *data,
ret = *rc;
free (rc);
}
- if (ruby_argv[1])
- free (ruby_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -1437,7 +1100,7 @@ weechat_ruby_api_config_section_write_default_cb (void *data,
const char *section_name)
{
struct t_script_callback *script_callback;
- void *ruby_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1445,14 +1108,14 @@ weechat_ruby_api_config_section_write_default_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = script_ptr2str (config_file);
- ruby_argv[2] = (section_name) ? (char *)section_name : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
+ func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", ruby_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_WRITE_ERROR;
@@ -1461,8 +1124,8 @@ weechat_ruby_api_config_section_write_default_cb (void *data,
ret = *rc;
free (rc);
}
- if (ruby_argv[1])
- free (ruby_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -1482,7 +1145,7 @@ weechat_ruby_api_config_section_create_option_cb (void *data,
const char *value)
{
struct t_script_callback *script_callback;
- void *ruby_argv[5];
+ void *func_argv[5];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1490,16 +1153,16 @@ weechat_ruby_api_config_section_create_option_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = script_ptr2str (config_file);
- ruby_argv[2] = script_ptr2str (section);
- ruby_argv[3] = (option_name) ? (char *)option_name : empty_arg;
- ruby_argv[4] = (value) ? (char *)value : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
+ func_argv[2] = script_ptr2str (section);
+ func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
+ func_argv[4] = (value) ? (char *)value : empty_arg;
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sssss", ruby_argv);
+ "sssss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
@@ -1508,10 +1171,10 @@ weechat_ruby_api_config_section_create_option_cb (void *data,
ret = *rc;
free (rc);
}
- if (ruby_argv[1])
- free (ruby_argv[1]);
- if (ruby_argv[2])
- free (ruby_argv[2]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[2])
+ free (func_argv[2]);
return ret;
}
@@ -1530,7 +1193,7 @@ weechat_ruby_api_config_section_delete_option_cb (void *data,
struct t_config_option *option)
{
struct t_script_callback *script_callback;
- void *ruby_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1538,15 +1201,15 @@ weechat_ruby_api_config_section_delete_option_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = script_ptr2str (config_file);
- ruby_argv[2] = script_ptr2str (section);
- ruby_argv[3] = script_ptr2str (option);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
+ func_argv[2] = script_ptr2str (section);
+ func_argv[3] = script_ptr2str (option);
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ssss", ruby_argv);
+ "ssss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_OPTION_UNSET_ERROR;
@@ -1555,12 +1218,12 @@ weechat_ruby_api_config_section_delete_option_cb (void *data,
ret = *rc;
free (rc);
}
- if (ruby_argv[1])
- free (ruby_argv[1]);
- if (ruby_argv[2])
- free (ruby_argv[2]);
- if (ruby_argv[3])
- free (ruby_argv[3]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[2])
+ free (func_argv[2]);
+ if (func_argv[3])
+ free (func_argv[3]);
return ret;
}
@@ -1595,25 +1258,14 @@ weechat_ruby_api_config_new_section (VALUE class, VALUE config_file,
int c_user_can_add_options, c_user_can_delete_options;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_new_section");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_new_section", API_RETURN_EMPTY);
if (NIL_P (config_file) || NIL_P (name) || NIL_P (user_can_add_options)
|| NIL_P (user_can_delete_options) || NIL_P (function_read)
|| NIL_P (data_read) || NIL_P (function_write) || NIL_P (data_write)
|| NIL_P (function_write_default) || NIL_P (data_write_default)
|| NIL_P (function_create_option) || NIL_P (data_create_option)
|| NIL_P (function_delete_option) || NIL_P (data_delete_option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_new_section");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (config_file, T_STRING);
Check_Type (name, T_STRING);
@@ -1667,7 +1319,7 @@ weechat_ruby_api_config_new_section (VALUE class, VALUE config_file,
c_function_delete_option,
c_data_delete_option));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1681,20 +1333,9 @@ weechat_ruby_api_config_search_section (VALUE class, VALUE config_file,
char *c_config_file, *c_section_name, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_search_section");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_search_section", API_RETURN_EMPTY);
if (NIL_P (config_file) || NIL_P (section_name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_search_section");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (config_file, T_STRING);
Check_Type (section_name, T_STRING);
@@ -1705,7 +1346,7 @@ weechat_ruby_api_config_search_section (VALUE class, VALUE config_file,
result = script_ptr2str (weechat_config_search_section (script_str2ptr (c_config_file),
c_section_name));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1719,7 +1360,7 @@ weechat_ruby_api_config_option_check_value_cb (void *data,
const char *value)
{
struct t_script_callback *script_callback;
- void *ruby_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1727,14 +1368,14 @@ weechat_ruby_api_config_option_check_value_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = script_ptr2str (option);
- ruby_argv[2] = (value) ? (char *)value : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (option);
+ func_argv[2] = (value) ? (char *)value : empty_arg;
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", ruby_argv);
+ "sss", func_argv);
if (!rc)
ret = 0;
@@ -1743,8 +1384,8 @@ weechat_ruby_api_config_option_check_value_cb (void *data,
ret = *rc;
free (rc);
}
- if (ruby_argv[1])
- free (ruby_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -1761,7 +1402,7 @@ weechat_ruby_api_config_option_change_cb (void *data,
struct t_config_option *option)
{
struct t_script_callback *script_callback;
- void *ruby_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc;
@@ -1769,16 +1410,16 @@ weechat_ruby_api_config_option_change_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = script_ptr2str (option);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (option);
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", ruby_argv);
+ "ss", func_argv);
- if (ruby_argv[1])
- free (ruby_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
if (rc)
free (rc);
@@ -1794,7 +1435,7 @@ weechat_ruby_api_config_option_delete_cb (void *data,
struct t_config_option *option)
{
struct t_script_callback *script_callback;
- void *ruby_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc;
@@ -1802,16 +1443,16 @@ weechat_ruby_api_config_option_delete_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = script_ptr2str (option);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (option);
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", ruby_argv);
+ "ss", func_argv);
- if (ruby_argv[1])
- free (ruby_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
if (rc)
free (rc);
@@ -1836,31 +1477,21 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file,
VALUE data_delete)
{
char *c_config_file, *c_section, *c_name, *c_type, *c_description;
- char *c_string_values, *c_default_value, *c_value, *result;
+ char *c_string_values, *c_default_value, *c_value;
char *c_function_check_value, *c_data_check_value, *c_function_change;
- char *c_data_change, *c_function_delete, *c_data_delete;
+ char *c_data_change, *c_function_delete, *c_data_delete, *result;
int c_min, c_max, c_null_value_allowed;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_new_option");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_new_option", API_RETURN_EMPTY);
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 (value) || NIL_P (null_value_allowed)
- || NIL_P (function_check_value) || NIL_P (data_check_value)
- || NIL_P (function_change) || NIL_P (data_change)
- || NIL_P (function_delete) || NIL_P (data_delete))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_new_option");
- RUBY_RETURN_EMPTY;
- }
+ || NIL_P (description) || NIL_P (string_values) || NIL_P (min)
+ || NIL_P (max) || NIL_P (default_value) || NIL_P (value)
+ || NIL_P (null_value_allowed) || NIL_P (function_check_value)
+ || NIL_P (data_check_value) || NIL_P (function_change)
+ || NIL_P (data_change) || NIL_P (function_delete)
+ || NIL_P (data_delete))
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (config_file, T_STRING);
Check_Type (section, T_STRING);
@@ -1921,7 +1552,7 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file,
c_function_delete,
c_data_delete));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1935,20 +1566,9 @@ weechat_ruby_api_config_search_option (VALUE class, VALUE config_file,
char *c_config_file, *c_section, *c_option_name, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_search_option");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_search_option", API_RETURN_EMPTY);
if (NIL_P (config_file) || NIL_P (section) || NIL_P (option_name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_search_option");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (config_file, T_STRING);
Check_Type (section, T_STRING);
@@ -1962,7 +1582,7 @@ weechat_ruby_api_config_search_option (VALUE class, VALUE config_file,
script_str2ptr (c_section),
c_option_name));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1975,20 +1595,9 @@ weechat_ruby_api_config_string_to_boolean (VALUE class, VALUE text)
char *c_text;
int value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_string_to_boolean");
- RUBY_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_string_to_boolean", API_RETURN_INT(0));
if (NIL_P (text))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_string_to_boolean");
- RUBY_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (text, T_STRING);
@@ -1996,7 +1605,7 @@ weechat_ruby_api_config_string_to_boolean (VALUE class, VALUE text)
value = weechat_config_string_to_boolean (c_text);
- RUBY_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2010,20 +1619,9 @@ weechat_ruby_api_config_option_reset (VALUE class, VALUE option,
char *c_option;
int c_run_callback, rc;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_option_reset");
- RUBY_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_option_reset", API_RETURN_INT(0));
if (NIL_P (option) || NIL_P (run_callback))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_option_reset");
- RUBY_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (option, T_STRING);
Check_Type (run_callback, T_FIXNUM);
@@ -2034,7 +1632,7 @@ weechat_ruby_api_config_option_reset (VALUE class, VALUE option,
rc = weechat_config_option_reset (script_str2ptr (c_option),
c_run_callback);
- RUBY_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2048,20 +1646,9 @@ weechat_ruby_api_config_option_set (VALUE class, VALUE option, VALUE new_value,
char *c_option, *c_new_value;
int c_run_callback, rc;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_option_set");
- RUBY_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
-
+ API_FUNC(1, "config_option_set", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
if (NIL_P (option) || NIL_P (new_value) || NIL_P (run_callback))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_option_set");
- RUBY_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
Check_Type (option, T_STRING);
Check_Type (new_value, T_STRING);
@@ -2075,7 +1662,7 @@ weechat_ruby_api_config_option_set (VALUE class, VALUE option, VALUE new_value,
c_new_value,
c_run_callback);
- RUBY_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2090,20 +1677,9 @@ weechat_ruby_api_config_option_set_null (VALUE class, VALUE option,
char *c_option;
int c_run_callback, rc;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_option_set_null");
- RUBY_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
-
+ API_FUNC(1, "config_option_set_null", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
if (NIL_P (option) || NIL_P (run_callback))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_option_set_null");
- RUBY_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
Check_Type (option, T_STRING);
Check_Type (run_callback, T_FIXNUM);
@@ -2114,7 +1690,7 @@ weechat_ruby_api_config_option_set_null (VALUE class, VALUE option,
rc = weechat_config_option_set_null (script_str2ptr (c_option),
c_run_callback);
- RUBY_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2127,20 +1703,9 @@ weechat_ruby_api_config_option_unset (VALUE class, VALUE option)
char *c_option;
int rc;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_option_unset");
- RUBY_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
- }
-
+ API_FUNC(1, "config_option_unset", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
if (NIL_P (option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_option_unset");
- RUBY_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
- }
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
Check_Type (option, T_STRING);
@@ -2148,7 +1713,7 @@ weechat_ruby_api_config_option_unset (VALUE class, VALUE option)
rc = weechat_config_option_unset (script_str2ptr (c_option));
- RUBY_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2161,20 +1726,9 @@ weechat_ruby_api_config_option_rename (VALUE class, VALUE option,
{
char *c_option, *c_new_name;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_option_rename");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_option_rename", API_RETURN_ERROR);
if (NIL_P (option) || NIL_P (new_name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_option_rename");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (option, T_STRING);
Check_Type (new_name, T_STRING);
@@ -2185,7 +1739,7 @@ weechat_ruby_api_config_option_rename (VALUE class, VALUE option,
weechat_config_option_rename (script_str2ptr (c_option),
c_new_name);
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2198,20 +1752,9 @@ weechat_ruby_api_config_option_is_null (VALUE class, VALUE option)
char *c_option;
int value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_option_is_null");
- RUBY_RETURN_INT(1);
- }
-
+ API_FUNC(1, "config_option_is_null", API_RETURN_INT(1));
if (NIL_P (option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_option_is_null");
- RUBY_RETURN_INT(1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(1));
Check_Type (option, T_STRING);
@@ -2219,7 +1762,7 @@ weechat_ruby_api_config_option_is_null (VALUE class, VALUE option)
value = weechat_config_option_is_null (script_str2ptr (c_option));
- RUBY_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2232,20 +1775,9 @@ weechat_ruby_api_config_option_default_is_null (VALUE class, VALUE option)
char *c_option;
int value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_option_default_is_null");
- RUBY_RETURN_INT(1);
- }
-
+ API_FUNC(1, "config_option_default_is_null", API_RETURN_INT(1));
if (NIL_P (option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_option_default_is_null");
- RUBY_RETURN_INT(1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(1));
Check_Type (option, T_STRING);
@@ -2253,7 +1785,7 @@ weechat_ruby_api_config_option_default_is_null (VALUE class, VALUE option)
value = weechat_config_option_default_is_null (script_str2ptr (c_option));
- RUBY_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2266,20 +1798,9 @@ weechat_ruby_api_config_boolean (VALUE class, VALUE option)
char *c_option;
int value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_boolean");
- RUBY_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_boolean", API_RETURN_INT(0));
if (NIL_P (option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_boolean");
- RUBY_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (option, T_STRING);
@@ -2287,7 +1808,7 @@ weechat_ruby_api_config_boolean (VALUE class, VALUE option)
value = weechat_config_boolean (script_str2ptr (c_option));
- RUBY_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2300,20 +1821,9 @@ weechat_ruby_api_config_boolean_default (VALUE class, VALUE option)
char *c_option;
int value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_boolean_default");
- RUBY_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_boolean_default", API_RETURN_INT(0));
if (NIL_P (option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_boolean_default");
- RUBY_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (option, T_STRING);
@@ -2321,7 +1831,7 @@ weechat_ruby_api_config_boolean_default (VALUE class, VALUE option)
value = weechat_config_boolean_default (script_str2ptr (c_option));
- RUBY_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2334,20 +1844,9 @@ weechat_ruby_api_config_integer (VALUE class, VALUE option)
char *c_option;
int value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_integer");
- RUBY_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_integer", API_RETURN_INT(0));
if (NIL_P (option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_integer");
- RUBY_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (option, T_STRING);
@@ -2355,7 +1854,7 @@ weechat_ruby_api_config_integer (VALUE class, VALUE option)
value = weechat_config_integer (script_str2ptr (c_option));
- RUBY_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2368,20 +1867,9 @@ weechat_ruby_api_config_integer_default (VALUE class, VALUE option)
char *c_option;
int value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_integer_default");
- RUBY_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_integer_default", API_RETURN_INT(0));
if (NIL_P (option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_integer_default");
- RUBY_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (option, T_STRING);
@@ -2389,7 +1877,7 @@ weechat_ruby_api_config_integer_default (VALUE class, VALUE option)
value = weechat_config_integer_default (script_str2ptr (c_option));
- RUBY_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -2402,20 +1890,9 @@ weechat_ruby_api_config_string (VALUE class, VALUE option)
char *c_option;
const char *result;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_string");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_string", API_RETURN_EMPTY);
if (NIL_P (option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_string");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (option, T_STRING);
@@ -2423,7 +1900,7 @@ weechat_ruby_api_config_string (VALUE class, VALUE option)
result = weechat_config_string (script_str2ptr (c_option));
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2436,20 +1913,9 @@ weechat_ruby_api_config_string_default (VALUE class, VALUE option)
char *c_option;
const char *result;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_string_default");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_string_default", API_RETURN_EMPTY);
if (NIL_P (option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_string_default");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (option, T_STRING);
@@ -2457,7 +1923,7 @@ weechat_ruby_api_config_string_default (VALUE class, VALUE option)
result = weechat_config_string_default (script_str2ptr (c_option));
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2470,20 +1936,9 @@ weechat_ruby_api_config_color (VALUE class, VALUE option)
char *c_option;
const char *result;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_color");
- RUBY_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_color", API_RETURN_INT(0));
if (NIL_P (option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_color");
- RUBY_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (option, T_STRING);
@@ -2491,7 +1946,7 @@ weechat_ruby_api_config_color (VALUE class, VALUE option)
result = weechat_config_color (script_str2ptr (c_option));
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2504,20 +1959,9 @@ weechat_ruby_api_config_color_default (VALUE class, VALUE option)
char *c_option;
const char *result;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_color_default");
- RUBY_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_color_default", API_RETURN_INT(0));
if (NIL_P (option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_color_default");
- RUBY_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (option, T_STRING);
@@ -2525,7 +1969,7 @@ weechat_ruby_api_config_color_default (VALUE class, VALUE option)
result = weechat_config_color_default (script_str2ptr (c_option));
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2538,20 +1982,9 @@ weechat_ruby_api_config_write_option (VALUE class, VALUE config_file,
{
char *c_config_file, *c_option;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_write_option");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_write_option", API_RETURN_ERROR);
if (NIL_P (config_file) || NIL_P (option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_write_option");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (config_file, T_STRING);
Check_Type (option, T_STRING);
@@ -2562,7 +1995,7 @@ weechat_ruby_api_config_write_option (VALUE class, VALUE config_file,
weechat_config_write_option (script_str2ptr (c_config_file),
script_str2ptr (c_option));
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2575,20 +2008,9 @@ weechat_ruby_api_config_write_line (VALUE class, VALUE config_file,
{
char *c_config_file, *c_option_name, *c_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_write_line");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_write_line", API_RETURN_ERROR);
if (NIL_P (config_file) || NIL_P (option_name) || NIL_P (value))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_write_line");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (config_file, T_STRING);
Check_Type (option_name, T_STRING);
@@ -2603,7 +2025,7 @@ weechat_ruby_api_config_write_line (VALUE class, VALUE config_file,
"%s",
c_value);
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2616,20 +2038,9 @@ weechat_ruby_api_config_write (VALUE class, VALUE config_file)
char *c_config_file;
int rc;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_write");
- RUBY_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "config_write", API_RETURN_INT(-1));
if (NIL_P (config_file))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_write");
- RUBY_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
Check_Type (config_file, T_STRING);
@@ -2637,7 +2048,7 @@ weechat_ruby_api_config_write (VALUE class, VALUE config_file)
rc = weechat_config_write (script_str2ptr (c_config_file));
- RUBY_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2650,20 +2061,9 @@ weechat_ruby_api_config_read (VALUE class, VALUE config_file)
char *c_config_file;
int rc;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_read");
- RUBY_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "config_read", API_RETURN_INT(-1));
if (NIL_P (config_file))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_read");
- RUBY_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
Check_Type (config_file, T_STRING);
@@ -2671,7 +2071,7 @@ weechat_ruby_api_config_read (VALUE class, VALUE config_file)
rc = weechat_config_read (script_str2ptr (c_config_file));
- RUBY_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2684,20 +2084,9 @@ weechat_ruby_api_config_reload (VALUE class, VALUE config_file)
char *c_config_file;
int rc;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_reload");
- RUBY_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "config_reload", API_RETURN_INT(-1));
if (NIL_P (config_file))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_reload");
- RUBY_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
Check_Type (config_file, T_STRING);
@@ -2705,7 +2094,7 @@ weechat_ruby_api_config_reload (VALUE class, VALUE config_file)
rc = weechat_config_reload (script_str2ptr (c_config_file));
- RUBY_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2717,20 +2106,9 @@ weechat_ruby_api_config_option_free (VALUE class, VALUE option)
{
char *c_option;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_option_free");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_option_free", API_RETURN_ERROR);
if (NIL_P (option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_option_free");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (option, T_STRING);
@@ -2740,7 +2118,7 @@ weechat_ruby_api_config_option_free (VALUE class, VALUE option)
ruby_current_script,
script_str2ptr (c_option));
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2753,20 +2131,9 @@ weechat_ruby_api_config_section_free_options (VALUE class, VALUE section)
{
char *c_section;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_section_free_options");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_section_free_options", API_RETURN_ERROR);
if (NIL_P (section))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_section_free_options");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (section, T_STRING);
@@ -2776,7 +2143,7 @@ weechat_ruby_api_config_section_free_options (VALUE class, VALUE section)
ruby_current_script,
script_str2ptr (c_section));
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2788,20 +2155,9 @@ weechat_ruby_api_config_section_free (VALUE class, VALUE section)
{
char *c_section;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_section_free");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_section_free", API_RETURN_ERROR);
if (NIL_P (section))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_section_free");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (section, T_STRING);
@@ -2811,7 +2167,7 @@ weechat_ruby_api_config_section_free (VALUE class, VALUE section)
ruby_current_script,
script_str2ptr (c_section));
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2823,20 +2179,9 @@ weechat_ruby_api_config_free (VALUE class, VALUE config_file)
{
char *c_config_file;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_free");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_free", API_RETURN_ERROR);
if (NIL_P (config_file))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_free");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (config_file, T_STRING);
@@ -2846,7 +2191,7 @@ weechat_ruby_api_config_free (VALUE class, VALUE config_file)
ruby_current_script,
script_str2ptr (c_config_file));
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2859,20 +2204,9 @@ weechat_ruby_api_config_get (VALUE class, VALUE option)
char *c_option, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_get");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_get", API_RETURN_EMPTY);
if (NIL_P (option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_get");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (option, T_STRING);
@@ -2880,7 +2214,7 @@ weechat_ruby_api_config_get (VALUE class, VALUE option)
result = script_ptr2str (weechat_config_get (c_option));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -2893,20 +2227,9 @@ weechat_ruby_api_config_get_plugin (VALUE class, VALUE option)
char *c_option;
const char *result;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_get_plugin");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_get_plugin", API_RETURN_EMPTY);
if (NIL_P (option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_get_plugin");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (option, T_STRING);
@@ -2916,7 +2239,7 @@ weechat_ruby_api_config_get_plugin (VALUE class, VALUE option)
ruby_current_script,
c_option);
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2929,20 +2252,9 @@ weechat_ruby_api_config_is_set_plugin (VALUE class, VALUE option)
char *c_option;
int rc;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_is_set_plugin");
- RUBY_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_is_set_plugin", API_RETURN_INT(0));
if (NIL_P (option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_is_set_plugin");
- RUBY_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (option, T_STRING);
@@ -2952,7 +2264,7 @@ weechat_ruby_api_config_is_set_plugin (VALUE class, VALUE option)
ruby_current_script,
c_option);
- RUBY_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2965,20 +2277,9 @@ weechat_ruby_api_config_set_plugin (VALUE class, VALUE option, VALUE value)
char *c_option, *c_value;
int rc;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_set_plugin");
- RUBY_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
-
+ API_FUNC(1, "config_set_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
if (NIL_P (option) || NIL_P (value))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_set_plugin");
- RUBY_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
Check_Type (option, T_STRING);
Check_Type (value, T_STRING);
@@ -2991,7 +2292,7 @@ weechat_ruby_api_config_set_plugin (VALUE class, VALUE option, VALUE value)
c_option,
c_value);
- RUBY_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -3004,20 +2305,9 @@ weechat_ruby_api_config_set_desc_plugin (VALUE class, VALUE option,
{
char *c_option, *c_description;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_set_desc_plugin");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_set_desc_plugin", API_RETURN_ERROR);
if (NIL_P (option) || NIL_P (description))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_set_desc_plugin");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (option, T_STRING);
Check_Type (description, T_STRING);
@@ -3030,7 +2320,7 @@ weechat_ruby_api_config_set_desc_plugin (VALUE class, VALUE option,
c_option,
c_description);
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -3043,20 +2333,9 @@ weechat_ruby_api_config_unset_plugin (VALUE class, VALUE option)
char *c_option;
int rc;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_unset_plugin");
- RUBY_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
- }
-
+ API_FUNC(1, "config_unset_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
if (NIL_P (option))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_unset_plugin");
- RUBY_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
- }
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
Check_Type (option, T_STRING);
@@ -3066,7 +2345,7 @@ weechat_ruby_api_config_unset_plugin (VALUE class, VALUE option)
ruby_current_script,
c_option);
- RUBY_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -3080,20 +2359,9 @@ weechat_ruby_api_key_bind (VALUE class, VALUE context, VALUE keys)
struct t_hashtable *c_keys;
int num_keys;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "key_bind");
- RUBY_RETURN_INT(0);
- }
-
+ API_FUNC(1, "key_bind", API_RETURN_INT(0));
if (NIL_P (context) || NIL_P (keys))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "key_bind");
- RUBY_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (context, T_STRING);
Check_Type (keys, T_HASH);
@@ -3107,7 +2375,7 @@ weechat_ruby_api_key_bind (VALUE class, VALUE context, VALUE keys)
if (c_keys)
weechat_hashtable_free (c_keys);
- RUBY_RETURN_INT(num_keys);
+ API_RETURN_INT(num_keys);
}
/*
@@ -3120,20 +2388,9 @@ weechat_ruby_api_key_unbind (VALUE class, VALUE context, VALUE key)
char *c_context, *c_key;
int num_keys;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "key_unbind");
- RUBY_RETURN_INT(0);
- }
-
+ API_FUNC(1, "key_unbind", API_RETURN_INT(0));
if (NIL_P (context) || NIL_P (key))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "key_unbind");
- RUBY_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (context, T_STRING);
Check_Type (key, T_STRING);
@@ -3143,7 +2400,7 @@ weechat_ruby_api_key_unbind (VALUE class, VALUE context, VALUE key)
num_keys = weechat_key_unbind (c_context, c_key);
- RUBY_RETURN_INT(num_keys);
+ API_RETURN_INT(num_keys);
}
/*
@@ -3156,14 +2413,9 @@ weechat_ruby_api_prefix (VALUE class, VALUE prefix)
char *c_prefix;
const char *result;
- /* make C compiler happy */
- (void) class;
-
+ API_FUNC(0, "prefix", API_RETURN_EMPTY);
if (NIL_P (prefix))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "prefix");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (prefix, T_STRING);
@@ -3171,7 +2423,7 @@ weechat_ruby_api_prefix (VALUE class, VALUE prefix)
result = weechat_prefix (c_prefix);
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -3184,14 +2436,9 @@ weechat_ruby_api_color (VALUE class, VALUE color)
char *c_color;
const char *result;
- /* make C compiler happy */
- (void) class;
-
+ API_FUNC(0, "color", API_RETURN_EMPTY);
if (NIL_P (color))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "color");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (color, T_STRING);
@@ -3199,7 +2446,7 @@ weechat_ruby_api_color (VALUE class, VALUE color)
result = weechat_color (c_color);
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -3211,14 +2458,9 @@ weechat_ruby_api_print (VALUE class, VALUE buffer, VALUE message)
{
char *c_buffer, *c_message;
- /* make C compiler happy */
- (void) class;
-
+ API_FUNC(0, "print", API_RETURN_ERROR);
if (NIL_P (buffer) || NIL_P (message))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "print");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (buffer, T_STRING);
Check_Type (message, T_STRING);
@@ -3231,7 +2473,7 @@ weechat_ruby_api_print (VALUE class, VALUE buffer, VALUE message)
script_str2ptr (c_buffer),
"%s", c_message);
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -3246,20 +2488,9 @@ weechat_ruby_api_print_date_tags (VALUE class, VALUE buffer, VALUE date,
char *c_buffer, *c_tags, *c_message;
int c_date;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "print_date_tags");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "print_date_tags", API_RETURN_ERROR);
if (NIL_P (buffer) || NIL_P (date) || NIL_P (tags) || NIL_P (message))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "print_date_tags");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (buffer, T_STRING);
Check_Type (date, T_FIXNUM);
@@ -3278,7 +2509,7 @@ weechat_ruby_api_print_date_tags (VALUE class, VALUE buffer, VALUE date,
c_tags,
"%s", c_message);
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -3291,20 +2522,9 @@ weechat_ruby_api_print_y (VALUE class, VALUE buffer, VALUE y, VALUE message)
char *c_buffer, *c_message;
int c_y;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "print_y");
- RUBY_RETURN_ERROR;
- }
-
- if (NIL_P (buffer) || NIL_P (message))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "print_y");
- RUBY_RETURN_ERROR;
- }
+ API_FUNC(1, "print_y", API_RETURN_ERROR);
+ if (NIL_P (buffer) || NIL_P (y) || NIL_P (message))
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (buffer, T_STRING);
Check_Type (y, T_FIXNUM);
@@ -3320,7 +2540,7 @@ weechat_ruby_api_print_y (VALUE class, VALUE buffer, VALUE y, VALUE message)
c_y,
"%s", c_message);
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -3332,20 +2552,9 @@ weechat_ruby_api_log_print (VALUE class, VALUE message)
{
char *c_message;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "log_print");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "log_print", API_RETURN_ERROR);
if (NIL_P (message))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "log_print");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (message, T_STRING);
@@ -3355,7 +2564,7 @@ weechat_ruby_api_log_print (VALUE class, VALUE message)
ruby_current_script,
"%s", c_message);
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -3367,7 +2576,7 @@ weechat_ruby_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
struct t_script_callback *script_callback;
- void *ruby_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3378,14 +2587,14 @@ weechat_ruby_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
if (script_callback && script_callback->function && script_callback->function[0])
{
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = script_ptr2str (buffer);
- ruby_argv[2] = (argc > 1) ? argv_eol[1] : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (buffer);
+ func_argv[2] = (argc > 1) ? argv_eol[1] : empty_arg;
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", ruby_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3394,8 +2603,8 @@ weechat_ruby_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
ret = *rc;
free (rc);
}
- if (ruby_argv[1])
- free (ruby_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -3416,22 +2625,11 @@ weechat_ruby_api_hook_command (VALUE class, VALUE command, VALUE description,
char *c_completion, *c_function, *c_data, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hook_command");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_command", API_RETURN_EMPTY);
if (NIL_P (command) || NIL_P (description) || NIL_P (args)
|| NIL_P (args_description) || NIL_P (completion) || NIL_P (function)
|| NIL_P (data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hook_command");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (command, T_STRING);
Check_Type (description, T_STRING);
@@ -3460,7 +2658,7 @@ weechat_ruby_api_hook_command (VALUE class, VALUE command, VALUE description,
c_function,
c_data));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3472,7 +2670,7 @@ weechat_ruby_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
const char *command)
{
struct t_script_callback *script_callback;
- void *ruby_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3480,14 +2678,14 @@ weechat_ruby_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
if (script_callback && script_callback->function && script_callback->function[0])
{
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = script_ptr2str (buffer);
- ruby_argv[2] = (command) ? (char *)command : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (buffer);
+ func_argv[2] = (command) ? (char *)command : empty_arg;
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", ruby_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3496,8 +2694,8 @@ weechat_ruby_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
ret = *rc;
free (rc);
}
- if (ruby_argv[1])
- free (ruby_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -3516,20 +2714,9 @@ weechat_ruby_api_hook_command_run (VALUE class, VALUE command, VALUE function,
char *c_command, *c_function, *c_data, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hook_command_run");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_command_run", API_RETURN_EMPTY);
if (NIL_P (command) || NIL_P (function) || NIL_P (data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hook_command_run");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (command, T_STRING);
Check_Type (function, T_STRING);
@@ -3546,7 +2733,7 @@ weechat_ruby_api_hook_command_run (VALUE class, VALUE command, VALUE function,
c_function,
c_data));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3557,7 +2744,7 @@ int
weechat_ruby_api_hook_timer_cb (void *data, int remaining_calls)
{
struct t_script_callback *script_callback;
- void *ruby_argv[2];
+ void *func_argv[2];
char str_remaining_calls[32], empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3568,13 +2755,13 @@ weechat_ruby_api_hook_timer_cb (void *data, int remaining_calls)
snprintf (str_remaining_calls, sizeof (str_remaining_calls),
"%d", remaining_calls);
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = str_remaining_calls;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = str_remaining_calls;
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", ruby_argv);
+ "ss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3602,21 +2789,10 @@ weechat_ruby_api_hook_timer (VALUE class, VALUE interval, VALUE align_second,
char *c_function, *c_data, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hook_timer");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_timer", API_RETURN_EMPTY);
if (NIL_P (interval) || NIL_P (align_second) || NIL_P (max_calls)
|| NIL_P (function) || NIL_P (data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hook_timer");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (interval, T_FIXNUM);
Check_Type (align_second, T_FIXNUM);
@@ -3639,7 +2815,7 @@ weechat_ruby_api_hook_timer (VALUE class, VALUE interval, VALUE align_second,
c_function,
c_data));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3650,7 +2826,7 @@ int
weechat_ruby_api_hook_fd_cb (void *data, int fd)
{
struct t_script_callback *script_callback;
- void *ruby_argv[2];
+ void *func_argv[2];
char str_fd[32], empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3660,13 +2836,13 @@ weechat_ruby_api_hook_fd_cb (void *data, int fd)
{
snprintf (str_fd, sizeof (str_fd), "%d", fd);
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = str_fd;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = str_fd;
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", ruby_argv);
+ "ss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3694,21 +2870,10 @@ weechat_ruby_api_hook_fd (VALUE class, VALUE fd, VALUE read, VALUE write,
char *c_function, *c_data, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hook_fd");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_fd", API_RETURN_EMPTY);
if (NIL_P (fd) || NIL_P (read) || NIL_P (write) || NIL_P (exception)
|| NIL_P (function) || NIL_P (data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hook_fd");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (fd, T_FIXNUM);
Check_Type (read, T_FIXNUM);
@@ -3734,7 +2899,7 @@ weechat_ruby_api_hook_fd (VALUE class, VALUE fd, VALUE read, VALUE write,
c_function,
c_data));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3747,7 +2912,7 @@ weechat_ruby_api_hook_process_cb (void *data,
const char *out, const char *err)
{
struct t_script_callback *script_callback;
- void *ruby_argv[5];
+ void *func_argv[5];
char str_rc[32], empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3757,16 +2922,16 @@ weechat_ruby_api_hook_process_cb (void *data,
{
snprintf (str_rc, sizeof (str_rc), "%d", return_code);
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = (command) ? (char *)command : empty_arg;
- ruby_argv[2] = str_rc;
- ruby_argv[3] = (out) ? (char *)out : empty_arg;
- ruby_argv[4] = (err) ? (char *)err : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (command) ? (char *)command : empty_arg;
+ func_argv[2] = str_rc;
+ func_argv[3] = (out) ? (char *)out : empty_arg;
+ func_argv[4] = (err) ? (char *)err : empty_arg;
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sssss", ruby_argv);
+ "sssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3794,20 +2959,9 @@ weechat_ruby_api_hook_process (VALUE class, VALUE command, VALUE timeout,
int c_timeout;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hook_process");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_process", API_RETURN_EMPTY);
if (NIL_P (command) || NIL_P (timeout) || NIL_P (function) || NIL_P (data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hook_process");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (command, T_STRING);
Check_Type (timeout, T_FIXNUM);
@@ -3827,7 +2981,7 @@ weechat_ruby_api_hook_process (VALUE class, VALUE command, VALUE timeout,
c_function,
c_data));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3839,7 +2993,7 @@ weechat_ruby_api_hook_connect_cb (void *data, int status, int gnutls_rc,
const char *error, const char *ip_address)
{
struct t_script_callback *script_callback;
- void *ruby_argv[5];
+ void *func_argv[5];
char str_status[32], str_gnutls_rc[32];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3851,16 +3005,16 @@ weechat_ruby_api_hook_connect_cb (void *data, int status, int gnutls_rc,
snprintf (str_status, sizeof (str_status), "%d", status);
snprintf (str_gnutls_rc, sizeof (str_gnutls_rc), "%d", gnutls_rc);
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = str_status;
- ruby_argv[2] = str_gnutls_rc;
- ruby_argv[3] = (ip_address) ? (char *)ip_address : empty_arg;
- ruby_argv[4] = (error) ? (char *)error : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = str_status;
+ func_argv[2] = str_gnutls_rc;
+ func_argv[3] = (ip_address) ? (char *)ip_address : empty_arg;
+ func_argv[4] = (error) ? (char *)error : empty_arg;
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sssss", ruby_argv);
+ "sssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3890,22 +3044,11 @@ weechat_ruby_api_hook_connect (VALUE class, VALUE proxy, VALUE address,
int c_port, c_sock, c_ipv6;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hook_connect");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_connect", API_RETURN_EMPTY);
if (NIL_P (proxy) || NIL_P (address) || NIL_P (port) || NIL_P (sock)
|| NIL_P (ipv6) || NIL_P (local_hostname) || NIL_P (function)
|| NIL_P (data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hook_connect");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (proxy, T_STRING);
Check_Type (address, T_STRING);
@@ -3941,7 +3084,7 @@ weechat_ruby_api_hook_connect (VALUE class, VALUE proxy, VALUE address,
c_function,
c_data));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3956,7 +3099,7 @@ weechat_ruby_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
const char *prefix, const char *message)
{
struct t_script_callback *script_callback;
- void *ruby_argv[8];
+ void *func_argv[8];
char empty_arg[1] = { '\0' };
static char timebuffer[64];
int *rc, ret;
@@ -3970,21 +3113,21 @@ weechat_ruby_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
{
snprintf (timebuffer, sizeof (timebuffer) - 1, "%ld", (long int)date);
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = script_ptr2str (buffer);
- ruby_argv[2] = timebuffer;
- ruby_argv[3] = weechat_string_build_with_split_string (tags, ",");
- if (!ruby_argv[3])
- ruby_argv[3] = strdup ("");
- ruby_argv[4] = (displayed) ? strdup ("1") : strdup ("0");
- ruby_argv[5] = (highlight) ? strdup ("1") : strdup ("0");
- ruby_argv[6] = (prefix) ? (char *)prefix : empty_arg;
- ruby_argv[7] = (message) ? (char *)message : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (buffer);
+ func_argv[2] = timebuffer;
+ func_argv[3] = weechat_string_build_with_split_string (tags, ",");
+ if (!func_argv[3])
+ func_argv[3] = strdup ("");
+ func_argv[4] = (displayed) ? strdup ("1") : strdup ("0");
+ func_argv[5] = (highlight) ? strdup ("1") : strdup ("0");
+ func_argv[6] = (prefix) ? (char *)prefix : empty_arg;
+ func_argv[7] = (message) ? (char *)message : empty_arg;
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ssssssss", ruby_argv);
+ "ssssssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3993,14 +3136,14 @@ weechat_ruby_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
ret = *rc;
free (rc);
}
- if (ruby_argv[1])
- free (ruby_argv[1]);
- if (ruby_argv[3])
- free (ruby_argv[3]);
- if (ruby_argv[4])
- free (ruby_argv[4]);
- if (ruby_argv[5])
- free (ruby_argv[5]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[3])
+ free (func_argv[3]);
+ if (func_argv[4])
+ free (func_argv[4]);
+ if (func_argv[5])
+ free (func_argv[5]);
return ret;
}
@@ -4021,21 +3164,10 @@ weechat_ruby_api_hook_print (VALUE class, VALUE buffer, VALUE tags,
int c_strip_colors;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hook_print");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_print", API_RETURN_EMPTY);
if (NIL_P (buffer) || NIL_P (tags) || NIL_P (message)
|| NIL_P (strip_colors) || NIL_P (function) || NIL_P (data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hook_print");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (buffer, T_STRING);
Check_Type (tags, T_STRING);
@@ -4061,7 +3193,7 @@ weechat_ruby_api_hook_print (VALUE class, VALUE buffer, VALUE tags,
c_function,
c_data));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4073,7 +3205,7 @@ weechat_ruby_api_hook_signal_cb (void *data, const char *signal, const char *typ
void *signal_data)
{
struct t_script_callback *script_callback;
- void *ruby_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
static char value_str[64];
int *rc, ret, free_needed;
@@ -4082,31 +3214,31 @@ weechat_ruby_api_hook_signal_cb (void *data, const char *signal, const char *typ
if (script_callback && script_callback->function && script_callback->function[0])
{
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = (signal) ? (char *)signal : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (signal) ? (char *)signal : empty_arg;
free_needed = 0;
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
{
- ruby_argv[2] = (signal_data) ? (char *)signal_data : empty_arg;
+ func_argv[2] = (signal_data) ? (char *)signal_data : empty_arg;
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_INT) == 0)
{
snprintf (value_str, sizeof (value_str) - 1,
"%d", *((int *)signal_data));
- ruby_argv[2] = value_str;
+ func_argv[2] = value_str;
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_POINTER) == 0)
{
- ruby_argv[2] = script_ptr2str (signal_data);
+ func_argv[2] = script_ptr2str (signal_data);
free_needed = 1;
}
else
- ruby_argv[2] = empty_arg;
+ func_argv[2] = empty_arg;
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", ruby_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -4115,8 +3247,8 @@ weechat_ruby_api_hook_signal_cb (void *data, const char *signal, const char *typ
ret = *rc;
free (rc);
}
- if (free_needed && ruby_argv[2])
- free (ruby_argv[2]);
+ if (free_needed && func_argv[2])
+ free (func_argv[2]);
return ret;
}
@@ -4135,20 +3267,9 @@ weechat_ruby_api_hook_signal (VALUE class, VALUE signal, VALUE function,
char *c_signal, *c_function, *c_data, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hook_signal");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_signal", API_RETURN_EMPTY);
if (NIL_P (signal) || NIL_P (function) || NIL_P (data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hook_signal");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (signal, T_STRING);
Check_Type (function, T_STRING);
@@ -4165,7 +3286,7 @@ weechat_ruby_api_hook_signal (VALUE class, VALUE signal, VALUE function,
c_function,
c_data));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4179,20 +3300,9 @@ weechat_ruby_api_hook_signal_send (VALUE class, VALUE signal, VALUE type_data,
char *c_signal, *c_type_data, *c_signal_data;
int number;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hook_signal_send");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "hook_signal_send", API_RETURN_ERROR);
if (NIL_P (signal) || NIL_P (type_data) || NIL_P (signal_data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hook_signal_send");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (signal, T_STRING);
Check_Type (type_data, T_STRING);
@@ -4205,14 +3315,14 @@ weechat_ruby_api_hook_signal_send (VALUE class, VALUE signal, VALUE type_data,
Check_Type (signal_data, T_STRING);
c_signal_data = StringValuePtr (signal_data);
weechat_hook_signal_send (c_signal, c_type_data, c_signal_data);
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
else if (strcmp (c_type_data, WEECHAT_HOOK_SIGNAL_INT) == 0)
{
- Check_Type (signal_data, T_STRING);
+ Check_Type (signal_data, T_FIXNUM);
number = FIX2INT (signal_data);
weechat_hook_signal_send (c_signal, c_type_data, &number);
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
else if (strcmp (c_type_data, WEECHAT_HOOK_SIGNAL_POINTER) == 0)
{
@@ -4220,10 +3330,10 @@ weechat_ruby_api_hook_signal_send (VALUE class, VALUE signal, VALUE type_data,
c_signal_data = StringValuePtr (signal_data);
weechat_hook_signal_send (c_signal, c_type_data,
script_str2ptr (c_signal_data));
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
- RUBY_RETURN_ERROR;
+ API_RETURN_ERROR;
}
/*
@@ -4235,7 +3345,7 @@ weechat_ruby_api_hook_hsignal_cb (void *data, const char *signal,
struct t_hashtable *hashtable)
{
struct t_script_callback *script_callback;
- void *ruby_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -4243,14 +3353,14 @@ weechat_ruby_api_hook_hsignal_cb (void *data, const char *signal,
if (script_callback && script_callback->function && script_callback->function[0])
{
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = (signal) ? (char *)signal : empty_arg;
- ruby_argv[2] = (void *)weechat_ruby_hashtable_to_hash (hashtable);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (signal) ? (char *)signal : empty_arg;
+ func_argv[2] = hashtable;
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ssh", ruby_argv);
+ "ssh", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -4277,20 +3387,9 @@ weechat_ruby_api_hook_hsignal (VALUE class, VALUE signal, VALUE function,
char *c_signal, *c_function, *c_data, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hook_hsignal");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_hsignal", API_RETURN_EMPTY);
if (NIL_P (signal) || NIL_P (function) || NIL_P (data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hook_hsignal");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (signal, T_STRING);
Check_Type (function, T_STRING);
@@ -4307,7 +3406,7 @@ weechat_ruby_api_hook_hsignal (VALUE class, VALUE signal, VALUE function,
c_function,
c_data));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4320,20 +3419,9 @@ weechat_ruby_api_hook_hsignal_send (VALUE class, VALUE signal, VALUE hashtable)
char *c_signal;
struct t_hashtable *c_hashtable;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hook_hsignal_send");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "hook_hsignal_send", API_RETURN_ERROR);
if (NIL_P (signal) || NIL_P (hashtable))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hook_hsignal_send");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (signal, T_STRING);
Check_Type (hashtable, T_HASH);
@@ -4347,7 +3435,7 @@ weechat_ruby_api_hook_hsignal_send (VALUE class, VALUE signal, VALUE hashtable)
if (c_hashtable)
weechat_hashtable_free (c_hashtable);
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4358,7 +3446,7 @@ int
weechat_ruby_api_hook_config_cb (void *data, const char *option, const char *value)
{
struct t_script_callback *script_callback;
- void *ruby_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -4366,14 +3454,14 @@ weechat_ruby_api_hook_config_cb (void *data, const char *option, const char *val
if (script_callback && script_callback->function && script_callback->function[0])
{
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = (option) ? (char *)option : empty_arg;
- ruby_argv[2] = (value) ? (char *)value : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (option) ? (char *)option : empty_arg;
+ func_argv[2] = (value) ? (char *)value : empty_arg;
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", ruby_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -4400,20 +3488,9 @@ weechat_ruby_api_hook_config (VALUE class, VALUE option, VALUE function,
char *c_option, *c_function, *c_data, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hook_config");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_config", API_RETURN_EMPTY);
if (NIL_P (option) || NIL_P (function) || NIL_P (data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hook_config");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (option, T_STRING);
Check_Type (function, T_STRING);
@@ -4430,7 +3507,7 @@ weechat_ruby_api_hook_config (VALUE class, VALUE option, VALUE function,
c_function,
c_data));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4443,7 +3520,7 @@ weechat_ruby_api_hook_completion_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
struct t_script_callback *script_callback;
- void *ruby_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -4451,15 +3528,15 @@ weechat_ruby_api_hook_completion_cb (void *data, const char *completion_item,
if (script_callback && script_callback->function && script_callback->function[0])
{
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = (completion_item) ? (char *)completion_item : empty_arg;
- ruby_argv[2] = script_ptr2str (buffer);
- ruby_argv[3] = script_ptr2str (completion);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (completion_item) ? (char *)completion_item : empty_arg;
+ func_argv[2] = script_ptr2str (buffer);
+ func_argv[3] = script_ptr2str (completion);
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ssss", ruby_argv);
+ "ssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -4468,10 +3545,10 @@ weechat_ruby_api_hook_completion_cb (void *data, const char *completion_item,
ret = *rc;
free (rc);
}
- if (ruby_argv[2])
- free (ruby_argv[2]);
- if (ruby_argv[3])
- free (ruby_argv[3]);
+ if (func_argv[2])
+ free (func_argv[2]);
+ if (func_argv[3])
+ free (func_argv[3]);
return ret;
}
@@ -4491,21 +3568,10 @@ weechat_ruby_api_hook_completion (VALUE class, VALUE completion,
char *c_completion, *c_description, *c_function, *c_data, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hook_completion");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_completion", API_RETURN_EMPTY);
if (NIL_P (completion) || NIL_P (description) || NIL_P (function)
|| NIL_P (data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hook_completion");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (completion, T_STRING);
Check_Type (description, T_STRING);
@@ -4525,7 +3591,7 @@ weechat_ruby_api_hook_completion (VALUE class, VALUE completion,
c_function,
c_data));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4540,21 +3606,10 @@ weechat_ruby_api_hook_completion_list_add (VALUE class, VALUE completion,
char *c_completion, *c_word, *c_where;
int c_nick_completion;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hook_completion_list_add");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "hook_completion_list_add", API_RETURN_ERROR);
if (NIL_P (completion) || NIL_P (word) || NIL_P (nick_completion)
|| NIL_P (where))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hook_completion_list_add");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (completion, T_STRING);
Check_Type (word, T_STRING);
@@ -4571,7 +3626,7 @@ weechat_ruby_api_hook_completion_list_add (VALUE class, VALUE completion,
c_nick_completion,
c_where);
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4583,22 +3638,22 @@ weechat_ruby_api_hook_modifier_cb (void *data, const char *modifier,
const char *modifier_data, const char *string)
{
struct t_script_callback *script_callback;
- void *ruby_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' };
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = (modifier) ? (char *)modifier : empty_arg;
- ruby_argv[2] = (modifier_data) ? (char *)modifier_data : empty_arg;
- ruby_argv[3] = (string) ? (char *)string : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (modifier) ? (char *)modifier : empty_arg;
+ func_argv[2] = (modifier_data) ? (char *)modifier_data : empty_arg;
+ func_argv[3] = (string) ? (char *)string : empty_arg;
return (char *)weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
- "ssss", ruby_argv);
+ "ssss", func_argv);
}
return NULL;
@@ -4615,20 +3670,9 @@ weechat_ruby_api_hook_modifier (VALUE class, VALUE modifier, VALUE function,
char *c_modifier, *c_function, *c_data, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hook_modifier");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_modifier", API_RETURN_EMPTY);
if (NIL_P (modifier) || NIL_P (function) || NIL_P (data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hook_modifier");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (modifier, T_STRING);
Check_Type (function, T_STRING);
@@ -4645,7 +3689,7 @@ weechat_ruby_api_hook_modifier (VALUE class, VALUE modifier, VALUE function,
c_function,
c_data));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4659,20 +3703,9 @@ weechat_ruby_api_hook_modifier_exec (VALUE class, VALUE modifier,
char *c_modifier, *c_modifier_data, *c_string, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hook_modifier_exec");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_modifier_exec", API_RETURN_EMPTY);
if (NIL_P (modifier) || NIL_P (modifier_data) || NIL_P (string))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hook_modifier_exec");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (modifier, T_STRING);
Check_Type (modifier_data, T_STRING);
@@ -4684,7 +3717,7 @@ weechat_ruby_api_hook_modifier_exec (VALUE class, VALUE modifier,
result = weechat_hook_modifier_exec (c_modifier, c_modifier_data, c_string);
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4696,21 +3729,21 @@ weechat_ruby_api_hook_info_cb (void *data, const char *info_name,
const char *arguments)
{
struct t_script_callback *script_callback;
- void *ruby_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = (info_name) ? (char *)info_name : empty_arg;
- ruby_argv[2] = (arguments) ? (char *)arguments : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
+ func_argv[2] = (arguments) ? (char *)arguments : empty_arg;
return (const char *)weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
- "sss", ruby_argv);
+ "sss", func_argv);
}
return NULL;
@@ -4728,21 +3761,10 @@ weechat_ruby_api_hook_info (VALUE class, VALUE info_name, VALUE description,
char *c_data, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hook_info");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_info", API_RETURN_EMPTY);
if (NIL_P (info_name) || NIL_P (description) || NIL_P (args_description)
|| NIL_P (function) || NIL_P (data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hook_info");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (info_name, T_STRING);
Check_Type (description, T_STRING);
@@ -4765,7 +3787,7 @@ weechat_ruby_api_hook_info (VALUE class, VALUE info_name, VALUE description,
c_function,
c_data));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4777,21 +3799,21 @@ weechat_ruby_api_hook_info_hashtable_cb (void *data, const char *info_name,
struct t_hashtable *hashtable)
{
struct t_script_callback *script_callback;
- void *ruby_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = (info_name) ? (char *)info_name : empty_arg;
- ruby_argv[2] = (void *)weechat_ruby_hashtable_to_hash (hashtable);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
+ func_argv[2] = hashtable;
return (struct t_hashtable *)weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
script_callback->function,
- "ssh", ruby_argv);
+ "ssh", func_argv);
}
return NULL;
@@ -4813,21 +3835,10 @@ weechat_ruby_api_hook_info_hashtable (VALUE class, VALUE info_name,
char *c_data, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hook_info_hashtable");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_info_hashtable", API_RETURN_EMPTY);
if (NIL_P (info_name) || NIL_P (description) || NIL_P (args_description)
|| NIL_P (output_description) || NIL_P (function) || NIL_P (data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hook_info_hashtable");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (info_name, T_STRING);
Check_Type (description, T_STRING);
@@ -4853,7 +3864,7 @@ weechat_ruby_api_hook_info_hashtable (VALUE class, VALUE info_name,
c_function,
c_data));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4865,7 +3876,7 @@ weechat_ruby_api_hook_infolist_cb (void *data, const char *infolist_name,
void *pointer, const char *arguments)
{
struct t_script_callback *script_callback;
- void *ruby_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' };
struct t_infolist *result;
@@ -4873,18 +3884,18 @@ weechat_ruby_api_hook_infolist_cb (void *data, const char *infolist_name,
if (script_callback && script_callback->function && script_callback->function[0])
{
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = (infolist_name) ? (char *)infolist_name : empty_arg;
- ruby_argv[2] = script_ptr2str (pointer);
- ruby_argv[3] = (arguments) ? (char *)arguments : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (infolist_name) ? (char *)infolist_name : empty_arg;
+ func_argv[2] = script_ptr2str (pointer);
+ func_argv[3] = (arguments) ? (char *)arguments : empty_arg;
result = (struct t_infolist *)weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
- "ssss", ruby_argv);
+ "ssss", func_argv);
- if (ruby_argv[2])
- free (ruby_argv[2]);
+ if (func_argv[2])
+ free (func_argv[2]);
return result;
}
@@ -4906,22 +3917,11 @@ weechat_ruby_api_hook_infolist (VALUE class, VALUE infolist_name,
char *c_args_description, *c_function, *c_data, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hook_infolist");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_infolist", API_RETURN_EMPTY);
if (NIL_P (infolist_name) || NIL_P (description)
|| NIL_P (pointer_description) || NIL_P (args_description)
|| NIL_P (function) || NIL_P (data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hook_infolist");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (infolist_name, T_STRING);
Check_Type (description, T_STRING);
@@ -4947,7 +3947,7 @@ weechat_ruby_api_hook_infolist (VALUE class, VALUE infolist_name,
c_function,
c_data));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4955,24 +3955,23 @@ weechat_ruby_api_hook_infolist (VALUE class, VALUE infolist_name,
*/
struct t_hashtable *
-weechat_ruby_api_hook_focus_cb (void *data,
- struct t_hashtable *info)
+weechat_ruby_api_hook_focus_cb (void *data, struct t_hashtable *info)
{
struct t_script_callback *script_callback;
- void *ruby_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = info;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = info;
return (struct t_hashtable *)weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
script_callback->function,
- "sh", ruby_argv);
+ "sh", func_argv);
}
return NULL;
@@ -4989,20 +3988,9 @@ weechat_ruby_api_hook_focus (VALUE class, VALUE area, VALUE function,
char *c_area, *c_function, *c_data, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hook_focus");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_focus", API_RETURN_EMPTY);
if (NIL_P (area) || NIL_P (function) || NIL_P (data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hook_focus");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (area, T_STRING);
Check_Type (function, T_STRING);
@@ -5019,7 +4007,7 @@ weechat_ruby_api_hook_focus (VALUE class, VALUE area, VALUE function,
c_function,
c_data));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5031,20 +4019,9 @@ weechat_ruby_api_unhook (VALUE class, VALUE hook)
{
char *c_hook;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "unhook");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "unhook", API_RETURN_ERROR);
if (NIL_P (hook))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "unhook");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (hook, T_STRING);
@@ -5054,7 +4031,7 @@ weechat_ruby_api_unhook (VALUE class, VALUE hook)
ruby_current_script,
script_str2ptr (c_hook));
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5064,18 +4041,11 @@ weechat_ruby_api_unhook (VALUE class, VALUE hook)
static VALUE
weechat_ruby_api_unhook_all (VALUE class)
{
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "unhook_all");
- RUBY_RETURN_ERROR;
- }
+ API_FUNC(1, "unhook_all", API_RETURN_ERROR);
script_api_unhook_all (ruby_current_script);
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5087,7 +4057,7 @@ weechat_ruby_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
const char *input_data)
{
struct t_script_callback *script_callback;
- void *ruby_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -5095,14 +4065,14 @@ weechat_ruby_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
if (script_callback && script_callback->function && script_callback->function[0])
{
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = script_ptr2str (buffer);
- ruby_argv[2] = (input_data) ? (char *)input_data : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (buffer);
+ func_argv[2] = (input_data) ? (char *)input_data : empty_arg;
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", ruby_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -5111,8 +4081,8 @@ weechat_ruby_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
ret = *rc;
free (rc);
}
- if (ruby_argv[1])
- free (ruby_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -5128,7 +4098,7 @@ int
weechat_ruby_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
{
struct t_script_callback *script_callback;
- void *ruby_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -5136,13 +4106,13 @@ weechat_ruby_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
if (script_callback && script_callback->function && script_callback->function[0])
{
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = script_ptr2str (buffer);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (buffer);
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", ruby_argv);
+ "ss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -5151,8 +4121,8 @@ weechat_ruby_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
ret = *rc;
free (rc);
}
- if (ruby_argv[1])
- free (ruby_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -5173,21 +4143,10 @@ weechat_ruby_api_buffer_new (VALUE class, VALUE name, VALUE function_input,
char *c_data_close, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "buffer_new");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "buffer_new", API_RETURN_EMPTY);
if (NIL_P (name) || NIL_P (function_input) || NIL_P (data_input)
|| NIL_P (function_close) || NIL_P (data_close))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "buffer_new");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (name, T_STRING);
Check_Type (function_input, T_STRING);
@@ -5211,7 +4170,7 @@ weechat_ruby_api_buffer_new (VALUE class, VALUE name, VALUE function_input,
c_function_close,
c_data_close));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5224,20 +4183,9 @@ weechat_ruby_api_buffer_search (VALUE class, VALUE plugin, VALUE name)
char *c_plugin, *c_name, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "buffer_search");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "buffer_search", API_RETURN_EMPTY);
if (NIL_P (plugin) || NIL_P (name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "buffer_search");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (plugin, T_STRING);
Check_Type (name, T_STRING);
@@ -5247,7 +4195,7 @@ weechat_ruby_api_buffer_search (VALUE class, VALUE plugin, VALUE name)
result = script_ptr2str (weechat_buffer_search (c_plugin, c_name));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5260,18 +4208,11 @@ weechat_ruby_api_buffer_search_main (VALUE class)
char *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "buffer_search_main");
- RUBY_RETURN_EMPTY;
- }
+ API_FUNC(1, "buffer_search_main", API_RETURN_EMPTY);
result = script_ptr2str (weechat_buffer_search_main ());
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5284,18 +4225,11 @@ weechat_ruby_api_current_buffer (VALUE class)
char *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "current_buffer");
- RUBY_RETURN_EMPTY;
- }
+ API_FUNC(1, "current_buffer", API_RETURN_EMPTY);
result = script_ptr2str (weechat_current_buffer ());
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5307,20 +4241,9 @@ weechat_ruby_api_buffer_clear (VALUE class, VALUE buffer)
{
char *c_buffer;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "buffer_clear");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_clear", API_RETURN_ERROR);
if (NIL_P (buffer))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "buffer_clear");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (buffer, T_STRING);
@@ -5328,7 +4251,7 @@ weechat_ruby_api_buffer_clear (VALUE class, VALUE buffer)
weechat_buffer_clear (script_str2ptr (c_buffer));
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5340,20 +4263,9 @@ weechat_ruby_api_buffer_close (VALUE class, VALUE buffer)
{
char *c_buffer;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "buffer_close");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_close", API_RETURN_ERROR);
if (NIL_P (buffer))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "buffer_close");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (buffer, T_STRING);
@@ -5363,7 +4275,7 @@ weechat_ruby_api_buffer_close (VALUE class, VALUE buffer)
ruby_current_script,
script_str2ptr (c_buffer));
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5375,20 +4287,9 @@ weechat_ruby_api_buffer_merge (VALUE class, VALUE buffer, VALUE target_buffer)
{
char *c_buffer, *c_target_buffer;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "buffer_merge");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_merge", API_RETURN_ERROR);
if (NIL_P (buffer) || NIL_P (target_buffer))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "buffer_merge");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (buffer, T_STRING);
Check_Type (target_buffer, T_STRING);
@@ -5399,7 +4300,7 @@ weechat_ruby_api_buffer_merge (VALUE class, VALUE buffer, VALUE target_buffer)
weechat_buffer_merge (script_str2ptr (c_buffer),
script_str2ptr (c_target_buffer));
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5413,20 +4314,9 @@ weechat_ruby_api_buffer_unmerge (VALUE class, VALUE buffer, VALUE number)
char *c_buffer;
int c_number;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "buffer_unmerge");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_unmerge", API_RETURN_ERROR);
if (NIL_P (buffer) || NIL_P (number))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "buffer_unmerge");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (buffer, T_STRING);
Check_Type (number, T_FIXNUM);
@@ -5436,7 +4326,7 @@ weechat_ruby_api_buffer_unmerge (VALUE class, VALUE buffer, VALUE number)
weechat_buffer_unmerge (script_str2ptr (c_buffer), c_number);
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5449,20 +4339,9 @@ weechat_ruby_api_buffer_get_integer (VALUE class, VALUE buffer, VALUE property)
char *c_buffer, *c_property;
int value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "buffer_get_integer");
- RUBY_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "buffer_get_integer", API_RETURN_INT(-1));
if (NIL_P (buffer) || NIL_P (property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "buffer_get_integer");
- RUBY_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
Check_Type (buffer, T_STRING);
Check_Type (property, T_STRING);
@@ -5473,7 +4352,7 @@ weechat_ruby_api_buffer_get_integer (VALUE class, VALUE buffer, VALUE property)
value = weechat_buffer_get_integer (script_str2ptr (c_buffer),
c_property);
- RUBY_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -5486,20 +4365,9 @@ weechat_ruby_api_buffer_get_string (VALUE class, VALUE buffer, VALUE property)
char *c_buffer, *c_property;
const char *result;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "buffer_get_string");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "buffer_get_string", API_RETURN_EMPTY);
if (NIL_P (buffer) || NIL_P (property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "buffer_get_string");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (buffer, T_STRING);
Check_Type (property, T_STRING);
@@ -5510,7 +4378,7 @@ weechat_ruby_api_buffer_get_string (VALUE class, VALUE buffer, VALUE property)
result = weechat_buffer_get_string (script_str2ptr (c_buffer),
c_property);
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -5523,20 +4391,9 @@ weechat_ruby_api_buffer_get_pointer (VALUE class, VALUE buffer, VALUE property)
char *c_buffer, *c_property, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "buffer_get_pointer");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "buffer_get_pointer", API_RETURN_EMPTY);
if (NIL_P (buffer) || NIL_P (property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "buffer_get_pointer");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (buffer, T_STRING);
Check_Type (property, T_STRING);
@@ -5547,7 +4404,7 @@ weechat_ruby_api_buffer_get_pointer (VALUE class, VALUE buffer, VALUE property)
result = script_ptr2str (weechat_buffer_get_pointer (script_str2ptr (c_buffer),
c_property));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5560,20 +4417,9 @@ weechat_ruby_api_buffer_set (VALUE class, VALUE buffer, VALUE property,
{
char *c_buffer, *c_property, *c_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "buffer_set");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_set", API_RETURN_ERROR);
if (NIL_P (buffer) || NIL_P (property) || NIL_P (value))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "buffer_set");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (buffer, T_STRING);
Check_Type (property, T_STRING);
@@ -5587,7 +4433,7 @@ weechat_ruby_api_buffer_set (VALUE class, VALUE buffer, VALUE property,
c_property,
c_value);
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5601,20 +4447,9 @@ weechat_ruby_api_buffer_string_replace_local_var (VALUE class, VALUE buffer, VAL
char *c_buffer, *c_string, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "buffer_string_replace_local_var");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_string_replace_local_var", API_RETURN_ERROR);
if (NIL_P (buffer) || NIL_P (string))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "buffer_string_replace_local_var");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (buffer, T_STRING);
Check_Type (string, T_STRING);
@@ -5624,7 +4459,7 @@ weechat_ruby_api_buffer_string_replace_local_var (VALUE class, VALUE buffer, VAL
result = weechat_buffer_string_replace_local_var (script_str2ptr (c_buffer), c_string);
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5637,20 +4472,9 @@ weechat_ruby_api_buffer_match_list (VALUE class, VALUE buffer, VALUE string)
char *c_buffer, *c_string;
int value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "buffer_match_list");
- RUBY_RETURN_INT(0);
- }
-
+ API_FUNC(1, "buffer_match_list", API_RETURN_INT(0));
if (NIL_P (buffer) || NIL_P (string))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "buffer_match_list");
- RUBY_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (buffer, T_STRING);
Check_Type (string, T_STRING);
@@ -5661,7 +4485,7 @@ weechat_ruby_api_buffer_match_list (VALUE class, VALUE buffer, VALUE string)
value = weechat_buffer_match_list (script_str2ptr (c_buffer),
c_string);
- RUBY_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -5674,18 +4498,11 @@ weechat_ruby_api_current_window (VALUE class)
char *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "current_window");
- RUBY_RETURN_EMPTY;
- }
+ API_FUNC(1, "current_window", API_RETURN_EMPTY);
result = script_ptr2str (weechat_current_window ());
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5699,20 +4516,9 @@ weechat_ruby_api_window_search_with_buffer (VALUE class, VALUE buffer)
char *c_buffer, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "window_search_with_buffer");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "window_search_with_buffer", API_RETURN_EMPTY);
if (NIL_P (buffer))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "window_search_with_buffer");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (buffer, T_STRING);
@@ -5720,7 +4526,7 @@ weechat_ruby_api_window_search_with_buffer (VALUE class, VALUE buffer)
result = script_ptr2str (weechat_window_search_with_buffer (script_str2ptr (c_buffer)));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5733,20 +4539,9 @@ weechat_ruby_api_window_get_integer (VALUE class, VALUE window, VALUE property)
char *c_window, *c_property;
int value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "window_get_integer");
- RUBY_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "window_get_integer", API_RETURN_INT(-1));
if (NIL_P (window) || NIL_P (property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "window_get_integer");
- RUBY_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
Check_Type (window, T_STRING);
Check_Type (property, T_STRING);
@@ -5757,7 +4552,7 @@ weechat_ruby_api_window_get_integer (VALUE class, VALUE window, VALUE property)
value = weechat_window_get_integer (script_str2ptr (c_window),
c_property);
- RUBY_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -5770,20 +4565,9 @@ weechat_ruby_api_window_get_string (VALUE class, VALUE window, VALUE property)
char *c_window, *c_property;
const char *result;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "window_get_string");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "window_get_string", API_RETURN_EMPTY);
if (NIL_P (window) || NIL_P (property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "window_get_string");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (window, T_STRING);
Check_Type (property, T_STRING);
@@ -5792,9 +4576,9 @@ weechat_ruby_api_window_get_string (VALUE class, VALUE window, VALUE property)
c_property = StringValuePtr (property);
result = weechat_window_get_string (script_str2ptr (c_window),
- c_property);
+ c_property);
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -5807,20 +4591,9 @@ weechat_ruby_api_window_get_pointer (VALUE class, VALUE window, VALUE property)
char *c_window, *c_property, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "window_get_pointer");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "window_get_pointer", API_RETURN_EMPTY);
if (NIL_P (window) || NIL_P (property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "window_get_pointer");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (window, T_STRING);
Check_Type (property, T_STRING);
@@ -5831,7 +4604,7 @@ weechat_ruby_api_window_get_pointer (VALUE class, VALUE window, VALUE property)
result = script_ptr2str (weechat_window_get_pointer (script_str2ptr (c_window),
c_property));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5843,20 +4616,9 @@ weechat_ruby_api_window_set_title (VALUE class, VALUE title)
{
char *c_title;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "window_set_title");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "window_set_title", API_RETURN_ERROR);
if (NIL_P (title))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "window_set_title");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (title, T_STRING);
@@ -5864,7 +4626,7 @@ weechat_ruby_api_window_set_title (VALUE class, VALUE title)
weechat_window_set_title (c_title);
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5880,21 +4642,10 @@ weechat_ruby_api_nicklist_add_group (VALUE class, VALUE buffer,
int c_visible;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "nicklist_add_group");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "nicklist_add_group", API_RETURN_EMPTY);
if (NIL_P (buffer) || NIL_P (parent_group) || NIL_P (name) || NIL_P (color)
|| NIL_P (visible))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "nicklist_add_group");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (buffer, T_STRING);
Check_Type (parent_group, T_STRING);
@@ -5914,7 +4665,7 @@ weechat_ruby_api_nicklist_add_group (VALUE class, VALUE buffer,
c_color,
c_visible));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5928,20 +4679,9 @@ weechat_ruby_api_nicklist_search_group (VALUE class, VALUE buffer,
char *c_buffer, *c_from_group, *c_name, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "nicklist_search_group");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "nicklist_search_group", API_RETURN_EMPTY);
if (NIL_P (buffer) || NIL_P (from_group) || NIL_P (name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "nicklist_search_group");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (buffer, T_STRING);
Check_Type (from_group, T_STRING);
@@ -5955,7 +4695,7 @@ weechat_ruby_api_nicklist_search_group (VALUE class, VALUE buffer,
script_str2ptr (c_from_group),
c_name));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5972,21 +4712,10 @@ weechat_ruby_api_nicklist_add_nick (VALUE class, VALUE buffer, VALUE group,
int c_visible;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "nicklist_add_nick");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "nicklist_add_nick", API_RETURN_EMPTY);
if (NIL_P (buffer) || NIL_P (group) || NIL_P (name) || NIL_P (color)
|| NIL_P (prefix) || NIL_P (prefix_color) || NIL_P (visible))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "nicklist_add_nick");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (buffer, T_STRING);
Check_Type (group, T_STRING);
@@ -6012,7 +4741,7 @@ weechat_ruby_api_nicklist_add_nick (VALUE class, VALUE buffer, VALUE group,
c_prefix_color,
c_visible));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6026,20 +4755,9 @@ weechat_ruby_api_nicklist_search_nick (VALUE class, VALUE buffer,
char *c_buffer, *c_from_group, *c_name, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "nicklist_search_nick");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "nicklist_search_nick", API_RETURN_EMPTY);
if (NIL_P (buffer) || NIL_P (from_group) || NIL_P (name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "nicklist_search_nick");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (buffer, T_STRING);
Check_Type (from_group, T_STRING);
@@ -6053,7 +4771,7 @@ weechat_ruby_api_nicklist_search_nick (VALUE class, VALUE buffer,
script_str2ptr (c_from_group),
c_name));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6065,20 +4783,9 @@ weechat_ruby_api_nicklist_remove_group (VALUE class, VALUE buffer, VALUE group)
{
char *c_buffer, *c_group;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "nicklist_remove_group");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_remove_group", API_RETURN_ERROR);
if (NIL_P (buffer) || NIL_P (group))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "nicklist_remove_group");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (buffer, T_STRING);
Check_Type (group, T_STRING);
@@ -6089,7 +4796,7 @@ weechat_ruby_api_nicklist_remove_group (VALUE class, VALUE buffer, VALUE group)
weechat_nicklist_remove_group (script_str2ptr (c_buffer),
script_str2ptr (c_group));
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6101,20 +4808,9 @@ weechat_ruby_api_nicklist_remove_nick (VALUE class, VALUE buffer, VALUE nick)
{
char *c_buffer, *c_nick;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "nicklist_remove_nick");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_remove_nick", API_RETURN_ERROR);
if (NIL_P (buffer) || NIL_P (nick))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "nicklist_remove_nick");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (buffer, T_STRING);
Check_Type (nick, T_STRING);
@@ -6125,7 +4821,7 @@ weechat_ruby_api_nicklist_remove_nick (VALUE class, VALUE buffer, VALUE nick)
weechat_nicklist_remove_nick (script_str2ptr (c_buffer),
script_str2ptr (c_nick));
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6137,20 +4833,9 @@ weechat_ruby_api_nicklist_remove_all (VALUE class, VALUE buffer)
{
char *c_buffer;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "nicklist_remove_all");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_remove_all", API_RETURN_ERROR);
if (NIL_P (buffer))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "nicklist_remove_all");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (buffer, T_STRING);
@@ -6158,7 +4843,7 @@ weechat_ruby_api_nicklist_remove_all (VALUE class, VALUE buffer)
weechat_nicklist_remove_all (script_str2ptr (c_buffer));
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6172,20 +4857,9 @@ weechat_ruby_api_nicklist_group_get_integer (VALUE class, VALUE buffer,
char *c_buffer, *c_group, *c_property;
int value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "nicklist_group_get_integer");
- RUBY_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "nicklist_group_get_integer", API_RETURN_INT(-1));
if (NIL_P (buffer) || NIL_P (group) || NIL_P (property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "nicklist_group_get_integer");
- RUBY_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
Check_Type (buffer, T_STRING);
Check_Type (group, T_STRING);
@@ -6199,7 +4873,7 @@ weechat_ruby_api_nicklist_group_get_integer (VALUE class, VALUE buffer,
script_str2ptr (c_group),
c_property);
- RUBY_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -6213,20 +4887,9 @@ weechat_ruby_api_nicklist_group_get_string (VALUE class, VALUE buffer,
char *c_buffer, *c_group, *c_property;
const char *result;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "nicklist_group_get_string");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "nicklist_group_get_string", API_RETURN_EMPTY);
if (NIL_P (buffer) || NIL_P (group) || NIL_P (property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "nicklist_group_get_string");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (buffer, T_STRING);
Check_Type (group, T_STRING);
@@ -6240,7 +4903,7 @@ weechat_ruby_api_nicklist_group_get_string (VALUE class, VALUE buffer,
script_str2ptr (c_group),
c_property);
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -6254,20 +4917,9 @@ weechat_ruby_api_nicklist_group_get_pointer (VALUE class, VALUE buffer,
char *c_buffer, *c_group, *c_property, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "nicklist_group_get_pointer");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "nicklist_group_get_pointer", API_RETURN_EMPTY);
if (NIL_P (buffer) || NIL_P (group) || NIL_P (property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "nicklist_group_get_pointer");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (buffer, T_STRING);
Check_Type (group, T_STRING);
@@ -6281,7 +4933,7 @@ weechat_ruby_api_nicklist_group_get_pointer (VALUE class, VALUE buffer,
script_str2ptr (c_group),
c_property));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6294,20 +4946,9 @@ weechat_ruby_api_nicklist_group_set (VALUE class, VALUE buffer, VALUE group,
{
char *c_buffer, *c_group, *c_property, *c_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "nicklist_group_set");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_group_set", API_RETURN_ERROR);
if (NIL_P (buffer) || NIL_P (group) || NIL_P (property) || NIL_P (value))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "nicklist_group_set");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (buffer, T_STRING);
Check_Type (group, T_STRING);
@@ -6324,7 +4965,7 @@ weechat_ruby_api_nicklist_group_set (VALUE class, VALUE buffer, VALUE group,
c_property,
c_value);
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6338,20 +4979,9 @@ weechat_ruby_api_nicklist_nick_get_integer (VALUE class, VALUE buffer,
char *c_buffer, *c_nick, *c_property;
int value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "nicklist_nick_get_integer");
- RUBY_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "nicklist_nick_get_integer", API_RETURN_INT(-1));
if (NIL_P (buffer) || NIL_P (nick) || NIL_P (property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "nicklist_nick_get_integer");
- RUBY_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
Check_Type (buffer, T_STRING);
Check_Type (nick, T_STRING);
@@ -6365,7 +4995,7 @@ weechat_ruby_api_nicklist_nick_get_integer (VALUE class, VALUE buffer,
script_str2ptr (c_nick),
c_property);
- RUBY_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -6379,20 +5009,9 @@ weechat_ruby_api_nicklist_nick_get_string (VALUE class, VALUE buffer,
char *c_buffer, *c_nick, *c_property;
const char *result;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "nicklist_nick_get_string");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "nicklist_nick_get_string", API_RETURN_EMPTY);
if (NIL_P (buffer) || NIL_P (nick) || NIL_P (property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "nicklist_nick_get_string");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (buffer, T_STRING);
Check_Type (nick, T_STRING);
@@ -6406,7 +5025,7 @@ weechat_ruby_api_nicklist_nick_get_string (VALUE class, VALUE buffer,
script_str2ptr (c_nick),
c_property);
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -6420,20 +5039,9 @@ weechat_ruby_api_nicklist_nick_get_pointer (VALUE class, VALUE buffer,
char *c_buffer, *c_nick, *c_property, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "nicklist_nick_get_pointer");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "nicklist_nick_get_pointer", API_RETURN_EMPTY);
if (NIL_P (buffer) || NIL_P (nick) || NIL_P (property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "nicklist_nick_get_pointer");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (buffer, T_STRING);
Check_Type (nick, T_STRING);
@@ -6447,7 +5055,7 @@ weechat_ruby_api_nicklist_nick_get_pointer (VALUE class, VALUE buffer,
script_str2ptr (c_nick),
c_property));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6460,20 +5068,9 @@ weechat_ruby_api_nicklist_nick_set (VALUE class, VALUE buffer, VALUE nick,
{
char *c_buffer, *c_nick, *c_property, *c_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "nicklist_nick_set");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_nick_set", API_RETURN_ERROR);
if (NIL_P (buffer) || NIL_P (nick) || NIL_P (property) || NIL_P (value))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "nicklist_nick_set");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (buffer, T_STRING);
Check_Type (nick, T_STRING);
@@ -6490,7 +5087,7 @@ weechat_ruby_api_nicklist_nick_set (VALUE class, VALUE buffer, VALUE nick,
c_property,
c_value);
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6503,20 +5100,9 @@ weechat_ruby_api_bar_item_search (VALUE class, VALUE name)
char *c_name, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "bar_item_search");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "bar_item_search", API_RETURN_EMPTY);
if (NIL_P (name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "bar_item_search");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (name, T_STRING);
@@ -6524,7 +5110,7 @@ weechat_ruby_api_bar_item_search (VALUE class, VALUE name)
result = script_ptr2str (weechat_bar_item_search (c_name));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6536,26 +5122,26 @@ weechat_ruby_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
{
struct t_script_callback *script_callback;
- void *ruby_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' }, *ret;
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = script_ptr2str (item);
- ruby_argv[2] = script_ptr2str (window);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (item);
+ func_argv[2] = script_ptr2str (window);
ret = (char *)weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
- "sss", ruby_argv);
+ "sss", func_argv);
- if (ruby_argv[1])
- free (ruby_argv[1]);
- if (ruby_argv[2])
- free (ruby_argv[2]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[2])
+ free (func_argv[2]);
return ret;
}
@@ -6574,20 +5160,9 @@ weechat_ruby_api_bar_item_new (VALUE class, VALUE name, VALUE function,
char *c_name, *c_function, *c_data, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "bar_item_new");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "bar_item_new", API_RETURN_EMPTY);
if (NIL_P (name) || NIL_P (function) || NIL_P (data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "bar_item_new");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (name, T_STRING);
Check_Type (function, T_STRING);
@@ -6604,7 +5179,7 @@ weechat_ruby_api_bar_item_new (VALUE class, VALUE name, VALUE function,
c_function,
c_data));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6616,20 +5191,9 @@ weechat_ruby_api_bar_item_update (VALUE class, VALUE name)
{
char *c_name;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "bar_item_update");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "bar_item_update", API_RETURN_ERROR);
if (NIL_P (name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "bar_item_update");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (name, T_STRING);
@@ -6637,7 +5201,7 @@ weechat_ruby_api_bar_item_update (VALUE class, VALUE name)
weechat_bar_item_update (c_name);
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6649,20 +5213,9 @@ weechat_ruby_api_bar_item_remove (VALUE class, VALUE item)
{
char *c_item;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "bar_item_remove");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "bar_item_remove", API_RETURN_ERROR);
if (NIL_P (item))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "bar_item_remove");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (item, T_STRING);
@@ -6672,7 +5225,7 @@ weechat_ruby_api_bar_item_remove (VALUE class, VALUE item)
ruby_current_script,
script_str2ptr (c_item));
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6685,20 +5238,9 @@ weechat_ruby_api_bar_search (VALUE class, VALUE name)
char *c_name, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "bar_search");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "bar_search", API_RETURN_EMPTY);
if (NIL_P (name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "bar_search");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (name, T_STRING);
@@ -6706,7 +5248,7 @@ weechat_ruby_api_bar_search (VALUE class, VALUE name)
result = script_ptr2str (weechat_bar_search (c_name));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6727,24 +5269,13 @@ weechat_ruby_api_bar_new (VALUE class, VALUE name, VALUE hidden,
char *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "bar_new");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "bar_new", API_RETURN_EMPTY);
if (NIL_P (name) || NIL_P (hidden) || NIL_P (priority) || NIL_P (type)
|| NIL_P (conditions) || NIL_P (position) || NIL_P (filling_top_bottom)
|| NIL_P (filling_left_right) || NIL_P (size) || NIL_P (size_max)
|| NIL_P (color_fg) || NIL_P (color_delim) || NIL_P (color_bg)
|| NIL_P (separator) || NIL_P (items))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "bar_new");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (name, T_STRING);
Check_Type (hidden, T_STRING);
@@ -6794,7 +5325,7 @@ weechat_ruby_api_bar_new (VALUE class, VALUE name, VALUE hidden,
c_separator,
c_items));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6806,20 +5337,9 @@ weechat_ruby_api_bar_set (VALUE class, VALUE bar, VALUE property, VALUE value)
{
char *c_bar, *c_property, *c_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "bar_set");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "bar_set", API_RETURN_ERROR);
if (NIL_P (bar) || NIL_P (property) || NIL_P (value))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "bar_set");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (bar, T_STRING);
Check_Type (property, T_STRING);
@@ -6833,7 +5353,7 @@ weechat_ruby_api_bar_set (VALUE class, VALUE bar, VALUE property, VALUE value)
c_property,
c_value);
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6845,20 +5365,9 @@ weechat_ruby_api_bar_update (VALUE class, VALUE name)
{
char *c_name;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "bar_update");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "bar_update", API_RETURN_ERROR);
if (NIL_P (name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "bar_update");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (name, T_STRING);
@@ -6866,7 +5375,7 @@ weechat_ruby_api_bar_update (VALUE class, VALUE name)
weechat_bar_update (c_name);
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6878,20 +5387,9 @@ weechat_ruby_api_bar_remove (VALUE class, VALUE bar)
{
char *c_bar;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "bar_remove");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "bar_remove", API_RETURN_ERROR);
if (NIL_P (bar))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "bar_remove");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (bar, T_STRING);
@@ -6899,7 +5397,7 @@ weechat_ruby_api_bar_remove (VALUE class, VALUE bar)
weechat_bar_remove (script_str2ptr (c_bar));
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6911,20 +5409,9 @@ weechat_ruby_api_command (VALUE class, VALUE buffer, VALUE command)
{
char *c_buffer, *c_command;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "command");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "command", API_RETURN_ERROR);
if (NIL_P (buffer) || NIL_P (command))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "command");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (buffer, T_STRING);
Check_Type (command, T_STRING);
@@ -6937,7 +5424,7 @@ weechat_ruby_api_command (VALUE class, VALUE buffer, VALUE command)
script_str2ptr (c_buffer),
c_command);
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6950,20 +5437,9 @@ weechat_ruby_api_info_get (VALUE class, VALUE info_name, VALUE arguments)
char *c_info_name, *c_arguments;
const char *result;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "info_get");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "info_get", API_RETURN_EMPTY);
if (NIL_P (info_name) || NIL_P (arguments))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "info_get");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (info_name, T_STRING);
Check_Type (arguments, T_STRING);
@@ -6973,7 +5449,7 @@ weechat_ruby_api_info_get (VALUE class, VALUE info_name, VALUE arguments)
result = weechat_info_get (c_info_name, c_arguments);
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -6988,20 +5464,9 @@ weechat_ruby_api_info_get_hashtable (VALUE class, VALUE info_name,
struct t_hashtable *c_hashtable, *result_hashtable;
VALUE result_hash;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "info_get_hashtable");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "info_get_hashtable", API_RETURN_EMPTY);
if (NIL_P (info_name) || NIL_P (hash))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "info_get_hashtable");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (info_name, T_STRING);
Check_Type (hash, T_HASH);
@@ -7031,18 +5496,11 @@ weechat_ruby_api_infolist_new (VALUE class)
char *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "infolist_new");
- RUBY_RETURN_EMPTY;
- }
+ API_FUNC(1, "infolist_new", API_RETURN_EMPTY);
result = script_ptr2str (weechat_infolist_new ());
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7055,20 +5513,9 @@ weechat_ruby_api_infolist_new_item (VALUE class, VALUE infolist)
char *c_infolist, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "infolist_new_item");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_new_item", API_RETURN_EMPTY);
if (NIL_P (infolist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "infolist_new_item");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (infolist, T_STRING);
@@ -7076,7 +5523,7 @@ weechat_ruby_api_infolist_new_item (VALUE class, VALUE infolist)
result = script_ptr2str (weechat_infolist_new_item (script_str2ptr (c_infolist)));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7092,20 +5539,9 @@ weechat_ruby_api_infolist_new_var_integer (VALUE class, VALUE infolist,
int c_value;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "infolist_new_var_integer");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_new_var_integer", API_RETURN_EMPTY);
if (NIL_P (infolist) || NIL_P (name) || NIL_P (value))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "infolist_new_var_integer");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (infolist, T_STRING);
Check_Type (name, T_STRING);
@@ -7119,7 +5555,7 @@ weechat_ruby_api_infolist_new_var_integer (VALUE class, VALUE infolist,
c_name,
c_value));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7134,20 +5570,9 @@ weechat_ruby_api_infolist_new_var_string (VALUE class, VALUE infolist,
char *c_infolist, *c_name, *c_value, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "infolist_new_var_string");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_new_var_string", API_RETURN_EMPTY);
if (NIL_P (infolist) || NIL_P (name) || NIL_P (value))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "infolist_new_var_string");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (infolist, T_STRING);
Check_Type (name, T_STRING);
@@ -7161,7 +5586,7 @@ weechat_ruby_api_infolist_new_var_string (VALUE class, VALUE infolist,
c_name,
c_value));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7176,20 +5601,9 @@ weechat_ruby_api_infolist_new_var_pointer (VALUE class, VALUE infolist,
char *c_infolist, *c_name, *c_value, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "infolist_new_var_pointer");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_new_var_pointer", API_RETURN_EMPTY);
if (NIL_P (infolist) || NIL_P (name) || NIL_P (value))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "infolist_new_var_pointer");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (infolist, T_STRING);
Check_Type (name, T_STRING);
@@ -7203,7 +5617,7 @@ weechat_ruby_api_infolist_new_var_pointer (VALUE class, VALUE infolist,
c_name,
script_str2ptr (c_value)));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7218,20 +5632,9 @@ weechat_ruby_api_infolist_new_var_time (VALUE class, VALUE infolist,
int c_value;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "infolist_new_var_time");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_new_var_time", API_RETURN_EMPTY);
if (NIL_P (infolist) || NIL_P (name) || NIL_P (value))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "infolist_new_var_time");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (infolist, T_STRING);
Check_Type (name, T_STRING);
@@ -7245,7 +5648,7 @@ weechat_ruby_api_infolist_new_var_time (VALUE class, VALUE infolist,
c_name,
c_value));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7259,20 +5662,9 @@ weechat_ruby_api_infolist_get (VALUE class, VALUE name, VALUE pointer,
char *c_name, *c_pointer, *c_arguments, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "infolist_get");
- RUBY_RETURN_EMPTY;
- }
-
- if (NIL_P (name) || NIL_P (pointer))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "infolist_get");
- RUBY_RETURN_EMPTY;
- }
+ API_FUNC(1, "infolist_get", API_RETURN_EMPTY);
+ if (NIL_P (name) || NIL_P (pointer) || NIL_P (arguments))
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (name, T_STRING);
Check_Type (pointer, T_STRING);
@@ -7286,7 +5678,7 @@ weechat_ruby_api_infolist_get (VALUE class, VALUE name, VALUE pointer,
script_str2ptr (c_pointer),
c_arguments));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7299,20 +5691,9 @@ weechat_ruby_api_infolist_next (VALUE class, VALUE infolist)
char *c_infolist;
int value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "infolist_next");
- RUBY_RETURN_INT(0);
- }
-
+ API_FUNC(1, "infolist_next", API_RETURN_INT(0));
if (NIL_P (infolist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "infolist_next");
- RUBY_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (infolist, T_STRING);
@@ -7320,7 +5701,7 @@ weechat_ruby_api_infolist_next (VALUE class, VALUE infolist)
value = weechat_infolist_next (script_str2ptr (c_infolist));
- RUBY_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -7333,20 +5714,9 @@ weechat_ruby_api_infolist_prev (VALUE class, VALUE infolist)
char *c_infolist;
int value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "infolist_prev");
- RUBY_RETURN_INT(0);
- }
-
+ API_FUNC(1, "infolist_prev", API_RETURN_INT(0));
if (NIL_P (infolist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "infolist_prev");
- RUBY_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (infolist, T_STRING);
@@ -7354,7 +5724,7 @@ weechat_ruby_api_infolist_prev (VALUE class, VALUE infolist)
value = weechat_infolist_prev (script_str2ptr (c_infolist));
- RUBY_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -7367,20 +5737,9 @@ weechat_ruby_api_infolist_reset_item_cursor (VALUE class, VALUE infolist)
{
char *c_infolist;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "infolist_reset_item_cursor");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "infolist_reset_item_cursor", API_RETURN_ERROR);
if (NIL_P (infolist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "infolist_reset_item_cursor");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (infolist, T_STRING);
@@ -7388,7 +5747,7 @@ weechat_ruby_api_infolist_reset_item_cursor (VALUE class, VALUE infolist)
weechat_infolist_reset_item_cursor (script_str2ptr (c_infolist));
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -7401,20 +5760,9 @@ weechat_ruby_api_infolist_fields (VALUE class, VALUE infolist)
char *c_infolist;
const char *result;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "infolist_fields");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_fields", API_RETURN_EMPTY);
if (NIL_P (infolist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "infolist_fields");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (infolist, T_STRING);
@@ -7422,7 +5770,7 @@ weechat_ruby_api_infolist_fields (VALUE class, VALUE infolist)
result = weechat_infolist_fields (script_str2ptr (c_infolist));
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -7435,20 +5783,9 @@ weechat_ruby_api_infolist_integer (VALUE class, VALUE infolist, VALUE variable)
char *c_infolist, *c_variable;
int value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "infolist_integer");
- RUBY_RETURN_INT(0);
- }
-
+ API_FUNC(1, "infolist_integer", API_RETURN_INT(0));
if (NIL_P (infolist) || NIL_P (variable))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "infolist_integer");
- RUBY_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (infolist, T_STRING);
Check_Type (variable, T_STRING);
@@ -7458,7 +5795,7 @@ weechat_ruby_api_infolist_integer (VALUE class, VALUE infolist, VALUE variable)
value = weechat_infolist_integer (script_str2ptr (c_infolist), c_variable);
- RUBY_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -7471,20 +5808,9 @@ weechat_ruby_api_infolist_string (VALUE class, VALUE infolist, VALUE variable)
char *c_infolist, *c_variable;
const char *result;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "infolist_string");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_string", API_RETURN_EMPTY);
if (NIL_P (infolist) || NIL_P (variable))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "infolist_string");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (infolist, T_STRING);
Check_Type (variable, T_STRING);
@@ -7494,7 +5820,7 @@ weechat_ruby_api_infolist_string (VALUE class, VALUE infolist, VALUE variable)
result = weechat_infolist_string (script_str2ptr (c_infolist), c_variable);
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -7507,20 +5833,9 @@ weechat_ruby_api_infolist_pointer (VALUE class, VALUE infolist, VALUE variable)
char *c_infolist, *c_variable, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "infolist_pointer");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_pointer", API_RETURN_EMPTY);
if (NIL_P (infolist) || NIL_P (variable))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "infolist_pointer");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (infolist, T_STRING);
Check_Type (variable, T_STRING);
@@ -7530,7 +5845,7 @@ weechat_ruby_api_infolist_pointer (VALUE class, VALUE infolist, VALUE variable)
result = script_ptr2str (weechat_infolist_pointer (script_str2ptr (c_infolist), c_variable));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7544,20 +5859,9 @@ weechat_ruby_api_infolist_time (VALUE class, VALUE infolist, VALUE variable)
time_t time;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "infolist_time");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_time", API_RETURN_EMPTY);
if (NIL_P (infolist) || NIL_P (variable))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "infolist_time");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (infolist, T_STRING);
Check_Type (variable, T_STRING);
@@ -7569,7 +5873,7 @@ weechat_ruby_api_infolist_time (VALUE class, VALUE infolist, VALUE variable)
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
result = strdup (timebuffer);
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7581,20 +5885,9 @@ weechat_ruby_api_infolist_free (VALUE class, VALUE infolist)
{
char *c_infolist;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "infolist_free");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "infolist_free", API_RETURN_ERROR);
if (NIL_P (infolist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "infolist_free");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (infolist, T_STRING);
@@ -7602,7 +5895,7 @@ weechat_ruby_api_infolist_free (VALUE class, VALUE infolist)
weechat_infolist_free (script_str2ptr (c_infolist));
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -7615,20 +5908,9 @@ weechat_ruby_api_hdata_get (VALUE class, VALUE name)
char *c_name, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hdata_get");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_get", API_RETURN_EMPTY);
if (NIL_P (name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hdata_get");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (name, T_STRING);
@@ -7636,7 +5918,7 @@ weechat_ruby_api_hdata_get (VALUE class, VALUE name)
result = script_ptr2str (weechat_hdata_get (c_name));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7649,20 +5931,9 @@ weechat_ruby_api_hdata_get_var_offset (VALUE class, VALUE hdata, VALUE name)
char *c_hdata, *c_name;
int value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hdata_get_var_offset");
- RUBY_RETURN_INT(0);
- }
-
+ API_FUNC(1, "hdata_get_var_offset", API_RETURN_INT(0));
if (NIL_P (hdata) || NIL_P (name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hdata_get_var_offset");
- RUBY_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (hdata, T_STRING);
Check_Type (name, T_STRING);
@@ -7672,7 +5943,7 @@ weechat_ruby_api_hdata_get_var_offset (VALUE class, VALUE hdata, VALUE name)
value = weechat_hdata_get_var_offset (script_str2ptr (c_hdata), c_name);
- RUBY_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -7687,20 +5958,9 @@ weechat_ruby_api_hdata_get_var_type_string (VALUE class, VALUE hdata,
char *c_hdata, *c_name;
const char *result;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hdata_get_var_type_string");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_get_var_type_string", API_RETURN_EMPTY);
if (NIL_P (hdata) || NIL_P (name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hdata_get_var_type_string");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (hdata, T_STRING);
Check_Type (name, T_STRING);
@@ -7710,7 +5970,7 @@ weechat_ruby_api_hdata_get_var_type_string (VALUE class, VALUE hdata,
result = weechat_hdata_get_var_type_string (script_str2ptr (c_hdata), c_name);
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -7723,20 +5983,9 @@ weechat_ruby_api_hdata_get_var_hdata (VALUE class, VALUE hdata, VALUE name)
char *c_hdata, *c_name;
const char *result;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hdata_get_var_hdata");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_get_var_hdata", API_RETURN_EMPTY);
if (NIL_P (hdata) || NIL_P (name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hdata_get_var_hdata");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (hdata, T_STRING);
Check_Type (name, T_STRING);
@@ -7746,7 +5995,7 @@ weechat_ruby_api_hdata_get_var_hdata (VALUE class, VALUE hdata, VALUE name)
result = weechat_hdata_get_var_hdata (script_str2ptr (c_hdata), c_name);
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -7759,20 +6008,9 @@ weechat_ruby_api_hdata_get_list (VALUE class, VALUE hdata, VALUE name)
char *c_hdata, *c_name, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hdata_get_list");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_get_list", API_RETURN_EMPTY);
if (NIL_P (hdata) || NIL_P (name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hdata_get_list");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (hdata, T_STRING);
Check_Type (name, T_STRING);
@@ -7783,7 +6021,7 @@ weechat_ruby_api_hdata_get_list (VALUE class, VALUE hdata, VALUE name)
result = script_ptr2str (weechat_hdata_get_list (script_str2ptr (c_hdata),
c_name));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7798,20 +6036,9 @@ weechat_ruby_api_hdata_move (VALUE class, VALUE hdata, VALUE pointer,
int c_count;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hdata_move");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_move", API_RETURN_EMPTY);
if (NIL_P (hdata) || NIL_P (pointer) || NIL_P (count))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hdata_move");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (hdata, T_STRING);
Check_Type (pointer, T_STRING);
@@ -7825,7 +6052,7 @@ weechat_ruby_api_hdata_move (VALUE class, VALUE hdata, VALUE pointer,
script_str2ptr (c_pointer),
c_count);
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7840,20 +6067,9 @@ weechat_ruby_api_hdata_integer (VALUE class, VALUE hdata, VALUE pointer,
char *c_hdata, *c_pointer, *c_name;
int value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hdata_integer");
- RUBY_RETURN_INT(0);
- }
-
+ API_FUNC(1, "hdata_integer", API_RETURN_INT(0));
if (NIL_P (hdata) || NIL_P (pointer) || NIL_P (name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hdata_integer");
- RUBY_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (hdata, T_STRING);
Check_Type (pointer, T_STRING);
@@ -7867,7 +6083,7 @@ weechat_ruby_api_hdata_integer (VALUE class, VALUE hdata, VALUE pointer,
script_str2ptr (c_pointer),
c_name);
- RUBY_RETURN_INT(value);
+ API_RETURN_INT(value);
}
/*
@@ -7882,20 +6098,9 @@ weechat_ruby_api_hdata_long (VALUE class, VALUE hdata, VALUE pointer,
char *c_hdata, *c_pointer, *c_name;
long value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hdata_long");
- RUBY_RETURN_LONG(0);
- }
-
+ API_FUNC(1, "hdata_long", API_RETURN_LONG(0));
if (NIL_P (hdata) || NIL_P (pointer) || NIL_P (name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hdata_long");
- RUBY_RETURN_LONG(0);
- }
+ API_WRONG_ARGS(API_RETURN_LONG(0));
Check_Type (hdata, T_STRING);
Check_Type (pointer, T_STRING);
@@ -7909,7 +6114,7 @@ weechat_ruby_api_hdata_long (VALUE class, VALUE hdata, VALUE pointer,
script_str2ptr (c_pointer),
c_name);
- RUBY_RETURN_LONG(value);
+ API_RETURN_LONG(value);
}
/*
@@ -7924,20 +6129,9 @@ weechat_ruby_api_hdata_string (VALUE class, VALUE hdata, VALUE pointer,
char *c_hdata, *c_pointer, *c_name;
const char *result;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hdata_string");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_string", API_RETURN_EMPTY);
if (NIL_P (hdata) || NIL_P (pointer) || NIL_P (name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hdata_string");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (hdata, T_STRING);
Check_Type (pointer, T_STRING);
@@ -7951,7 +6145,7 @@ weechat_ruby_api_hdata_string (VALUE class, VALUE hdata, VALUE pointer,
script_str2ptr (c_pointer),
c_name);
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -7966,20 +6160,9 @@ weechat_ruby_api_hdata_pointer (VALUE class, VALUE hdata, VALUE pointer,
char *c_hdata, *c_pointer, *c_name, *result;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hdata_pointer");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_pointer", API_RETURN_EMPTY);
if (NIL_P (hdata) || NIL_P (pointer) || NIL_P (name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hdata_pointer");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (hdata, T_STRING);
Check_Type (pointer, T_STRING);
@@ -7993,7 +6176,7 @@ weechat_ruby_api_hdata_pointer (VALUE class, VALUE hdata, VALUE pointer,
script_str2ptr (c_pointer),
c_name));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -8009,20 +6192,9 @@ weechat_ruby_api_hdata_time (VALUE class, VALUE hdata, VALUE pointer,
time_t time;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hdata_time");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_time", API_RETURN_EMPTY);
if (NIL_P (hdata) || NIL_P (pointer) || NIL_P (name))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hdata_time");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (hdata, T_STRING);
Check_Type (pointer, T_STRING);
@@ -8038,7 +6210,7 @@ weechat_ruby_api_hdata_time (VALUE class, VALUE hdata, VALUE pointer,
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
result = strdup (timebuffer);
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -8051,20 +6223,9 @@ weechat_ruby_api_hdata_get_string (VALUE class, VALUE hdata, VALUE property)
char *c_hdata, *c_property;
const char *result;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hdata_get_string");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_get_string", API_RETURN_EMPTY);
if (NIL_P (hdata) || NIL_P (property))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hdata_get_string");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (hdata, T_STRING);
Check_Type (property, T_STRING);
@@ -8075,7 +6236,7 @@ weechat_ruby_api_hdata_get_string (VALUE class, VALUE hdata, VALUE property)
result = weechat_hdata_get_var_type_string (script_str2ptr (c_hdata),
c_property);
- RUBY_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -8089,20 +6250,9 @@ weechat_ruby_api_upgrade_new (VALUE class, VALUE filename, VALUE write)
int c_write;
VALUE return_value;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "upgrade_new");
- RUBY_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "upgrade_new", API_RETURN_EMPTY);
if (NIL_P (filename) || NIL_P (write))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "upgrade_new");
- RUBY_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (filename, T_STRING);
Check_Type (write, T_FIXNUM);
@@ -8113,7 +6263,7 @@ weechat_ruby_api_upgrade_new (VALUE class, VALUE filename, VALUE write)
result = script_ptr2str (weechat_upgrade_new (c_filename,
c_write));
- RUBY_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -8127,20 +6277,9 @@ weechat_ruby_api_upgrade_write_object (VALUE class, VALUE upgrade_file,
char *c_upgrade_file, *c_infolist;
int c_object_id, rc;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "upgrade_write_object");
- RUBY_RETURN_INT(0);
- }
-
+ API_FUNC(1, "upgrade_write_object", API_RETURN_INT(0));
if (NIL_P (upgrade_file) || NIL_P (object_id) || NIL_P (infolist))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "upgrade_write_object");
- RUBY_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (upgrade_file, T_STRING);
Check_Type (object_id, T_FIXNUM);
@@ -8154,7 +6293,7 @@ weechat_ruby_api_upgrade_write_object (VALUE class, VALUE upgrade_file,
c_object_id,
script_str2ptr (c_infolist));
- RUBY_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -8168,7 +6307,7 @@ weechat_ruby_api_upgrade_read_cb (void *data,
struct t_infolist *infolist)
{
struct t_script_callback *script_callback;
- void *ruby_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' }, str_object_id[32];
int *rc, ret;
@@ -8178,15 +6317,15 @@ weechat_ruby_api_upgrade_read_cb (void *data,
{
snprintf (str_object_id, sizeof (str_object_id), "%d", object_id);
- ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- ruby_argv[1] = script_ptr2str (upgrade_file);
- ruby_argv[2] = str_object_id;
- ruby_argv[3] = script_ptr2str (infolist);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (upgrade_file);
+ func_argv[2] = str_object_id;
+ func_argv[3] = script_ptr2str (infolist);
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ssss", ruby_argv);
+ "ssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -8195,10 +6334,10 @@ weechat_ruby_api_upgrade_read_cb (void *data,
ret = *rc;
free (rc);
}
- if (ruby_argv[1])
- free (ruby_argv[1]);
- if (ruby_argv[3])
- free (ruby_argv[3]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[3])
+ free (func_argv[3]);
return ret;
}
@@ -8217,20 +6356,9 @@ weechat_ruby_api_upgrade_read (VALUE class, VALUE upgrade_file,
char *c_upgrade_file, *c_function, *c_data;
int rc;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "upgrade_read");
- RUBY_RETURN_INT(0);
- }
-
+ API_FUNC(1, "upgrade_read", API_RETURN_INT(0));
if (NIL_P (upgrade_file) || NIL_P (function) || NIL_P (data))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "upgrade_read");
- RUBY_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (upgrade_file, T_STRING);
Check_Type (function, T_STRING);
@@ -8247,7 +6375,7 @@ weechat_ruby_api_upgrade_read (VALUE class, VALUE upgrade_file,
c_function,
c_data);
- RUBY_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -8259,20 +6387,9 @@ weechat_ruby_api_upgrade_close (VALUE class, VALUE upgrade_file)
{
char *c_upgrade_file;
- /* make C compiler happy */
- (void) class;
-
- if (!ruby_current_script || !ruby_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "upgrade_close");
- RUBY_RETURN_ERROR;
- }
-
+ API_FUNC(1, "upgrade_close", API_RETURN_ERROR);
if (NIL_P (upgrade_file))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "upgrade_close");
- RUBY_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
Check_Type (upgrade_file, T_STRING);
@@ -8280,7 +6397,7 @@ weechat_ruby_api_upgrade_close (VALUE class, VALUE upgrade_file)
weechat_upgrade_close (script_str2ptr (c_upgrade_file));
- RUBY_RETURN_OK;
+ API_RETURN_OK;
}
/*
diff --git a/src/plugins/scripts/ruby/weechat-ruby.c b/src/plugins/scripts/ruby/weechat-ruby.c
index a9c8681e9..b922de84f 100644
--- a/src/plugins/scripts/ruby/weechat-ruby.c
+++ b/src/plugins/scripts/ruby/weechat-ruby.c
@@ -327,7 +327,7 @@ weechat_ruby_exec (struct t_plugin_script *script,
argv2[i] = INT2FIX (*((int *)argv[i]));
break;
case 'h': /* hash */
- argv2[i] = (VALUE)argv[i];
+ argv2[i] = weechat_ruby_hashtable_to_hash (argv[i]);
break;
}
}
@@ -615,7 +615,7 @@ weechat_ruby_load_cb (void *data, const char *filename)
void
weechat_ruby_unload (struct t_plugin_script *script)
{
- int *r;
+ int *rc;
void *interpreter;
if ((weechat_ruby_plugin->debug >= 1) || !ruby_quiet)
@@ -627,12 +627,12 @@ weechat_ruby_unload (struct t_plugin_script *script)
if (script->shutdown_func && script->shutdown_func[0])
{
- r = (int *) weechat_ruby_exec (script,
+ rc = (int *)weechat_ruby_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
script->shutdown_func,
0, NULL);
- if (r)
- free (r);
+ if (rc)
+ free (rc);
}
interpreter = script->interpreter;
diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c
index 286d12864..949f60ed9 100644
--- a/src/plugins/scripts/tcl/weechat-tcl-api.c
+++ b/src/plugins/scripts/tcl/weechat-tcl-api.c
@@ -36,7 +36,24 @@
#include "../script-callback.h"
#include "weechat-tcl.h"
-#define TCL_RETURN_OK \
+
+#define API_FUNC(__init, __name, __ret) \
+ char *tcl_function_name = __name; \
+ (void) clientData; \
+ if (__init \
+ && (!tcl_current_script || !tcl_current_script->name)) \
+ { \
+ WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, \
+ tcl_function_name); \
+ __ret; \
+ }
+#define API_WRONG_ARGS(__ret) \
+ { \
+ WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, \
+ tcl_function_name); \
+ __ret; \
+ }
+#define API_RETURN_OK \
{ \
objp = Tcl_GetObjResult (interp); \
if (Tcl_IsShared (objp)) \
@@ -51,7 +68,7 @@
Tcl_SetIntObj (objp, 1); \
return TCL_OK; \
}
-#define TCL_RETURN_ERROR \
+#define API_RETURN_ERROR \
{ \
objp = Tcl_GetObjResult (interp); \
if (Tcl_IsShared (objp)) \
@@ -66,7 +83,7 @@
Tcl_SetIntObj (objp, 0); \
return TCL_ERROR; \
}
-#define TCL_RETURN_EMPTY \
+#define API_RETURN_EMPTY \
{ \
objp = Tcl_GetObjResult (interp); \
if (Tcl_IsShared (objp)) \
@@ -81,7 +98,7 @@
Tcl_SetStringObj (objp, "", -1); \
return TCL_OK; \
}
-#define TCL_RETURN_STRING(__string) \
+#define API_RETURN_STRING(__string) \
{ \
objp = Tcl_GetObjResult (interp); \
if (Tcl_IsShared (objp)) \
@@ -110,7 +127,7 @@
} \
return TCL_OK; \
}
-#define TCL_RETURN_STRING_FREE(__string) \
+#define API_RETURN_STRING_FREE(__string) \
{ \
objp = Tcl_GetObjResult (interp); \
if (Tcl_IsShared (objp)) \
@@ -141,7 +158,7 @@
} \
return TCL_OK; \
}
-#define TCL_RETURN_INT(__int) \
+#define API_RETURN_INT(__int) \
{ \
objp = Tcl_GetObjResult (interp); \
if (Tcl_IsShared (objp)) \
@@ -156,7 +173,7 @@
Tcl_SetIntObj (objp, __int); \
return TCL_OK; \
}
-#define TCL_RETURN_LONG(__long) \
+#define API_RETURN_LONG(__long) \
{ \
objp = Tcl_GetObjResult (interp); \
if (Tcl_IsShared (objp)) \
@@ -171,7 +188,7 @@
Tcl_SetLongObj (objp, __long); \
return TCL_OK; \
}
-#define TCL_RETURN_OBJ(__obj) \
+#define API_RETURN_OBJ(__obj) \
{ \
Tcl_SetObjResult (interp, __obj); \
return TCL_OK; \
@@ -186,21 +203,17 @@ static int
weechat_tcl_api_register (ClientData clientData, Tcl_Interp *interp, int objc,
Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *name, *author, *version, *license, *description, *shutdown_func;
char *charset;
int i;
- (void) clientData;
-
+ API_FUNC(0, "register", API_RETURN_ERROR);
tcl_current_script = NULL;
tcl_registered_script = NULL;
if (objc < 8)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(tcl_current_script_filename, "register");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
name = Tcl_GetStringFromObj (objv[1], &i);
author = Tcl_GetStringFromObj (objv[2], &i);
@@ -218,7 +231,7 @@ weechat_tcl_api_register (ClientData clientData, Tcl_Interp *interp, int objc,
"\"%s\" (another script already "
"exists with this name)"),
weechat_prefix ("error"), TCL_PLUGIN_NAME, name);
- TCL_RETURN_ERROR;
+ API_RETURN_ERROR;
}
/* register script */
@@ -242,10 +255,10 @@ weechat_tcl_api_register (ClientData clientData, Tcl_Interp *interp, int objc,
}
else
{
- TCL_RETURN_ERROR;
+ API_RETURN_ERROR;
}
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -257,31 +270,20 @@ static int
weechat_tcl_api_plugin_get_name (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *plugin;
const char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "plugin_get_name");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "plugin_get_name", API_RETURN_EMPTY);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "plugin_get_name");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
plugin = Tcl_GetStringFromObj (objv[1], &i);
result = weechat_plugin_get_name (script_str2ptr (plugin));
- TCL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -292,28 +294,17 @@ static int
weechat_tcl_api_charset_set (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "charset_set");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "charset_set", API_RETURN_ERROR);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "charset_set");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_charset_set (tcl_current_script,
Tcl_GetStringFromObj (objv[1], &i)); /* charset */
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -325,31 +316,20 @@ static int
weechat_tcl_api_iconv_to_internal (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *result, *charset, *string;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "iconv_to_internal");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "iconv_to_internal", API_RETURN_EMPTY);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "iconv_to_internal");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
charset = Tcl_GetStringFromObj (objv[1], &i);
string = Tcl_GetStringFromObj (objv[2], &i);
result = weechat_iconv_to_internal (charset, string);
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -361,31 +341,20 @@ static int
weechat_tcl_api_iconv_from_internal (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *result, *charset, *string;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "iconv_from_internal");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "iconv_from_internal", API_RETURN_EMPTY);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "iconv_from_internal");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
charset = Tcl_GetStringFromObj (objv[1], &i);
string = Tcl_GetStringFromObj (objv[2], &i);
result = weechat_iconv_from_internal (charset, string);
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -396,28 +365,17 @@ static int
weechat_tcl_api_gettext (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
const char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "gettext");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "gettext", API_RETURN_EMPTY);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "gettext");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_gettext (Tcl_GetStringFromObj (objv[1], &i)); /* string */
- TCL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -428,38 +386,24 @@ static int
weechat_tcl_api_ngettext (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *single, *plural;
const char *result;
int i, count;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "ngettext");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "ngettext", API_RETURN_EMPTY);
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "ngettext");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
single = Tcl_GetStringFromObj (objv[1], &i);
plural = Tcl_GetStringFromObj (objv[2], &i);
if (Tcl_GetIntFromObj (interp, objv[3], &count) != TCL_OK)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "ngettext");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_ngettext (single, plural, count);
- TCL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -472,37 +416,23 @@ static int
weechat_tcl_api_string_match (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *string, *mask;
int case_sensitive, result, i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "string_match");
- TCL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "string_match", API_RETURN_INT(0));
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "string_match");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
string = Tcl_GetStringFromObj (objv[1], &i);
mask = Tcl_GetStringFromObj (objv[2], &i);
if (Tcl_GetIntFromObj (interp, objv[3], &case_sensitive) != TCL_OK)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "string_match");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
result = weechat_string_match (string, mask, case_sensitive);
- TCL_RETURN_INT(result);
+ API_RETURN_INT(result);
}
/*
@@ -518,31 +448,20 @@ weechat_tcl_api_string_has_highlight (ClientData clientData,
Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *string, *highlight_words;
int result, i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "string_has_highlight");
- TCL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "string_has_highlight", API_RETURN_INT(0));
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "string_has_highlight");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
string = Tcl_GetStringFromObj (objv[1], &i);
highlight_words = Tcl_GetStringFromObj (objv[2], &i);
result = weechat_string_has_highlight (string, highlight_words);
- TCL_RETURN_INT(result);
+ API_RETURN_INT(result);
}
/*
@@ -558,31 +477,20 @@ weechat_tcl_api_string_has_highlight_regex (ClientData clientData,
Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *string, *regex;
int result, i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "string_has_highlight_regex");
- TCL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "string_has_highlight_regex", API_RETURN_INT(0));
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "string_has_highlight_regex");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
string = Tcl_GetStringFromObj (objv[1], &i);
regex = Tcl_GetStringFromObj (objv[2], &i);
result = weechat_string_has_highlight_regex (string, regex);
- TCL_RETURN_INT(result);
+ API_RETURN_INT(result);
}
/*
@@ -597,30 +505,19 @@ weechat_tcl_api_string_mask_to_regex (ClientData clientData,
Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *result, *mask;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "string_mask_to_regex");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "string_mask_to_regex", API_RETURN_EMPTY);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "string_mask_to_regex");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
mask = Tcl_GetStringFromObj (objv[1], &i);
result = weechat_string_mask_to_regex (mask);
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -631,31 +528,20 @@ static int
weechat_tcl_api_string_remove_color (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *result, *replacement, *string;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "string_remove_color");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "string_remove_color", API_RETURN_EMPTY);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "string_remove_color");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
string = Tcl_GetStringFromObj (objv[1], &i);
replacement = Tcl_GetStringFromObj (objv[2], &i);
result = weechat_string_remove_color (string, replacement);
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -667,27 +553,16 @@ static int
weechat_tcl_api_string_is_command_char (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
int result, i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "string_is_command_char");
- TCL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "string_is_command_char", API_RETURN_INT(0));
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "string_is_command_char");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
result = weechat_string_is_command_char (Tcl_GetStringFromObj (objv[1], &i)); /* string */
- TCL_RETURN_INT(result);
+ API_RETURN_INT(result);
}
/*
@@ -700,28 +575,17 @@ static int
weechat_tcl_api_string_input_for_buffer (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
const char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "string_input_for_buffer");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "string_input_for_buffer", API_RETURN_EMPTY);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "string_input_for_buffer");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_string_input_for_buffer (Tcl_GetStringFromObj (objv[1], &i));
- TCL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -732,35 +596,21 @@ static int
weechat_tcl_api_mkdir_home (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
int i, mode;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "mkdir_home");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "mkdir_home", API_RETURN_ERROR);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "mkdir_home");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
if (Tcl_GetIntFromObj (interp, objv[2], &mode) != TCL_OK)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "mkdir_home");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
if (weechat_mkdir_home (Tcl_GetStringFromObj (objv[1], &i), /* directory */
mode))
- TCL_RETURN_OK;
+ API_RETURN_OK;
- TCL_RETURN_ERROR;
+ API_RETURN_ERROR;
}
/*
@@ -771,35 +621,21 @@ static int
weechat_tcl_api_mkdir (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
int i, mode;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "mkdir");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "mkdir", API_RETURN_ERROR);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "mkdir");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
if (Tcl_GetIntFromObj (interp, objv[2], &mode) != TCL_OK)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "mkdir");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
if (weechat_mkdir (Tcl_GetStringFromObj (objv[1], &i), /* directory */
mode))
- TCL_RETURN_OK;
+ API_RETURN_OK;
- TCL_RETURN_ERROR;
+ API_RETURN_ERROR;
}
/*
@@ -811,35 +647,21 @@ static int
weechat_tcl_api_mkdir_parents (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
int i, mode;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "mkdir_parents");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "mkdir_parents", API_RETURN_ERROR);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "mkdir_parents");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
if (Tcl_GetIntFromObj (interp, objv[2], &mode) != TCL_OK)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "mkdir_parents");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
if (weechat_mkdir_parents (Tcl_GetStringFromObj (objv[1], &i), /* directory */
mode))
- TCL_RETURN_OK;
+ API_RETURN_OK;
- TCL_RETURN_ERROR;
+ API_RETURN_ERROR;
}
/*
@@ -850,7 +672,7 @@ static int
weechat_tcl_api_list_new (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *result;
/* make C compiler happy */
@@ -858,15 +680,11 @@ weechat_tcl_api_list_new (ClientData clientData, Tcl_Interp *interp,
(void) objc;
(void) objv;
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "list_new");
- TCL_RETURN_EMPTY;
- }
+ API_FUNC(1, "list_new", API_RETURN_EMPTY);
result = script_ptr2str (weechat_list_new ());
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -877,25 +695,14 @@ static int
weechat_tcl_api_list_add (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *result, *weelist, *data, *where, *user_data;
int i;
- /* make C compiler happy */
- (void) clientData;
-
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "list_add");
- TCL_RETURN_EMPTY;
- }
+ API_FUNC(1, "list_add", API_RETURN_EMPTY);
if (objc < 5)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "list_add");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
weelist = Tcl_GetStringFromObj (objv[1], &i);
data = Tcl_GetStringFromObj (objv[2], &i);
@@ -907,7 +714,7 @@ weechat_tcl_api_list_add (ClientData clientData, Tcl_Interp *interp,
where,
script_str2ptr (user_data)));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -918,24 +725,13 @@ static int
weechat_tcl_api_list_search (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *result, *weelist, *data;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "list_search");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "list_search", API_RETURN_EMPTY);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "list_search");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
weelist = Tcl_GetStringFromObj (objv[1], &i);
data = Tcl_GetStringFromObj (objv[2], &i);
@@ -943,7 +739,7 @@ weechat_tcl_api_list_search (ClientData clientData, Tcl_Interp *interp,
result = script_ptr2str (weechat_list_search (script_str2ptr (weelist),
data));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -954,31 +750,20 @@ static int
weechat_tcl_api_list_search_pos (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *weelist, *data;
int i, pos;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "list_search_pos");
- TCL_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "list_search_pos", API_RETURN_INT(-1));
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "list_search_pos");
- TCL_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
weelist = Tcl_GetStringFromObj (objv[1], &i);
data = Tcl_GetStringFromObj (objv[2], &i);
pos = weechat_list_search_pos (script_str2ptr (weelist), data);
- TCL_RETURN_INT(pos);
+ API_RETURN_INT(pos);
}
/*
@@ -989,24 +774,13 @@ static int
weechat_tcl_api_list_casesearch (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *result, *weelist, *data;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "list_casesearch");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "list_casesearch", API_RETURN_EMPTY);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "list_casesearch");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
weelist = Tcl_GetStringFromObj (objv[1], &i);
data = Tcl_GetStringFromObj (objv[2], &i);
@@ -1014,7 +788,7 @@ weechat_tcl_api_list_casesearch (ClientData clientData, Tcl_Interp *interp,
result = script_ptr2str (weechat_list_casesearch (script_str2ptr (weelist),
data));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1026,31 +800,20 @@ static int
weechat_tcl_api_list_casesearch_pos (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *weelist, *data;
int i, pos;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "list_casesearch_pos");
- TCL_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "list_casesearch_pos", API_RETURN_INT(-1));
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "list_casesearch_pos");
- TCL_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
weelist = Tcl_GetStringFromObj (objv[1], &i);
data = Tcl_GetStringFromObj (objv[2], &i);
pos = weechat_list_casesearch_pos (script_str2ptr (weelist), data);
- TCL_RETURN_INT(pos);
+ API_RETURN_INT(pos);
}
/*
@@ -1061,35 +824,21 @@ static int
weechat_tcl_api_list_get (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *result;
int i, position;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "list_get");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "list_get", API_RETURN_EMPTY);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "list_get");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
if (Tcl_GetIntFromObj (interp, objv[2], &position) != TCL_OK)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "list_get");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_list_get (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)), /* weelist */
position));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1100,31 +849,20 @@ static int
weechat_tcl_api_list_set (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *item, *new_value;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "list_set");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "list_set", API_RETURN_ERROR);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "list_set");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
item = Tcl_GetStringFromObj (objv[1], &i);
new_value = Tcl_GetStringFromObj (objv[2], &i);
weechat_list_set (script_str2ptr (item), new_value);
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -1135,28 +873,17 @@ static int
weechat_tcl_api_list_next (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "list_next");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "list_next", API_RETURN_EMPTY);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "list_next");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_list_next (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)))); /* item */
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1167,28 +894,17 @@ static int
weechat_tcl_api_list_prev (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "list_prev");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "list_prev", API_RETURN_EMPTY);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "list_prev");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_list_prev (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)))); /* item */
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1199,28 +915,17 @@ static int
weechat_tcl_api_list_string (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
const char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "list_string");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "list_string", API_RETURN_EMPTY);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "list_string");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_list_string (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* item */
- TCL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -1231,28 +936,17 @@ static int
weechat_tcl_api_list_size (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
int size;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "list_size");
- TCL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "list_size", API_RETURN_INT(0));
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "list_size");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
size = weechat_list_size (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* weelist */
- TCL_RETURN_INT(size);
+ API_RETURN_INT(size);
}
/*
@@ -1263,31 +957,20 @@ static int
weechat_tcl_api_list_remove (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *weelist, *item;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "list_remove");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "list_remove", API_RETURN_ERROR);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "list_remove");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weelist = Tcl_GetStringFromObj (objv[1], &i);
item = Tcl_GetStringFromObj (objv[2], &i);
weechat_list_remove (script_str2ptr (weelist), script_str2ptr (item));
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -1298,26 +981,18 @@ static int
weechat_tcl_api_list_remove_all (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
int i;
(void) clientData;
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "list_remove_all");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "list_remove_all", API_RETURN_ERROR);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "list_remove_all");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_list_remove_all (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* weelist */
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -1328,27 +1003,16 @@ static int
weechat_tcl_api_list_free (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "list_free");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "list_free", API_RETURN_ERROR);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "list_free");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_list_free (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* weelist */
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -1360,7 +1024,7 @@ weechat_tcl_api_config_reload_cb (void *data,
struct t_config_file *config_file)
{
struct t_script_callback *script_callback;
- void *tcl_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1369,13 +1033,13 @@ weechat_tcl_api_config_reload_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = script_ptr2str (config_file);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", tcl_argv);
+ "ss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
@@ -1384,8 +1048,8 @@ weechat_tcl_api_config_reload_cb (void *data,
ret = *rc;
free (rc);
}
- if (tcl_argv[1])
- free (tcl_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -1401,24 +1065,13 @@ static int
weechat_tcl_api_config_new (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *result, *name, *function, *data;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_new");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_new", API_RETURN_EMPTY);
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_new");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
name = Tcl_GetStringFromObj (objv[1], &i);
function = Tcl_GetStringFromObj (objv[2], &i);
@@ -1431,7 +1084,7 @@ weechat_tcl_api_config_new (ClientData clientData, Tcl_Interp *interp,
function,
data));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1446,7 +1099,7 @@ weechat_tcl_api_config_section_read_cb (void *data,
const char *option_name, const char *value)
{
struct t_script_callback *script_callback;
- void *tcl_argv[5];
+ void *func_argv[5];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1454,16 +1107,16 @@ weechat_tcl_api_config_section_read_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = script_ptr2str (config_file);
- tcl_argv[2] = script_ptr2str (section);
- tcl_argv[3] = (option_name) ? (char *)option_name : empty_arg;
- tcl_argv[4] = (value) ? (char *)value : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
+ func_argv[2] = script_ptr2str (section);
+ func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
+ func_argv[4] = (value) ? (char *)value : empty_arg;
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sssss", tcl_argv);
+ "sssss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
@@ -1472,10 +1125,10 @@ weechat_tcl_api_config_section_read_cb (void *data,
ret = *rc;
free (rc);
}
- if (tcl_argv[1])
- free (tcl_argv[1]);
- if (tcl_argv[2])
- free (tcl_argv[2]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[2])
+ free (func_argv[2]);
return ret;
}
@@ -1493,7 +1146,7 @@ weechat_tcl_api_config_section_write_cb (void *data,
const char *section_name)
{
struct t_script_callback *script_callback;
- void *tcl_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1501,14 +1154,14 @@ weechat_tcl_api_config_section_write_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = script_ptr2str (config_file);
- tcl_argv[2] = (section_name) ? (char *)section_name : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
+ func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", tcl_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_WRITE_ERROR;
@@ -1517,8 +1170,8 @@ weechat_tcl_api_config_section_write_cb (void *data,
ret = *rc;
free (rc);
}
- if (tcl_argv[1])
- free (tcl_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -1537,7 +1190,7 @@ weechat_tcl_api_config_section_write_default_cb (void *data,
const char *section_name)
{
struct t_script_callback *script_callback;
- void *tcl_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1545,14 +1198,14 @@ weechat_tcl_api_config_section_write_default_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = script_ptr2str (config_file);
- tcl_argv[2] = (section_name) ? (char *)section_name : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
+ func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", tcl_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_WRITE_ERROR;
@@ -1561,8 +1214,8 @@ weechat_tcl_api_config_section_write_default_cb (void *data,
ret = *rc;
free (rc);
}
- if (tcl_argv[1])
- free (tcl_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -1583,7 +1236,7 @@ weechat_tcl_api_config_section_create_option_cb (void *data,
const char *value)
{
struct t_script_callback *script_callback;
- void *tcl_argv[5];
+ void *func_argv[5];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1591,16 +1244,16 @@ weechat_tcl_api_config_section_create_option_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = script_ptr2str (config_file);
- tcl_argv[2] = script_ptr2str (section);
- tcl_argv[3] = (option_name) ? (char *)option_name : empty_arg;
- tcl_argv[4] = (value) ? (char *)value : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
+ func_argv[2] = script_ptr2str (section);
+ func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
+ func_argv[4] = (value) ? (char *)value : empty_arg;
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sssss", tcl_argv);
+ "sssss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
@@ -1609,10 +1262,10 @@ weechat_tcl_api_config_section_create_option_cb (void *data,
ret = *rc;
free (rc);
}
- if (tcl_argv[1])
- free (tcl_argv[1]);
- if (tcl_argv[2])
- free (tcl_argv[2]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[2])
+ free (func_argv[2]);
return ret;
}
@@ -1632,7 +1285,7 @@ weechat_tcl_api_config_section_delete_option_cb (void *data,
struct t_config_option *option)
{
struct t_script_callback *script_callback;
- void *tcl_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1640,15 +1293,15 @@ weechat_tcl_api_config_section_delete_option_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = script_ptr2str (config_file);
- tcl_argv[2] = script_ptr2str (section);
- tcl_argv[3] = script_ptr2str (option);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (config_file);
+ func_argv[2] = script_ptr2str (section);
+ func_argv[3] = script_ptr2str (option);
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ssss", tcl_argv);
+ "ssss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_OPTION_UNSET_ERROR;
@@ -1657,12 +1310,12 @@ weechat_tcl_api_config_section_delete_option_cb (void *data,
ret = *rc;
free (rc);
}
- if (tcl_argv[1])
- free (tcl_argv[1]);
- if (tcl_argv[2])
- free (tcl_argv[2]);
- if (tcl_argv[3])
- free (tcl_argv[3]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[2])
+ free (func_argv[2]);
+ if (func_argv[3])
+ free (func_argv[3]);
return ret;
}
@@ -1679,7 +1332,7 @@ static int
weechat_tcl_api_config_new_section (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *result, *cfg_file, *name, *function_read, *data_read;
char *function_write, *data_write, *function_write_default;
char *data_write_default, *function_create_option, *data_create_option;
@@ -1689,24 +1342,13 @@ weechat_tcl_api_config_new_section (ClientData clientData, Tcl_Interp *interp,
/* make C compiler happy */
(void) clientData;
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_new_section");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_new_section", API_RETURN_EMPTY);
if (objc < 15)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_new_section");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
if ((Tcl_GetIntFromObj (interp, objv[3], &can_add) != TCL_OK)
|| (Tcl_GetIntFromObj (interp, objv[4], &can_delete) != TCL_OK))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_new_section");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
cfg_file = Tcl_GetStringFromObj (objv[1], &i);
name = Tcl_GetStringFromObj (objv[2], &i);
@@ -1743,7 +1385,7 @@ weechat_tcl_api_config_new_section (ClientData clientData, Tcl_Interp *interp,
function_delete_option,
data_delete_option));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1754,24 +1396,13 @@ static int
weechat_tcl_api_config_search_section (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *result, *config_file, *section_name;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_search_section");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_search_section", API_RETURN_EMPTY);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_search_section");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
config_file = Tcl_GetStringFromObj (objv[1], &i);
section_name = Tcl_GetStringFromObj (objv[2], &i);
@@ -1779,7 +1410,7 @@ weechat_tcl_api_config_search_section (ClientData clientData, Tcl_Interp *interp
result = script_ptr2str (weechat_config_search_section (script_str2ptr (config_file),
section_name));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
@@ -1794,7 +1425,7 @@ weechat_tcl_api_config_option_check_value_cb (void *data,
const char *value)
{
struct t_script_callback *script_callback;
- void *tcl_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -1802,14 +1433,14 @@ weechat_tcl_api_config_option_check_value_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = script_ptr2str (option);
- tcl_argv[2] = (value) ? (char *)value : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (option);
+ func_argv[2] = (value) ? (char *)value : empty_arg;
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", tcl_argv);
+ "sss", func_argv);
if (!rc)
ret = 0;
@@ -1818,8 +1449,8 @@ weechat_tcl_api_config_option_check_value_cb (void *data,
ret = *rc;
free (rc);
}
- if (tcl_argv[1])
- free (tcl_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -1836,7 +1467,7 @@ weechat_tcl_api_config_option_change_cb (void *data,
struct t_config_option *option)
{
struct t_script_callback *script_callback;
- void *tcl_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc;
@@ -1844,16 +1475,16 @@ weechat_tcl_api_config_option_change_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = script_ptr2str (option);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (option);
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", tcl_argv);
+ "ss", func_argv);
- if (tcl_argv[1])
- free (tcl_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
if (rc)
free (rc);
@@ -1869,7 +1500,7 @@ weechat_tcl_api_config_option_delete_cb (void *data,
struct t_config_option *option)
{
struct t_script_callback *script_callback;
- void *tcl_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc;
@@ -1877,16 +1508,16 @@ weechat_tcl_api_config_option_delete_cb (void *data,
if (script_callback && script_callback->function && script_callback->function[0])
{
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = script_ptr2str (option);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (option);
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", tcl_argv);
+ "ss", func_argv);
- if (tcl_argv[1])
- free (tcl_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
if (rc)
free (rc);
@@ -1901,35 +1532,21 @@ static int
weechat_tcl_api_config_new_option (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *result, *config_file, *section, *name, *type;
char *description, *string_values, *default_value, *value;
char *function_check_value, *data_check_value, *function_change;
char *data_change, *function_delete, *data_delete;
int i, min, max, null_value_allowed;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_new_option");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_new_option", API_RETURN_EMPTY);
if (objc < 18)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_new_option");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
if ((Tcl_GetIntFromObj (interp, objv[7], &min) != TCL_OK)
|| (Tcl_GetIntFromObj (interp, objv[8], &max) != TCL_OK)
|| (Tcl_GetIntFromObj (interp, objv[11], &null_value_allowed) != TCL_OK))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_new_option");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
config_file = Tcl_GetStringFromObj (objv[1], &i);
section = Tcl_GetStringFromObj (objv[2], &i);
@@ -1969,7 +1586,7 @@ weechat_tcl_api_config_new_option (ClientData clientData, Tcl_Interp *interp,
function_delete,
data_delete));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -1981,24 +1598,13 @@ static int
weechat_tcl_api_config_search_option (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *result, *config_file, *section, *option_name;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_search_option");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_search_option", API_RETURN_EMPTY);
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_search_option");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
config_file = Tcl_GetStringFromObj (objv[1], &i);
section = Tcl_GetStringFromObj (objv[2], &i);
@@ -2008,7 +1614,7 @@ weechat_tcl_api_config_search_option (ClientData clientData, Tcl_Interp *interp,
script_str2ptr (section),
option_name));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -2019,27 +1625,16 @@ static int
weechat_tcl_api_config_string_to_boolean (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
int result, i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_string_to_boolean");
- TCL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_string_to_boolean", API_RETURN_INT(0));
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_string_to_boolean");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
result = weechat_config_string_to_boolean (Tcl_GetStringFromObj (objv[1], &i)); /* text */
- TCL_RETURN_INT(result);
+ API_RETURN_INT(result);
}
/*
@@ -2050,38 +1645,24 @@ static int
weechat_tcl_api_config_option_reset (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
int rc;
char *option;
int i, run_callback;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_option_reset");
- TCL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_option_reset", API_RETURN_INT(0));
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_option_reset");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
if (Tcl_GetIntFromObj (interp, objv[2], &run_callback) != TCL_OK)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_option_reset");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
option = Tcl_GetStringFromObj (objv[1], &i);
rc = weechat_config_option_reset (script_str2ptr (option),
run_callback);
- TCL_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2092,31 +1673,17 @@ static int
weechat_tcl_api_config_option_set (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
int rc;
char *option, *new_value;
int i, run_callback;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_option_set");
- TCL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
-
+ API_FUNC(1, "config_option_set", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_option_set");
- TCL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
if (Tcl_GetIntFromObj (interp, objv[3], &run_callback) != TCL_OK)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_option_set");
- TCL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
option = Tcl_GetStringFromObj (objv[1], &i);
new_value = Tcl_GetStringFromObj (objv[2], &i);
@@ -2125,7 +1692,7 @@ weechat_tcl_api_config_option_set (ClientData clientData, Tcl_Interp *interp,
new_value,
run_callback);
- TCL_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2136,38 +1703,24 @@ static int
weechat_tcl_api_config_option_set_null (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
int rc;
char *option;
int i, run_callback;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_option_set_null");
- TCL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
-
+ API_FUNC(1, "config_option_set_null", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_option_set_null");
- TCL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
if (Tcl_GetIntFromObj (interp, objv[2], &run_callback) != TCL_OK)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_option_set_null");
- TCL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
option = Tcl_GetStringFromObj (objv[1], &i);
rc = weechat_config_option_set_null (script_str2ptr (option),
run_callback);
- TCL_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2178,31 +1731,20 @@ static int
weechat_tcl_api_config_option_unset (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
int rc;
char *option;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_option_unset");
- TCL_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
- }
-
+ API_FUNC(1, "config_option_unset", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_option_unset");
- TCL_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
- }
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
option = Tcl_GetStringFromObj (objv[1], &i);
rc = weechat_config_option_unset (script_str2ptr (option));
- TCL_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2213,24 +1755,13 @@ static int
weechat_tcl_api_config_option_rename (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *option, *new_name;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_option_rename");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_option_rename", API_RETURN_ERROR);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_option_rename");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
option = Tcl_GetStringFromObj (objv[1], &i);
new_name = Tcl_GetStringFromObj (objv[2], &i);
@@ -2238,7 +1769,7 @@ weechat_tcl_api_config_option_rename (ClientData clientData, Tcl_Interp *interp,
weechat_config_option_rename (script_str2ptr (option),
new_name);
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2249,27 +1780,16 @@ static int
weechat_tcl_api_config_option_is_null (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
int result, i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_option_is_null");
- TCL_RETURN_INT(1);
- }
-
+ API_FUNC(1, "config_option_is_null", API_RETURN_INT(1));
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_option_is_null");
- TCL_RETURN_INT(1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(1));
result = weechat_config_option_is_null (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */
- TCL_RETURN_INT(result);
+ API_RETURN_INT(result);
}
/*
@@ -2282,27 +1802,16 @@ weechat_tcl_api_config_option_default_is_null (ClientData clientData,
Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
int result, i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_option_default_is_null");
- TCL_RETURN_INT(1);
- }
-
+ API_FUNC(1, "config_option_default_is_null", API_RETURN_INT(1));
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_option_default_is_null");
- TCL_RETURN_INT(1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(1));
result = weechat_config_option_default_is_null (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */
- TCL_RETURN_INT(result);
+ API_RETURN_INT(result);
}
/*
@@ -2313,27 +1822,16 @@ static int
weechat_tcl_api_config_boolean (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
int result, i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_boolean");
- TCL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_boolean", API_RETURN_INT(0));
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_boolean");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
result = weechat_config_boolean (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */
- TCL_RETURN_INT(result);
+ API_RETURN_INT(result);
}
/*
@@ -2344,27 +1842,16 @@ static int
weechat_tcl_api_config_boolean_default (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
int result, i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_boolean_default");
- TCL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_boolean_default", API_RETURN_INT(0));
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_boolean_default");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
result = weechat_config_boolean_default (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */
- TCL_RETURN_INT(result);
+ API_RETURN_INT(result);
}
/*
@@ -2375,27 +1862,16 @@ static int
weechat_tcl_api_config_integer (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
int result, i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_integer");
- TCL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_integer", API_RETURN_INT(0));
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_integer");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
result = weechat_config_integer (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */
- TCL_RETURN_INT(result);
+ API_RETURN_INT(result);
}
/*
@@ -2406,27 +1882,16 @@ static int
weechat_tcl_api_config_integer_default (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
int result, i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_integer_default");
- TCL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_integer_default", API_RETURN_INT(0));
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_integer_default");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
result = weechat_config_integer_default (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */
- TCL_RETURN_INT(result);
+ API_RETURN_INT(result);
}
/*
@@ -2441,24 +1906,13 @@ weechat_tcl_api_config_string (ClientData clientData, Tcl_Interp *interp,
const char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_string");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_string", API_RETURN_EMPTY);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_string");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_config_string (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */
- TCL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2473,24 +1927,13 @@ weechat_tcl_api_config_string_default (ClientData clientData, Tcl_Interp *interp
const char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_string_default");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_string_default", API_RETURN_EMPTY);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_string_default");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_config_string_default (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */
- TCL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2505,24 +1948,13 @@ weechat_tcl_api_config_color (ClientData clientData, Tcl_Interp *interp,
const char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_color");
- TCL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_color", API_RETURN_INT(0));
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_color");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
result = weechat_config_color (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */
- TCL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2537,24 +1969,13 @@ weechat_tcl_api_config_color_default (ClientData clientData, Tcl_Interp *interp,
const char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_color_default");
- TCL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_color_default", API_RETURN_INT(0));
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_color_default");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
result = weechat_config_color_default (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */
- TCL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2569,20 +1990,9 @@ weechat_tcl_api_config_write_option (ClientData clientData, Tcl_Interp *interp,
char *config_file, *option;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_write_option");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_write_option", API_RETURN_ERROR);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_write_option");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
config_file = Tcl_GetStringFromObj (objv[1], &i);
option = Tcl_GetStringFromObj (objv[2], &i);
@@ -2590,7 +2000,7 @@ weechat_tcl_api_config_write_option (ClientData clientData, Tcl_Interp *interp,
weechat_config_write_option (script_str2ptr (config_file),
script_str2ptr (option));
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2605,20 +2015,9 @@ weechat_tcl_api_config_write_line (ClientData clientData, Tcl_Interp *interp,
char *config_file, *option_name, *value;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_write_line");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_write_line", API_RETURN_ERROR);
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_write_line");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
config_file = Tcl_GetStringFromObj (objv[1], &i);
option_name = Tcl_GetStringFromObj (objv[2], &i);
@@ -2627,7 +2026,7 @@ weechat_tcl_api_config_write_line (ClientData clientData, Tcl_Interp *interp,
weechat_config_write_line (script_str2ptr (config_file), option_name,
"%s", value);
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2642,24 +2041,13 @@ weechat_tcl_api_config_write (ClientData clientData, Tcl_Interp *interp,
int rc;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_write");
- TCL_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "config_write", API_RETURN_INT(-1));
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_write");
- TCL_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
rc = weechat_config_write (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* config_file */
- TCL_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2674,24 +2062,13 @@ weechat_tcl_api_config_read (ClientData clientData, Tcl_Interp *interp,
int rc;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_read");
- TCL_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "config_read", API_RETURN_INT(-1));
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_read");
- TCL_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
rc = weechat_config_read (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* config_file */
- TCL_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2706,24 +2083,13 @@ weechat_tcl_api_config_reload (ClientData clientData, Tcl_Interp *interp,
int rc;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_reload");
- TCL_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "config_reload", API_RETURN_INT(-1));
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_reload");
- TCL_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
rc = weechat_config_reload (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* config_file */
- TCL_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2737,26 +2103,15 @@ weechat_tcl_api_config_option_free (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_option_free");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_option_free", API_RETURN_ERROR);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_option_free");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_config_option_free (weechat_tcl_plugin,
tcl_current_script,
script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2771,26 +2126,15 @@ weechat_tcl_api_config_section_free_options (ClientData clientData, Tcl_Interp *
Tcl_Obj *objp;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_section_free_options");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_section_free_options", API_RETURN_ERROR);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_section_free_options");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_config_section_free_options (weechat_tcl_plugin,
tcl_current_script,
script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* section */
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2804,26 +2148,15 @@ weechat_tcl_api_config_section_free (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_section_free");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_section_free", API_RETURN_ERROR);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_section_free");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_config_section_free (weechat_tcl_plugin,
tcl_current_script,
script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* section */
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2837,26 +2170,15 @@ weechat_tcl_api_config_free (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_free");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_free", API_RETURN_ERROR);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_free");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_config_free (weechat_tcl_plugin,
tcl_current_script,
script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* config_file */
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -2871,24 +2193,13 @@ weechat_tcl_api_config_get (ClientData clientData, Tcl_Interp *interp,
char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_get");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_get", API_RETURN_EMPTY);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_get");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_config_get (Tcl_GetStringFromObj (objv[1], &i)));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -2903,26 +2214,15 @@ weechat_tcl_api_config_get_plugin (ClientData clientData, Tcl_Interp *interp,
const char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_get_plugin");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "config_get_plugin", API_RETURN_EMPTY);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_get_plugin");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_api_config_get_plugin (weechat_tcl_plugin,
tcl_current_script,
Tcl_GetStringFromObj (objv[1], &i));
- TCL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -2937,20 +2237,9 @@ weechat_tcl_api_config_is_set_plugin (ClientData clientData, Tcl_Interp *interp,
char *option;
int i, rc;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_is_set_plugin");
- TCL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "config_is_set_plugin", API_RETURN_INT(0));
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_is_set_plugin");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
option = Tcl_GetStringFromObj (objv[1], &i);
@@ -2958,7 +2247,7 @@ weechat_tcl_api_config_is_set_plugin (ClientData clientData, Tcl_Interp *interp,
tcl_current_script,
option);
- TCL_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -2973,20 +2262,9 @@ weechat_tcl_api_config_set_plugin (ClientData clientData, Tcl_Interp *interp,
char *option, *value;
int i, rc;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_set_plugin");
- TCL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
-
+ API_FUNC(1, "config_set_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_set_plugin");
- TCL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- }
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
option = Tcl_GetStringFromObj (objv[1], &i);
value = Tcl_GetStringFromObj (objv[2], &i);
@@ -2996,7 +2274,7 @@ weechat_tcl_api_config_set_plugin (ClientData clientData, Tcl_Interp *interp,
option,
value);
- TCL_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -3011,20 +2289,9 @@ weechat_tcl_api_config_set_desc_plugin (ClientData clientData, Tcl_Interp *inter
char *option, *description;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_set_desc_plugin");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "config_set_desc_plugin", API_RETURN_ERROR);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_set_desc_plugin");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
option = Tcl_GetStringFromObj (objv[1], &i);
description = Tcl_GetStringFromObj (objv[2], &i);
@@ -3034,7 +2301,7 @@ weechat_tcl_api_config_set_desc_plugin (ClientData clientData, Tcl_Interp *inter
option,
description);
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -3049,20 +2316,9 @@ weechat_tcl_api_config_unset_plugin (ClientData clientData, Tcl_Interp *interp,
char *option;
int i, rc;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_unset_plugin");
- TCL_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
- }
-
+ API_FUNC(1, "config_unset_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_unset_plugin");
- TCL_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
- }
+ API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
option = Tcl_GetStringFromObj (objv[1], &i);
@@ -3070,7 +2326,7 @@ weechat_tcl_api_config_unset_plugin (ClientData clientData, Tcl_Interp *interp,
tcl_current_script,
option);
- TCL_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -3086,20 +2342,9 @@ weechat_tcl_api_key_bind (ClientData clientData, Tcl_Interp *interp,
struct t_hashtable *hashtable;
int i, num_keys;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "key_bind");
- TCL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "key_bind", API_RETURN_INT(0));
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "key_bind");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
context = Tcl_GetStringFromObj (objv[1], &i);
hashtable = weechat_tcl_dict_to_hashtable (interp, objv[2],
@@ -3110,7 +2355,7 @@ weechat_tcl_api_key_bind (ClientData clientData, Tcl_Interp *interp,
if (hashtable)
weechat_hashtable_free (hashtable);
- TCL_RETURN_INT(num_keys);
+ API_RETURN_INT(num_keys);
}
/*
@@ -3125,27 +2370,16 @@ weechat_tcl_api_key_unbind (ClientData clientData, Tcl_Interp *interp,
char *context, *key;
int i, num_keys;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "key_unbind");
- TCL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "key_unbind", API_RETURN_INT(0));
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "key_unbind");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
context = Tcl_GetStringFromObj (objv[1], &i);
key = Tcl_GetStringFromObj (objv[2], &i);
num_keys = weechat_key_unbind (context, key);
- TCL_RETURN_INT(num_keys);
+ API_RETURN_INT(num_keys);
}
/*
@@ -3160,18 +2394,13 @@ weechat_tcl_api_prefix (ClientData clientData, Tcl_Interp *interp,
const char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
+ API_FUNC(0, "prefix", API_RETURN_EMPTY);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "prefix");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_prefix (Tcl_GetStringFromObj (objv[1], &i)); /* prefix */
- TCL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -3186,18 +2415,13 @@ weechat_tcl_api_color (ClientData clientData, Tcl_Interp *interp,
const char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
+ API_FUNC(0, "color", API_RETURN_EMPTY);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "color");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_color (Tcl_GetStringFromObj (objv[1], &i)); /* color */
- TCL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -3208,18 +2432,13 @@ static int
weechat_tcl_api_print (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *buffer, *message;
int i;
- /* make C compiler happy */
- (void) clientData;
-
+ API_FUNC(0, "print", API_RETURN_ERROR);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "print");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = Tcl_GetStringFromObj (objv[1], &i);
message = Tcl_GetStringFromObj (objv[2], &i);
@@ -3229,7 +2448,7 @@ weechat_tcl_api_print (ClientData clientData, Tcl_Interp *interp,
script_str2ptr (buffer),
"%s", message);
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -3245,26 +2464,12 @@ weechat_tcl_api_print_date_tags (ClientData clientData, Tcl_Interp *interp,
char *buffer, *tags, *message;
int i, tdate;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "print_date_tags");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "print_date_tags", API_RETURN_ERROR);
if (objc < 5)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "print_date_tags");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
if (Tcl_GetIntFromObj (interp, objv[2], &tdate) != TCL_OK)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "print_date_tags");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = Tcl_GetStringFromObj (objv[1], &i);
tags = Tcl_GetStringFromObj (objv[3], &i);
@@ -3277,7 +2482,7 @@ weechat_tcl_api_print_date_tags (ClientData clientData, Tcl_Interp *interp,
tags,
"%s", message);
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -3292,26 +2497,12 @@ weechat_tcl_api_print_y (ClientData clientData, Tcl_Interp *interp,
char *buffer, *message;
int i, y;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "print_y");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "print_y", API_RETURN_ERROR);
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "print_y");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
if (Tcl_GetIntFromObj (interp, objv[2], &y) != TCL_OK)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "print_y");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = Tcl_GetStringFromObj (objv[1], &i);
message = Tcl_GetStringFromObj (objv[3], &i);
@@ -3322,7 +2513,7 @@ weechat_tcl_api_print_y (ClientData clientData, Tcl_Interp *interp,
y,
"%s", message);
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -3339,23 +2530,16 @@ weechat_tcl_api_log_print (ClientData clientData, Tcl_Interp *interp,
/* make C compiler happy */
(void) clientData;
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "log_print");
- TCL_RETURN_ERROR;
- }
+ API_FUNC(1, "log_print", API_RETURN_ERROR);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "log_print");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_log_printf (weechat_tcl_plugin,
tcl_current_script,
"%s", Tcl_GetStringFromObj (objv[1], &i)); /* message */
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -3367,7 +2551,7 @@ weechat_tcl_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
struct t_script_callback *script_callback;
- void *tcl_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3378,14 +2562,14 @@ weechat_tcl_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
if (script_callback && script_callback->function && script_callback->function[0])
{
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = script_ptr2str (buffer);
- tcl_argv[2] = (argc > 1) ? argv_eol[1] : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (buffer);
+ func_argv[2] = (argc > 1) ? argv_eol[1] : empty_arg;
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", tcl_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3394,8 +2578,8 @@ weechat_tcl_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
ret = *rc;
free (rc);
}
- if (tcl_argv[1])
- free (tcl_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -3416,20 +2600,9 @@ weechat_tcl_api_hook_command (ClientData clientData, Tcl_Interp *interp,
char *completion, *function, *data;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hook_command");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_command", API_RETURN_EMPTY);
if (objc < 8)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_command");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
command = Tcl_GetStringFromObj (objv[1], &i);
description = Tcl_GetStringFromObj (objv[2], &i);
@@ -3450,7 +2623,7 @@ weechat_tcl_api_hook_command (ClientData clientData, Tcl_Interp *interp,
function,
data));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3462,7 +2635,7 @@ weechat_tcl_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
const char *command)
{
struct t_script_callback *script_callback;
- void *tcl_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3470,14 +2643,14 @@ weechat_tcl_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
if (script_callback && script_callback->function && script_callback->function[0])
{
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = script_ptr2str (buffer);
- tcl_argv[2] = (command) ? (char *)command : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (buffer);
+ func_argv[2] = (command) ? (char *)command : empty_arg;
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", tcl_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3486,8 +2659,8 @@ weechat_tcl_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
ret = *rc;
free (rc);
}
- if (tcl_argv[1])
- free (tcl_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -3507,20 +2680,9 @@ weechat_tcl_api_hook_command_run (ClientData clientData, Tcl_Interp *interp,
char *result, *command, *function, *data;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hook_command_run");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_command_run", API_RETURN_EMPTY);
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_command_run");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
command = Tcl_GetStringFromObj (objv[1], &i);
function = Tcl_GetStringFromObj (objv[2], &i);
@@ -3533,7 +2695,7 @@ weechat_tcl_api_hook_command_run (ClientData clientData, Tcl_Interp *interp,
function,
data));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3544,7 +2706,7 @@ int
weechat_tcl_api_hook_timer_cb (void *data, int remaining_calls)
{
struct t_script_callback *script_callback;
- void *tcl_argv[2];
+ void *func_argv[2];
char str_remaining_calls[32], empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3555,13 +2717,13 @@ weechat_tcl_api_hook_timer_cb (void *data, int remaining_calls)
snprintf (str_remaining_calls, sizeof (str_remaining_calls),
"%d", remaining_calls);
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = str_remaining_calls;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = str_remaining_calls;
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", tcl_argv);
+ "ss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3589,28 +2751,14 @@ weechat_tcl_api_hook_timer (ClientData clientData, Tcl_Interp *interp,
char *result;
int i, interval, align_second, max_calls;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hook_timer");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_timer", API_RETURN_EMPTY);
if (objc < 6)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_timer");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
if ((Tcl_GetIntFromObj (interp, objv[1], &interval) != TCL_OK)
|| (Tcl_GetIntFromObj (interp, objv[2], &align_second) != TCL_OK)
|| (Tcl_GetIntFromObj (interp, objv[3], &max_calls) != TCL_OK))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_timer");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_timer (weechat_tcl_plugin,
@@ -3622,7 +2770,7 @@ weechat_tcl_api_hook_timer (ClientData clientData, Tcl_Interp *interp,
Tcl_GetStringFromObj (objv[4], &i), /* tcl function */
Tcl_GetStringFromObj (objv[5], &i))); /* data */
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3633,7 +2781,7 @@ int
weechat_tcl_api_hook_fd_cb (void *data, int fd)
{
struct t_script_callback *script_callback;
- void *tcl_argv[2];
+ void *func_argv[2];
char str_fd[32], empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3643,13 +2791,13 @@ weechat_tcl_api_hook_fd_cb (void *data, int fd)
{
snprintf (str_fd, sizeof (str_fd), "%d", fd);
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = str_fd;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = str_fd;
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", tcl_argv);
+ "ss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3677,29 +2825,15 @@ weechat_tcl_api_hook_fd (ClientData clientData, Tcl_Interp *interp,
char *result;
int i, fd, read, write, exception;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hook_fd");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_fd", API_RETURN_EMPTY);
if (objc < 7)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_fd");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
if ((Tcl_GetIntFromObj (interp, objv[1], &fd) != TCL_OK)
|| (Tcl_GetIntFromObj (interp, objv[2], &read) != TCL_OK)
|| (Tcl_GetIntFromObj (interp, objv[3], &write) != TCL_OK)
|| (Tcl_GetIntFromObj (interp, objv[4], &exception) != TCL_OK))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_fd");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (script_api_hook_fd (weechat_tcl_plugin,
tcl_current_script,
@@ -3711,7 +2845,7 @@ weechat_tcl_api_hook_fd (ClientData clientData, Tcl_Interp *interp,
Tcl_GetStringFromObj (objv[5], &i), /* tcl function */
Tcl_GetStringFromObj (objv[6], &i))); /* data */
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3724,7 +2858,7 @@ weechat_tcl_api_hook_process_cb (void *data,
const char *out, const char *err)
{
struct t_script_callback *script_callback;
- void *tcl_argv[5];
+ void *func_argv[5];
char str_rc[32], empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3734,16 +2868,16 @@ weechat_tcl_api_hook_process_cb (void *data,
{
snprintf (str_rc, sizeof (str_rc), "%d", return_code);
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = (command) ? (char *)command : empty_arg;
- tcl_argv[2] = str_rc;
- tcl_argv[3] = (out) ? (char *)out : empty_arg;
- tcl_argv[4] = (err) ? (char *)err : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (command) ? (char *)command : empty_arg;
+ func_argv[2] = str_rc;
+ func_argv[3] = (out) ? (char *)out : empty_arg;
+ func_argv[4] = (err) ? (char *)err : empty_arg;
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sssss", tcl_argv);
+ "sssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3771,26 +2905,12 @@ weechat_tcl_api_hook_process (ClientData clientData, Tcl_Interp *interp,
char *command, *function, *data, *result;
int i, timeout;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hook_process");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_process", API_RETURN_EMPTY);
if (objc < 5)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_process");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
if ((Tcl_GetIntFromObj (interp, objv[2], &timeout) != TCL_OK))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_process");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
command = Tcl_GetStringFromObj (objv[1], &i);
function = Tcl_GetStringFromObj (objv[3], &i);
@@ -3804,7 +2924,7 @@ weechat_tcl_api_hook_process (ClientData clientData, Tcl_Interp *interp,
function,
data));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3816,7 +2936,7 @@ weechat_tcl_api_hook_connect_cb (void *data, int status, int gnutls_rc,
const char *error, const char *ip_address)
{
struct t_script_callback *script_callback;
- void *tcl_argv[5];
+ void *func_argv[5];
char str_status[32], str_gnutls_rc[32];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -3828,16 +2948,16 @@ weechat_tcl_api_hook_connect_cb (void *data, int status, int gnutls_rc,
snprintf (str_status, sizeof (str_status), "%d", status);
snprintf (str_gnutls_rc, sizeof (str_gnutls_rc), "%d", gnutls_rc);
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = str_status;
- tcl_argv[2] = str_gnutls_rc;
- tcl_argv[3] = (ip_address) ? (char *)ip_address : empty_arg;
- tcl_argv[4] = (error) ? (char *)error : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = str_status;
+ func_argv[2] = str_gnutls_rc;
+ func_argv[3] = (ip_address) ? (char *)ip_address : empty_arg;
+ func_argv[4] = (error) ? (char *)error : empty_arg;
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sssss", tcl_argv);
+ "sssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3865,28 +2985,14 @@ weechat_tcl_api_hook_connect (ClientData clientData, Tcl_Interp *interp,
char *proxy, *address, *local_hostname, *function, *data, *result;
int i, port, sock, ipv6;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hook_connect");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_connect", API_RETURN_EMPTY);
if (objc < 9)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_connect");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
if ((Tcl_GetIntFromObj (interp, objv[3], &port) != TCL_OK)
|| (Tcl_GetIntFromObj (interp, objv[4], &sock) != TCL_OK)
|| (Tcl_GetIntFromObj (interp, objv[5], &ipv6) != TCL_OK))
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_connect");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
proxy = Tcl_GetStringFromObj (objv[1], &i);
address = Tcl_GetStringFromObj (objv[2], &i);
@@ -3910,7 +3016,7 @@ weechat_tcl_api_hook_connect (ClientData clientData, Tcl_Interp *interp,
function,
data));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -3925,7 +3031,7 @@ weechat_tcl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
const char *prefix, const char *message)
{
struct t_script_callback *script_callback;
- void *tcl_argv[8];
+ void *func_argv[8];
char empty_arg[1] = { '\0' };
static char timebuffer[64];
int *rc, ret;
@@ -3939,21 +3045,21 @@ weechat_tcl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
{
snprintf (timebuffer, sizeof (timebuffer) - 1, "%ld", (long int)date);
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = script_ptr2str (buffer);
- tcl_argv[2] = timebuffer;
- tcl_argv[3] = weechat_string_build_with_split_string (tags, ",");
- if (!tcl_argv[3])
- tcl_argv[3] = strdup ("");
- tcl_argv[4] = (displayed) ? strdup ("1") : strdup ("0");
- tcl_argv[5] = (highlight) ? strdup ("1") : strdup ("0");
- tcl_argv[6] = (prefix) ? (char *)prefix : empty_arg;
- tcl_argv[7] = (message) ? (char *)message : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (buffer);
+ func_argv[2] = timebuffer;
+ func_argv[3] = weechat_string_build_with_split_string (tags, ",");
+ if (!func_argv[3])
+ func_argv[3] = strdup ("");
+ func_argv[4] = (displayed) ? strdup ("1") : strdup ("0");
+ func_argv[5] = (highlight) ? strdup ("1") : strdup ("0");
+ func_argv[6] = (prefix) ? (char *)prefix : empty_arg;
+ func_argv[7] = (message) ? (char *)message : empty_arg;
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ssssssss", tcl_argv);
+ "ssssssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3962,14 +3068,14 @@ weechat_tcl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
ret = *rc;
free (rc);
}
- if (tcl_argv[1])
- free (tcl_argv[1]);
- if (tcl_argv[3])
- free (tcl_argv[3]);
- if (tcl_argv[4])
- free (tcl_argv[4]);
- if (tcl_argv[5])
- free (tcl_argv[5]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[3])
+ free (func_argv[3]);
+ if (func_argv[4])
+ free (func_argv[4]);
+ if (func_argv[5])
+ free (func_argv[5]);
return ret;
}
@@ -3989,26 +3095,12 @@ weechat_tcl_api_hook_print (ClientData clientData, Tcl_Interp *interp,
char *result, *buffer, *tags, *message, *function, *data;
int i, strip_colors;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hook_print");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_print", API_RETURN_EMPTY);
if (objc < 7)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_print");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
if (Tcl_GetIntFromObj (interp, objv[4], &strip_colors) != TCL_OK)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_print");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = Tcl_GetStringFromObj (objv[1], &i);
tags = Tcl_GetStringFromObj (objv[2], &i);
@@ -4026,7 +3118,7 @@ weechat_tcl_api_hook_print (ClientData clientData, Tcl_Interp *interp,
function,
data));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4038,7 +3130,7 @@ weechat_tcl_api_hook_signal_cb (void *data, const char *signal, const char *type
void *signal_data)
{
struct t_script_callback *script_callback;
- void *tcl_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
static char value_str[64];
int *rc, ret, free_needed;
@@ -4047,31 +3139,31 @@ weechat_tcl_api_hook_signal_cb (void *data, const char *signal, const char *type
if (script_callback && script_callback->function && script_callback->function[0])
{
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = (signal) ? (char *)signal : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (signal) ? (char *)signal : empty_arg;
free_needed = 0;
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
{
- tcl_argv[2] = (signal_data) ? (char *)signal_data : empty_arg;
+ func_argv[2] = (signal_data) ? (char *)signal_data : empty_arg;
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_INT) == 0)
{
snprintf (value_str, sizeof (value_str) - 1,
"%d", *((int *)signal_data));
- tcl_argv[2] = value_str;
+ func_argv[2] = value_str;
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_POINTER) == 0)
{
- tcl_argv[2] = script_ptr2str (signal_data);
+ func_argv[2] = script_ptr2str (signal_data);
free_needed = 1;
}
else
- tcl_argv[2] = empty_arg;
+ func_argv[2] = empty_arg;
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", tcl_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -4080,8 +3172,8 @@ weechat_tcl_api_hook_signal_cb (void *data, const char *signal, const char *type
ret = *rc;
free (rc);
}
- if (free_needed && tcl_argv[2])
- free (tcl_argv[2]);
+ if (free_needed && func_argv[2])
+ free (func_argv[2]);
return ret;
}
@@ -4101,20 +3193,9 @@ weechat_tcl_api_hook_signal (ClientData clientData, Tcl_Interp *interp,
char *result, *signal, *function, *data;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hook_signal");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_signal", API_RETURN_EMPTY);
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_signal");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
signal = Tcl_GetStringFromObj (objv[1], &i);
function = Tcl_GetStringFromObj (objv[2], &i);
@@ -4127,7 +3208,7 @@ weechat_tcl_api_hook_signal (ClientData clientData, Tcl_Interp *interp,
function,
data));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4143,20 +3224,9 @@ weechat_tcl_api_hook_signal_send (ClientData clientData, Tcl_Interp *interp,
int number;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hook_signal_send");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "hook_signal_send", API_RETURN_ERROR);
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_signal_send");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
signal = Tcl_GetStringFromObj (objv[1], &i);
type_data = Tcl_GetStringFromObj (objv[2], &i);
@@ -4165,28 +3235,28 @@ weechat_tcl_api_hook_signal_send (ClientData clientData, Tcl_Interp *interp,
weechat_hook_signal_send (signal,
type_data,
Tcl_GetStringFromObj (objv[3], &i)); /* signal_data */
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_INT) == 0)
{
if (Tcl_GetIntFromObj (interp, objv[3], &number) != TCL_OK)
{
- TCL_RETURN_ERROR;
+ API_RETURN_ERROR;
}
weechat_hook_signal_send (signal,
type_data,
&number); /* signal_data */
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_POINTER) == 0)
{
weechat_hook_signal_send (signal,
type_data,
Tcl_GetStringFromObj (objv[3], &i)); /* signal_data */
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
- TCL_RETURN_ERROR;
+ API_RETURN_ERROR;
}
/*
@@ -4198,7 +3268,7 @@ weechat_tcl_api_hook_hsignal_cb (void *data, const char *signal,
struct t_hashtable *hashtable)
{
struct t_script_callback *script_callback;
- void *tcl_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -4206,14 +3276,14 @@ weechat_tcl_api_hook_hsignal_cb (void *data, const char *signal,
if (script_callback && script_callback->function && script_callback->function[0])
{
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = (signal) ? (char *)signal : empty_arg;
- tcl_argv[2] = hashtable;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (signal) ? (char *)signal : empty_arg;
+ func_argv[2] = hashtable;
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ssh", tcl_argv);
+ "ssh", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -4241,20 +3311,9 @@ weechat_tcl_api_hook_hsignal (ClientData clientData, Tcl_Interp *interp,
char *result, *signal, *function, *data;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hook_hsignal");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_hsignal", API_RETURN_EMPTY);
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_hsignal");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
signal = Tcl_GetStringFromObj (objv[1], &i);
function = Tcl_GetStringFromObj (objv[2], &i);
@@ -4267,7 +3326,7 @@ weechat_tcl_api_hook_hsignal (ClientData clientData, Tcl_Interp *interp,
function,
data));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4283,20 +3342,9 @@ weechat_tcl_api_hook_hsignal_send (ClientData clientData, Tcl_Interp *interp,
struct t_hashtable *hashtable;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hook_hsignal_send");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "hook_hsignal_send", API_RETURN_ERROR);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_hsignal_send");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
signal = Tcl_GetStringFromObj (objv[1], &i);
hashtable = weechat_tcl_dict_to_hashtable (interp, objv[2],
@@ -4307,7 +3355,7 @@ weechat_tcl_api_hook_hsignal_send (ClientData clientData, Tcl_Interp *interp,
if (hashtable)
weechat_hashtable_free (hashtable);
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4318,7 +3366,7 @@ int
weechat_tcl_api_hook_config_cb (void *data, const char *option, const char *value)
{
struct t_script_callback *script_callback;
- void *tcl_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -4326,14 +3374,14 @@ weechat_tcl_api_hook_config_cb (void *data, const char *option, const char *valu
if (script_callback && script_callback->function && script_callback->function[0])
{
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = (option) ? (char *)option : empty_arg;
- tcl_argv[2] = (value) ? (char *)value : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (option) ? (char *)option : empty_arg;
+ func_argv[2] = (value) ? (char *)value : empty_arg;
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", tcl_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -4361,20 +3409,9 @@ weechat_tcl_api_hook_config (ClientData clientData, Tcl_Interp *interp,
char *result, *option, *function, *data;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hook_config");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_config", API_RETURN_EMPTY);
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_config");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
option = Tcl_GetStringFromObj (objv[1], &i);
function = Tcl_GetStringFromObj (objv[2], &i);
@@ -4387,7 +3424,7 @@ weechat_tcl_api_hook_config (ClientData clientData, Tcl_Interp *interp,
function,
data));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4400,7 +3437,7 @@ weechat_tcl_api_hook_completion_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
struct t_script_callback *script_callback;
- void *tcl_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -4408,15 +3445,15 @@ weechat_tcl_api_hook_completion_cb (void *data, const char *completion_item,
if (script_callback && script_callback->function && script_callback->function[0])
{
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = (completion_item) ? (char *)completion_item : empty_arg;
- tcl_argv[2] = script_ptr2str (buffer);
- tcl_argv[3] = script_ptr2str (completion);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (completion_item) ? (char *)completion_item : empty_arg;
+ func_argv[2] = script_ptr2str (buffer);
+ func_argv[3] = script_ptr2str (completion);
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ssss", tcl_argv);
+ "ssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -4425,10 +3462,10 @@ weechat_tcl_api_hook_completion_cb (void *data, const char *completion_item,
ret = *rc;
free (rc);
}
- if (tcl_argv[2])
- free (tcl_argv[2]);
- if (tcl_argv[3])
- free (tcl_argv[3]);
+ if (func_argv[2])
+ free (func_argv[2]);
+ if (func_argv[3])
+ free (func_argv[3]);
return ret;
}
@@ -4448,20 +3485,9 @@ weechat_tcl_api_hook_completion (ClientData clientData, Tcl_Interp *interp,
char *result, *completion, *description, *function, *data;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hook_completion");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_completion", API_RETURN_EMPTY);
if (objc < 5)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_completion");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
completion = Tcl_GetStringFromObj (objv[1], &i);
description = Tcl_GetStringFromObj (objv[2], &i);
@@ -4476,7 +3502,7 @@ weechat_tcl_api_hook_completion (ClientData clientData, Tcl_Interp *interp,
function,
data));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4491,26 +3517,12 @@ weechat_tcl_api_hook_completion_list_add (ClientData clientData, Tcl_Interp *int
char *completion, *word, *where;
int i, nick_completion;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hook_completion_list_add");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "hook_completion_list_add", API_RETURN_ERROR);
if (objc < 5)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_completion_list_add");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
if (Tcl_GetIntFromObj (interp, objv[3], &nick_completion) != TCL_OK)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_completion_list_add");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
completion = Tcl_GetStringFromObj (objv[1], &i);
word = Tcl_GetStringFromObj (objv[2], &i);
@@ -4521,7 +3533,7 @@ weechat_tcl_api_hook_completion_list_add (ClientData clientData, Tcl_Interp *int
nick_completion, /* nick_completion */
where);
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4533,22 +3545,22 @@ weechat_tcl_api_hook_modifier_cb (void *data, const char *modifier,
const char *modifier_data, const char *string)
{
struct t_script_callback *script_callback;
- void *tcl_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' };
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = (modifier) ? (char *)modifier : empty_arg;
- tcl_argv[2] = (modifier_data) ? (char *)modifier_data : empty_arg;
- tcl_argv[3] = (string) ? (char *)string : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (modifier) ? (char *)modifier : empty_arg;
+ func_argv[2] = (modifier_data) ? (char *)modifier_data : empty_arg;
+ func_argv[3] = (string) ? (char *)string : empty_arg;
return (char *)weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
- "ssss", tcl_argv);
+ "ssss", func_argv);
}
return NULL;
@@ -4566,20 +3578,9 @@ weechat_tcl_api_hook_modifier (ClientData clientData, Tcl_Interp *interp,
char *result, *modifier, *function, *data;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hook_modifier");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_modifier", API_RETURN_EMPTY);
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_modifier");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
modifier = Tcl_GetStringFromObj (objv[1], &i);
function = Tcl_GetStringFromObj (objv[2], &i);
@@ -4592,7 +3593,7 @@ weechat_tcl_api_hook_modifier (ClientData clientData, Tcl_Interp *interp,
function,
data));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4607,20 +3608,9 @@ weechat_tcl_api_hook_modifier_exec (ClientData clientData, Tcl_Interp *interp,
char *result, *modifier, *modifier_data, *string;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hook_modifier_exec");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_modifier_exec", API_RETURN_EMPTY);
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_modifier_exec");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
modifier = Tcl_GetStringFromObj (objv[1], &i);
modifier_data = Tcl_GetStringFromObj (objv[2], &i);
@@ -4628,7 +3618,7 @@ weechat_tcl_api_hook_modifier_exec (ClientData clientData, Tcl_Interp *interp,
result = weechat_hook_modifier_exec (modifier, modifier_data, string);
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4640,21 +3630,21 @@ weechat_tcl_api_hook_info_cb (void *data, const char *info_name,
const char *arguments)
{
struct t_script_callback *script_callback;
- void *tcl_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = (info_name) ? (char *)info_name : empty_arg;
- tcl_argv[2] = (arguments) ? (char *)arguments : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
+ func_argv[2] = (arguments) ? (char *)arguments : empty_arg;
return (const char *)weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
- "sss", tcl_argv);
+ "sss", func_argv);
}
return NULL;
@@ -4672,20 +3662,9 @@ weechat_tcl_api_hook_info (ClientData clientData, Tcl_Interp *interp,
char *result, *info_name, *description, *args_description, *function, *data;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hook_info");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_info", API_RETURN_EMPTY);
if (objc < 6)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_info");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
info_name = Tcl_GetStringFromObj (objv[1], &i);
description = Tcl_GetStringFromObj (objv[2], &i);
@@ -4702,7 +3681,7 @@ weechat_tcl_api_hook_info (ClientData clientData, Tcl_Interp *interp,
function,
data));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4714,21 +3693,21 @@ weechat_tcl_api_hook_info_hashtable_cb (void *data, const char *info_name,
struct t_hashtable *hashtable)
{
struct t_script_callback *script_callback;
- void *tcl_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = (info_name) ? (char *)info_name : empty_arg;
- tcl_argv[2] = hashtable;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
+ func_argv[2] = hashtable;
return (struct t_hashtable *)weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
script_callback->function,
- "ssh", tcl_argv);
+ "ssh", func_argv);
}
return NULL;
@@ -4747,20 +3726,9 @@ weechat_tcl_api_hook_info_hashtable (ClientData clientData, Tcl_Interp *interp,
char *output_description, *function, *data;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hook_info_hashtable");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_info_hashtable", API_RETURN_EMPTY);
if (objc < 7)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_info_hashtable");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
info_name = Tcl_GetStringFromObj (objv[1], &i);
description = Tcl_GetStringFromObj (objv[2], &i);
@@ -4779,7 +3747,7 @@ weechat_tcl_api_hook_info_hashtable (ClientData clientData, Tcl_Interp *interp,
function,
data));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4791,7 +3759,7 @@ weechat_tcl_api_hook_infolist_cb (void *data, const char *infolist_name,
void *pointer, const char *arguments)
{
struct t_script_callback *script_callback;
- void *tcl_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' };
struct t_infolist *result;
@@ -4799,18 +3767,18 @@ weechat_tcl_api_hook_infolist_cb (void *data, const char *infolist_name,
if (script_callback && script_callback->function && script_callback->function[0])
{
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = (infolist_name) ? (char *)infolist_name : empty_arg;
- tcl_argv[2] = script_ptr2str (pointer);
- tcl_argv[3] = (arguments) ? (char *)arguments : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = (infolist_name) ? (char *)infolist_name : empty_arg;
+ func_argv[2] = script_ptr2str (pointer);
+ func_argv[3] = (arguments) ? (char *)arguments : empty_arg;
result = (struct t_infolist *)weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
- "ssss", tcl_argv);
+ "ssss", func_argv);
- if (tcl_argv[2])
- free (tcl_argv[2]);
+ if (func_argv[2])
+ free (func_argv[2]);
return result;
}
@@ -4831,20 +3799,9 @@ weechat_tcl_api_hook_infolist (ClientData clientData, Tcl_Interp *interp,
char *args_description, *function, *data;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hook_infolist");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_infolist", API_RETURN_EMPTY);
if (objc < 7)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_infolist");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
infolist_name = Tcl_GetStringFromObj (objv[1], &i);
description = Tcl_GetStringFromObj (objv[2], &i);
@@ -4863,7 +3820,7 @@ weechat_tcl_api_hook_infolist (ClientData clientData, Tcl_Interp *interp,
function,
data));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4875,20 +3832,20 @@ weechat_tcl_api_hook_focus_cb (void *data,
struct t_hashtable *info)
{
struct t_script_callback *script_callback;
- void *tcl_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = info;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = info;
return (struct t_hashtable *)weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
script_callback->function,
- "sh", tcl_argv);
+ "sh", func_argv);
}
return NULL;
@@ -4906,20 +3863,9 @@ weechat_tcl_api_hook_focus (ClientData clientData, Tcl_Interp *interp,
char *result, *area, *function, *data;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hook_focus");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hook_focus", API_RETURN_EMPTY);
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_focus");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
area = Tcl_GetStringFromObj (objv[1], &i);
function = Tcl_GetStringFromObj (objv[2], &i);
@@ -4932,7 +3878,7 @@ weechat_tcl_api_hook_focus (ClientData clientData, Tcl_Interp *interp,
function,
data));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -4946,26 +3892,15 @@ weechat_tcl_api_unhook (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "unhook");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "unhook", API_RETURN_ERROR);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "unhook");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_unhook (weechat_tcl_plugin,
tcl_current_script,
script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* hook */
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -4983,15 +3918,11 @@ weechat_tcl_api_unhook_all (ClientData clientData, Tcl_Interp *interp,
(void) objc;
(void) objv;
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "unhook_all");
- TCL_RETURN_ERROR;
- }
+ API_FUNC(1, "unhook_all", API_RETURN_ERROR);
script_api_unhook_all (tcl_current_script);
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5003,7 +3934,7 @@ weechat_tcl_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
const char *input_data)
{
struct t_script_callback *script_callback;
- void *tcl_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -5011,14 +3942,14 @@ weechat_tcl_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
if (script_callback && script_callback->function && script_callback->function[0])
{
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = script_ptr2str (buffer);
- tcl_argv[2] = (input_data) ? (char *)input_data : empty_arg;
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (buffer);
+ func_argv[2] = (input_data) ? (char *)input_data : empty_arg;
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "sss", tcl_argv);
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -5026,8 +3957,8 @@ weechat_tcl_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
ret = *rc;
free (rc);
}
- if (tcl_argv[1])
- free (tcl_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -5043,7 +3974,7 @@ int
weechat_tcl_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
{
struct t_script_callback *script_callback;
- void *tcl_argv[2];
+ void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc, ret;
@@ -5051,13 +3982,13 @@ weechat_tcl_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
if (script_callback && script_callback->function && script_callback->function[0])
{
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = script_ptr2str (buffer);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (buffer);
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ss", tcl_argv);
+ "ss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -5065,8 +3996,8 @@ weechat_tcl_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
ret = *rc;
free (rc);
}
- if (tcl_argv[1])
- free (tcl_argv[1]);
+ if (func_argv[1])
+ free (func_argv[1]);
return ret;
}
@@ -5087,20 +4018,9 @@ weechat_tcl_api_buffer_new (ClientData clientData, Tcl_Interp *interp,
char *data_close;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "buffer_new");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "buffer_new", API_RETURN_EMPTY);
if (objc < 6)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "buffer_new");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
name = Tcl_GetStringFromObj (objv[1], &i);
function_input = Tcl_GetStringFromObj (objv[2], &i);
@@ -5118,7 +4038,7 @@ weechat_tcl_api_buffer_new (ClientData clientData, Tcl_Interp *interp,
function_close,
data_close));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5133,27 +4053,16 @@ weechat_tcl_api_buffer_search (ClientData clientData, Tcl_Interp *interp,
char *result, *plugin, *name;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "buffer_search");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "buffer_search", API_RETURN_EMPTY);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "buffer_search");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
plugin = Tcl_GetStringFromObj (objv[1], &i);
name = Tcl_GetStringFromObj (objv[2], &i);
result = script_ptr2str (weechat_buffer_search (plugin, name));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5172,15 +4081,11 @@ weechat_tcl_api_buffer_search_main (ClientData clientData, Tcl_Interp *interp,
(void) objc;
(void) objv;
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "buffer_search_main");
- TCL_RETURN_EMPTY;
- }
+ API_FUNC(1, "buffer_search_main", API_RETURN_EMPTY);
result = script_ptr2str (weechat_buffer_search_main ());
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5199,15 +4104,11 @@ weechat_tcl_api_current_buffer (ClientData clientData, Tcl_Interp *interp,
(void) objc;
(void) objv;
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "current_buffer");
- TCL_RETURN_EMPTY;
- }
+ API_FUNC(1, "current_buffer", API_RETURN_EMPTY);
result = script_ptr2str (weechat_current_buffer ());
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5221,24 +4122,13 @@ weechat_tcl_api_buffer_clear (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "buffer_clear");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_clear", API_RETURN_ERROR);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "buffer_clear");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_buffer_clear (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* buffer */
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5252,26 +4142,15 @@ weechat_tcl_api_buffer_close (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "buffer_close");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_close", API_RETURN_ERROR);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "buffer_close");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_buffer_close (weechat_tcl_plugin,
tcl_current_script,
script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* buffer */
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5285,25 +4164,14 @@ weechat_tcl_api_buffer_merge (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "buffer_merge");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_merge", API_RETURN_ERROR);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "buffer_merge");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_buffer_merge (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)), /* buffer */
script_str2ptr (Tcl_GetStringFromObj (objv[2], &i))); /* target_buffer */
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5318,31 +4186,17 @@ weechat_tcl_api_buffer_unmerge (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
int i, number;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "buffer_unmerge");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_unmerge", API_RETURN_ERROR);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "buffer_unmerge");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
if (Tcl_GetIntFromObj (interp, objv[2], &number) != TCL_OK)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "buffer_unmerge");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_buffer_unmerge (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)),
number);
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5358,27 +4212,16 @@ weechat_tcl_api_buffer_get_integer (ClientData clientData, Tcl_Interp *interp,
int result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "buffer_get_integer");
- TCL_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "buffer_get_integer", API_RETURN_INT(-1));
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "buffer_get_integer");
- TCL_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
buffer = Tcl_GetStringFromObj (objv[1], &i);
property = Tcl_GetStringFromObj (objv[2], &i);
result = weechat_buffer_get_integer (script_str2ptr (buffer), property);
- TCL_RETURN_INT(result);
+ API_RETURN_INT(result);
}
/*
@@ -5394,27 +4237,16 @@ weechat_tcl_api_buffer_get_string (ClientData clientData, Tcl_Interp *interp,
const char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "buffer_get_string");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "buffer_get_string", API_RETURN_EMPTY);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "buffer_get_string");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = Tcl_GetStringFromObj (objv[1], &i);
property = Tcl_GetStringFromObj (objv[2], &i);
result = weechat_buffer_get_string (script_str2ptr (buffer), property);
- TCL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -5429,20 +4261,9 @@ weechat_tcl_api_buffer_get_pointer (ClientData clientData, Tcl_Interp *interp,
char *buffer, *property, *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "buffer_get_pointer");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "buffer_get_pointer", API_RETURN_EMPTY);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "buffer_get_pointer");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = Tcl_GetStringFromObj (objv[1], &i);
property = Tcl_GetStringFromObj (objv[2], &i);
@@ -5450,7 +4271,7 @@ weechat_tcl_api_buffer_get_pointer (ClientData clientData, Tcl_Interp *interp,
result = script_ptr2str (weechat_buffer_get_pointer (script_str2ptr (buffer),
property));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5465,20 +4286,9 @@ weechat_tcl_api_buffer_set (ClientData clientData, Tcl_Interp *interp,
char *buffer, *property, *value;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "buffer_set");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_set", API_RETURN_ERROR);
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "buffer_set");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = Tcl_GetStringFromObj (objv[1], &i);
property = Tcl_GetStringFromObj (objv[2], &i);
@@ -5486,7 +4296,7 @@ weechat_tcl_api_buffer_set (ClientData clientData, Tcl_Interp *interp,
weechat_buffer_set (script_str2ptr (buffer), property, value);
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5502,27 +4312,16 @@ weechat_tcl_api_buffer_string_replace_local_var (ClientData clientData, Tcl_Inte
char *buffer, *string, *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "buffer_string_replace_local_var");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "buffer_string_replace_local_var", API_RETURN_ERROR);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "buffer_string_replace_local_var");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = Tcl_GetStringFromObj (objv[1], &i);
string = Tcl_GetStringFromObj (objv[2], &i);
result = weechat_buffer_string_replace_local_var (script_str2ptr (buffer), string);
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5538,27 +4337,16 @@ weechat_tcl_api_buffer_match_list (ClientData clientData, Tcl_Interp *interp,
int result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "buffer_match_list");
- TCL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "buffer_match_list", API_RETURN_INT(0));
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "buffer_match_list");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
buffer = Tcl_GetStringFromObj (objv[1], &i);
string = Tcl_GetStringFromObj (objv[2], &i);
result = weechat_buffer_match_list (script_str2ptr (buffer), string);
- TCL_RETURN_INT(result);
+ API_RETURN_INT(result);
}
/*
@@ -5577,15 +4365,11 @@ weechat_tcl_api_current_window (ClientData clientData, Tcl_Interp *interp,
(void) objc;
(void) objv;
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "current_window");
- TCL_RETURN_EMPTY;
- }
+ API_FUNC(1, "current_window", API_RETURN_EMPTY);
result = script_ptr2str (weechat_current_window ());
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5601,26 +4385,15 @@ weechat_tcl_api_window_search_with_buffer (ClientData clientData, Tcl_Interp *in
char *buffer, *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "window_search_with_buffer");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "window_search_with_buffer", API_RETURN_EMPTY);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "window_search_with_buffer");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = Tcl_GetStringFromObj (objv[1], &i);
result = script_ptr2str (weechat_window_search_with_buffer (script_str2ptr (buffer)));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5636,27 +4409,16 @@ weechat_tcl_api_window_get_integer (ClientData clientData, Tcl_Interp *interp,
int result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "window_get_integer");
- TCL_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "window_get_integer", API_RETURN_INT(-1));
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "window_get_integer");
- TCL_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
window = Tcl_GetStringFromObj (objv[1], &i);
property = Tcl_GetStringFromObj (objv[2], &i);
result = weechat_window_get_integer (script_str2ptr (window), property);
- TCL_RETURN_INT(result);
+ API_RETURN_INT(result);
}
/*
@@ -5672,27 +4434,16 @@ weechat_tcl_api_window_get_string (ClientData clientData, Tcl_Interp *interp,
const char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "window_get_string");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "window_get_string", API_RETURN_EMPTY);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "window_get_string");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
window = Tcl_GetStringFromObj (objv[1], &i);
property = Tcl_GetStringFromObj (objv[2], &i);
result = weechat_window_get_string (script_str2ptr (window), property);
- TCL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -5707,20 +4458,9 @@ weechat_tcl_api_window_get_pointer (ClientData clientData, Tcl_Interp *interp,
char *window, *property, *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "window_get_pointer");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "window_get_pointer", API_RETURN_EMPTY);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "window_get_pointer");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
window = Tcl_GetStringFromObj (objv[1], &i);
property = Tcl_GetStringFromObj (objv[2], &i);
@@ -5728,7 +4468,7 @@ weechat_tcl_api_window_get_pointer (ClientData clientData, Tcl_Interp *interp,
result = script_ptr2str (weechat_window_get_pointer (script_str2ptr (window),
property));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5743,26 +4483,15 @@ weechat_tcl_api_window_set_title (ClientData clientData, Tcl_Interp *interp,
char *title;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "window_set_title");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "window_set_title", API_RETURN_ERROR);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "window_set_title");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
title = Tcl_GetStringFromObj (objv[1], &i);
weechat_window_set_title (title);
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5773,30 +4502,16 @@ static int
weechat_tcl_api_nicklist_add_group (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *result, *buffer, *parent_group, *name, *color;
int i, visible;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "nicklist_add_group");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "nicklist_add_group", API_RETURN_EMPTY);
if (objc < 6)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "nicklist_add_group");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
if (Tcl_GetIntFromObj (interp, objv[5], &visible) != TCL_OK)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "nicklist_add_group");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = Tcl_GetStringFromObj (objv[1], &i);
parent_group = Tcl_GetStringFromObj (objv[2], &i);
@@ -5809,7 +4524,7 @@ weechat_tcl_api_nicklist_add_group (ClientData clientData, Tcl_Interp *interp,
color,
visible)); /* visible */
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5820,24 +4535,13 @@ static int
weechat_tcl_api_nicklist_search_group (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *result, *buffer, *from_group, *name;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "nicklist_search_group");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "nicklist_search_group", API_RETURN_EMPTY);
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "nicklist_search_group");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = Tcl_GetStringFromObj (objv[1], &i);
from_group = Tcl_GetStringFromObj (objv[2], &i);
@@ -5847,7 +4551,7 @@ weechat_tcl_api_nicklist_search_group (ClientData clientData, Tcl_Interp *interp
script_str2ptr (from_group),
name));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5862,26 +4566,12 @@ weechat_tcl_api_nicklist_add_nick (ClientData clientData, Tcl_Interp *interp,
char *result, *buffer, *group, *name, *color, *prefix, *prefix_color;
int i, visible;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "nicklist_add_nick");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "nicklist_add_nick", API_RETURN_EMPTY);
if (objc < 8)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "nicklist_add_nick");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
if (Tcl_GetIntFromObj (interp, objv[7], &visible) != TCL_OK)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "nicklist_add_nick");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = Tcl_GetStringFromObj (objv[1], &i);
group = Tcl_GetStringFromObj (objv[2], &i);
@@ -5898,7 +4588,7 @@ weechat_tcl_api_nicklist_add_nick (ClientData clientData, Tcl_Interp *interp,
prefix_color,
visible)); /* visible */
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5913,20 +4603,9 @@ weechat_tcl_api_nicklist_search_nick (ClientData clientData, Tcl_Interp *interp,
char *result, *buffer, *from_group, *name;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "nicklist_search_nick");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "nicklist_search_nick", API_RETURN_EMPTY);
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "nicklist_search_nick");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = Tcl_GetStringFromObj (objv[1], &i);
from_group = Tcl_GetStringFromObj (objv[2], &i);
@@ -5936,7 +4615,7 @@ weechat_tcl_api_nicklist_search_nick (ClientData clientData, Tcl_Interp *interp,
script_str2ptr (from_group),
name));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -5951,20 +4630,9 @@ weechat_tcl_api_nicklist_remove_group (ClientData clientData, Tcl_Interp *interp
char *buffer, *group;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "nicklist_remove_group");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_remove_group", API_RETURN_ERROR);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "nicklist_remove_group");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = Tcl_GetStringFromObj (objv[1], &i);
group = Tcl_GetStringFromObj (objv[2], &i);
@@ -5972,7 +4640,7 @@ weechat_tcl_api_nicklist_remove_group (ClientData clientData, Tcl_Interp *interp
weechat_nicklist_remove_group (script_str2ptr (buffer),
script_str2ptr (group));
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -5987,20 +4655,9 @@ weechat_tcl_api_nicklist_remove_nick (ClientData clientData, Tcl_Interp *interp,
char *buffer, *nick;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "nicklist_remove_nick");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_remove_nick", API_RETURN_ERROR);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "nicklist_remove_nick");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = Tcl_GetStringFromObj (objv[1], &i);
nick = Tcl_GetStringFromObj (objv[2], &i);
@@ -6008,7 +4665,7 @@ weechat_tcl_api_nicklist_remove_nick (ClientData clientData, Tcl_Interp *interp,
weechat_nicklist_remove_nick (script_str2ptr (buffer),
script_str2ptr (nick));
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6022,24 +4679,13 @@ weechat_tcl_api_nicklist_remove_all (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "nicklist_remove_all");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_remove_all", API_RETURN_ERROR);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "nicklist_remove_all");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_nicklist_remove_all (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* buffer */
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6056,20 +4702,9 @@ weechat_tcl_api_nicklist_group_get_integer (ClientData clientData,
int result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "nicklist_group_get_integer");
- TCL_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "nicklist_group_get_integer", API_RETURN_INT(-1));
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "nicklist_group_get_integer");
- TCL_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
buffer = Tcl_GetStringFromObj (objv[1], &i);
group = Tcl_GetStringFromObj (objv[2], &i);
@@ -6079,7 +4714,7 @@ weechat_tcl_api_nicklist_group_get_integer (ClientData clientData,
script_str2ptr (group),
property);
- TCL_RETURN_INT(result);
+ API_RETURN_INT(result);
}
/*
@@ -6096,20 +4731,9 @@ weechat_tcl_api_nicklist_group_get_string (ClientData clientData,
const char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "nicklist_group_get_string");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "nicklist_group_get_string", API_RETURN_EMPTY);
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "nicklist_group_get_string");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = Tcl_GetStringFromObj (objv[1], &i);
group = Tcl_GetStringFromObj (objv[2], &i);
@@ -6119,7 +4743,7 @@ weechat_tcl_api_nicklist_group_get_string (ClientData clientData,
script_str2ptr (group),
property);
- TCL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -6135,20 +4759,9 @@ weechat_tcl_api_nicklist_group_get_pointer (ClientData clientData,
char *buffer, *group, *property, *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "nicklist_group_get_pointer");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "nicklist_group_get_pointer", API_RETURN_EMPTY);
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "nicklist_group_get_pointer");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = Tcl_GetStringFromObj (objv[1], &i);
group = Tcl_GetStringFromObj (objv[2], &i);
@@ -6158,7 +4771,7 @@ weechat_tcl_api_nicklist_group_get_pointer (ClientData clientData,
script_str2ptr (group),
property));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6173,20 +4786,9 @@ weechat_tcl_api_nicklist_group_set (ClientData clientData, Tcl_Interp *interp,
char *buffer, *group, *property, *value;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "nicklist_group_set");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_group_set", API_RETURN_ERROR);
if (objc < 5)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "nicklist_group_set");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = Tcl_GetStringFromObj (objv[1], &i);
group = Tcl_GetStringFromObj (objv[2], &i);
@@ -6198,7 +4800,7 @@ weechat_tcl_api_nicklist_group_set (ClientData clientData, Tcl_Interp *interp,
property,
value);
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6215,20 +4817,9 @@ weechat_tcl_api_nicklist_nick_get_integer (ClientData clientData,
int result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "nicklist_nick_get_integer");
- TCL_RETURN_INT(-1);
- }
-
+ API_FUNC(1, "nicklist_nick_get_integer", API_RETURN_INT(-1));
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "nicklist_nick_get_integer");
- TCL_RETURN_INT(-1);
- }
+ API_WRONG_ARGS(API_RETURN_INT(-1));
buffer = Tcl_GetStringFromObj (objv[1], &i);
nick = Tcl_GetStringFromObj (objv[2], &i);
@@ -6238,7 +4829,7 @@ weechat_tcl_api_nicklist_nick_get_integer (ClientData clientData,
script_str2ptr (nick),
property);
- TCL_RETURN_INT(result);
+ API_RETURN_INT(result);
}
/*
@@ -6255,20 +4846,9 @@ weechat_tcl_api_nicklist_nick_get_string (ClientData clientData,
const char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "nicklist_nick_get_string");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "nicklist_nick_get_string", API_RETURN_EMPTY);
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "nicklist_nick_get_string");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = Tcl_GetStringFromObj (objv[1], &i);
nick = Tcl_GetStringFromObj (objv[2], &i);
@@ -6278,7 +4858,7 @@ weechat_tcl_api_nicklist_nick_get_string (ClientData clientData,
script_str2ptr (nick),
property);
- TCL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -6294,20 +4874,9 @@ weechat_tcl_api_nicklist_nick_get_pointer (ClientData clientData,
char *buffer, *nick, *property, *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "nicklist_nick_get_pointer");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "nicklist_nick_get_pointer", API_RETURN_EMPTY);
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "nicklist_nick_get_pointer");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
buffer = Tcl_GetStringFromObj (objv[1], &i);
nick = Tcl_GetStringFromObj (objv[2], &i);
@@ -6317,7 +4886,7 @@ weechat_tcl_api_nicklist_nick_get_pointer (ClientData clientData,
script_str2ptr (nick),
property));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6332,20 +4901,9 @@ weechat_tcl_api_nicklist_nick_set (ClientData clientData, Tcl_Interp *interp,
char *buffer, *nick, *property, *value;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "nicklist_nick_set");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "nicklist_nick_set", API_RETURN_ERROR);
if (objc < 5)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "nicklist_nick_set");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = Tcl_GetStringFromObj (objv[1], &i);
nick = Tcl_GetStringFromObj (objv[2], &i);
@@ -6357,7 +4915,7 @@ weechat_tcl_api_nicklist_nick_set (ClientData clientData, Tcl_Interp *interp,
property,
value);
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6372,24 +4930,13 @@ weechat_tcl_api_bar_item_search (ClientData clientData, Tcl_Interp *interp,
char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "bar_item_search");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "bar_item_search", API_RETURN_EMPTY);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "bar_item_search");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_bar_item_search (Tcl_GetStringFromObj (objv[1], &i))); /* name */
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6401,26 +4948,26 @@ weechat_tcl_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
{
struct t_script_callback *script_callback;
- void *tcl_argv[3];
+ void *func_argv[3];
char empty_arg[1] = { '\0' }, *ret;
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = script_ptr2str (item);
- tcl_argv[2] = script_ptr2str (window);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (item);
+ func_argv[2] = script_ptr2str (window);
ret = (char *)weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
- "sss", tcl_argv);
+ "sss", func_argv);
- if (tcl_argv[1])
- free (tcl_argv[1]);
- if (tcl_argv[2])
- free (tcl_argv[2]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[2])
+ free (func_argv[2]);
return ret;
}
@@ -6440,20 +4987,9 @@ weechat_tcl_api_bar_item_new (ClientData clientData, Tcl_Interp *interp,
char *result, *name, *function, *data;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "bar_item_new");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "bar_item_new", API_RETURN_EMPTY);
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "bar_item_new");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
name = Tcl_GetStringFromObj (objv[1], &i);
function = Tcl_GetStringFromObj (objv[2], &i);
@@ -6466,7 +5002,7 @@ weechat_tcl_api_bar_item_new (ClientData clientData, Tcl_Interp *interp,
function,
data));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6480,24 +5016,13 @@ weechat_tcl_api_bar_item_update (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "bar_item_update");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "bar_item_update", API_RETURN_ERROR);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "bar_item_update");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_bar_item_update (Tcl_GetStringFromObj (objv[1], &i)); /* name */
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6511,26 +5036,15 @@ weechat_tcl_api_bar_item_remove (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "bar_item_remove");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "bar_item_remove", API_RETURN_ERROR);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "bar_item_remove");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
script_api_bar_item_remove (weechat_tcl_plugin,
tcl_current_script,
script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* item */
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6545,24 +5059,13 @@ weechat_tcl_api_bar_search (ClientData clientData, Tcl_Interp *interp,
char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "bar_search");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "bar_search", API_RETURN_EMPTY);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "bar_search");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_bar_search (Tcl_GetStringFromObj (objv[1], &i))); /* name */
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6579,20 +5082,9 @@ weechat_tcl_api_bar_new (ClientData clientData, Tcl_Interp *interp,
char *color_delim, *color_bg, *separator, *bar_items;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "bar_new");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "bar_new", API_RETURN_EMPTY);
if (objc < 16)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "bar_new");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
name = Tcl_GetStringFromObj (objv[1], &i);
hidden = Tcl_GetStringFromObj (objv[2], &i);
@@ -6626,7 +5118,7 @@ weechat_tcl_api_bar_new (ClientData clientData, Tcl_Interp *interp,
separator,
bar_items));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6641,20 +5133,9 @@ weechat_tcl_api_bar_set (ClientData clientData, Tcl_Interp *interp,
char *bar, *property, *value;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "bar_set");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "bar_set", API_RETURN_ERROR);
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "bar_set");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
bar = Tcl_GetStringFromObj (objv[1], &i);
property = Tcl_GetStringFromObj (objv[2], &i);
@@ -6662,7 +5143,7 @@ weechat_tcl_api_bar_set (ClientData clientData, Tcl_Interp *interp,
weechat_bar_set (script_str2ptr (bar), property, value);
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6676,24 +5157,13 @@ weechat_tcl_api_bar_update (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "bar_update");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "bar_update", API_RETURN_ERROR);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "bar_update");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_bar_update (Tcl_GetStringFromObj (objv[1], &i)); /* name */
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6707,24 +5177,13 @@ weechat_tcl_api_bar_remove (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "bar_remove");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "bar_remove", API_RETURN_ERROR);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "bar_remove");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
- weechat_bar_remove (script_str2ptr(Tcl_GetStringFromObj (objv[1], &i))); /* bar */
+ weechat_bar_remove (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* bar */
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6739,20 +5198,9 @@ weechat_tcl_api_command (ClientData clientData, Tcl_Interp *interp,
char *buffer, *command;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "command");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "command", API_RETURN_ERROR);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "command");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
buffer = Tcl_GetStringFromObj (objv[1], &i);
command = Tcl_GetStringFromObj (objv[2], &i);
@@ -6762,7 +5210,7 @@ weechat_tcl_api_command (ClientData clientData, Tcl_Interp *interp,
script_str2ptr (buffer),
command);
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -6777,25 +5225,14 @@ weechat_tcl_api_info_get (ClientData clientData, Tcl_Interp *interp,
const char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "info_get");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "info_get", API_RETURN_EMPTY);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "info_get");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_info_get (Tcl_GetStringFromObj (objv[1], &i),
Tcl_GetStringFromObj (objv[2], &i));
- TCL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -6810,20 +5247,9 @@ weechat_tcl_api_info_get_hashtable (ClientData clientData, Tcl_Interp *interp,
struct t_hashtable *hashtable, *result_hashtable;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "info_get_hashtable");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "info_get_hashtable", API_RETURN_EMPTY);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "info_get_hashtable");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
hashtable = weechat_tcl_dict_to_hashtable (interp, objv[2],
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
@@ -6837,7 +5263,7 @@ weechat_tcl_api_info_get_hashtable (ClientData clientData, Tcl_Interp *interp,
if (result_hashtable)
weechat_hashtable_free (result_hashtable);
- TCL_RETURN_OBJ(result_dict);
+ API_RETURN_OBJ(result_dict);
}
/*
@@ -6848,7 +5274,7 @@ static int
weechat_tcl_api_infolist_new (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *result;
/* make C compiler happy */
@@ -6856,15 +5282,11 @@ weechat_tcl_api_infolist_new (ClientData clientData, Tcl_Interp *interp,
(void) objc;
(void) objv;
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "infolist_new");
- TCL_RETURN_EMPTY;
- }
+ API_FUNC(1, "infolist_new", API_RETURN_EMPTY);
result = script_ptr2str (weechat_infolist_new ());
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6879,24 +5301,13 @@ weechat_tcl_api_infolist_new_item (ClientData clientData, Tcl_Interp *interp,
char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "infolist_new_item");
- TCL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "infolist_new_item", API_RETURN_INT(0));
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "infolist_new_item");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
result = script_ptr2str (weechat_infolist_new_item (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)))); /* infolist */
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6912,32 +5323,18 @@ weechat_tcl_api_infolist_new_var_integer (ClientData clientData, Tcl_Interp *int
char *result;
int i, value;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "infolist_new_var_integer");
- TCL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "infolist_new_var_integer", API_RETURN_INT(0));
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "infolist_new_var_integer");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
if (Tcl_GetIntFromObj (interp, objv[3], &value) != TCL_OK)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "infolist_new_var_integer");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_infolist_new_var_integer (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)), /* infolist */
Tcl_GetStringFromObj (objv[2], &i), /* name */
value));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6953,26 +5350,15 @@ weechat_tcl_api_infolist_new_var_string (ClientData clientData, Tcl_Interp *inte
char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "infolist_new_var_string");
- TCL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "infolist_new_var_string", API_RETURN_INT(0));
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "infolist_new_var_string");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
result = script_ptr2str (weechat_infolist_new_var_string (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)), /* infolist */
Tcl_GetStringFromObj (objv[2], &i), /* name */
Tcl_GetStringFromObj (objv[3], &i))); /* value */
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -6987,26 +5373,15 @@ weechat_tcl_api_infolist_new_var_pointer (ClientData clientData, Tcl_Interp *int
char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "infolist_new_var_pointer");
- TCL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "infolist_new_var_pointer", API_RETURN_INT(0));
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "infolist_new_var_pointer");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
result = script_ptr2str (weechat_infolist_new_var_pointer (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)), /* infolist */
Tcl_GetStringFromObj (objv[2], &i), /* name */
script_str2ptr (Tcl_GetStringFromObj (objv[3], &i)))); /* value */
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7021,32 +5396,18 @@ weechat_tcl_api_infolist_new_var_time (ClientData clientData, Tcl_Interp *interp
char *result;
int i, value;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "infolist_new_var_time");
- TCL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "infolist_new_var_time", API_RETURN_INT(0));
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "infolist_new_var_time");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
if (Tcl_GetIntFromObj (interp, objv[3], &value) != TCL_OK)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "infolist_new_var_time");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_infolist_new_var_time (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)), /* infolist */
Tcl_GetStringFromObj (objv[2], &i), /* name */
value));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7061,20 +5422,9 @@ weechat_tcl_api_infolist_get (ClientData clientData, Tcl_Interp *interp,
char *result, *name, *pointer, *arguments;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "infolist_get");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_get", API_RETURN_EMPTY);
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "infolist_get");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
name = Tcl_GetStringFromObj (objv[1], &i);
pointer = Tcl_GetStringFromObj (objv[2], &i);
@@ -7084,7 +5434,7 @@ weechat_tcl_api_infolist_get (ClientData clientData, Tcl_Interp *interp,
script_str2ptr (pointer),
arguments));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7098,24 +5448,13 @@ weechat_tcl_api_infolist_next (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
int result, i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "infolist_next");
- TCL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "infolist_next", API_RETURN_INT(0));
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "infolist_next");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
result = weechat_infolist_next (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* infolist */
- TCL_RETURN_INT(result);
+ API_RETURN_INT(result);
}
/*
@@ -7130,24 +5469,13 @@ weechat_tcl_api_infolist_prev (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
int result, i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "infolist_prev");
- TCL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "infolist_prev", API_RETURN_INT(0));
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "infolist_prev");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
result = weechat_infolist_prev (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* infolist */
- TCL_RETURN_INT(result);
+ API_RETURN_INT(result);
}
/*
@@ -7163,24 +5491,13 @@ weechat_tcl_api_infolist_reset_item_cursor (ClientData clientData,
Tcl_Obj *objp;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "infolist_reset_item_cursor");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "infolist_reset_item_cursor", API_RETURN_ERROR);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "infolist_reset_item_cursor");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_infolist_reset_item_cursor (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* infolist */
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -7196,24 +5513,13 @@ weechat_tcl_api_infolist_fields (ClientData clientData, Tcl_Interp *interp,
const char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "infolist_fields");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_fields", API_RETURN_EMPTY);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "infolist_fields");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_infolist_fields (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* infolist */
- TCL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -7229,27 +5535,16 @@ weechat_tcl_api_infolist_integer (ClientData clientData, Tcl_Interp *interp,
char *infolist, *variable;
int result, i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "infolist_integer");
- TCL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "infolist_integer", API_RETURN_INT(0));
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "infolist_integer");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
infolist = Tcl_GetStringFromObj (objv[1], &i);
variable = Tcl_GetStringFromObj (objv[2], &i);
result = weechat_infolist_integer (script_str2ptr (infolist), variable);
- TCL_RETURN_INT(result);
+ API_RETURN_INT(result);
}
/*
@@ -7265,27 +5560,16 @@ weechat_tcl_api_infolist_string (ClientData clientData, Tcl_Interp *interp,
const char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "infolist_string");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_string", API_RETURN_EMPTY);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "infolist_string");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
infolist = Tcl_GetStringFromObj (objv[1], &i);
variable = Tcl_GetStringFromObj (objv[2], &i);
result = weechat_infolist_string (script_str2ptr (infolist), variable);
- TCL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -7301,27 +5585,16 @@ weechat_tcl_api_infolist_pointer (ClientData clientData, Tcl_Interp *interp,
char *infolist, *variable, *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "infolist_pointer");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_pointer", API_RETURN_EMPTY);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "infolist_pointer");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
infolist = Tcl_GetStringFromObj (objv[1], &i);
variable = Tcl_GetStringFromObj (objv[2], &i);
result = script_ptr2str (weechat_infolist_pointer (script_str2ptr (infolist), variable));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7337,20 +5610,9 @@ weechat_tcl_api_infolist_time (ClientData clientData, Tcl_Interp *interp,
char timebuffer[64], *result, *infolist, *variable;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "infolist_time");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "infolist_time", API_RETURN_EMPTY);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "infolist_time");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
infolist = Tcl_GetStringFromObj (objv[1], &i);
variable = Tcl_GetStringFromObj (objv[2], &i);
@@ -7359,7 +5621,7 @@ weechat_tcl_api_infolist_time (ClientData clientData, Tcl_Interp *interp,
result = strdup (timebuffer);
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7373,24 +5635,13 @@ weechat_tcl_api_infolist_free (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "infolist_free");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "infolist_free", API_RETURN_ERROR);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "infolist_free");
- TCL_RETURN_ERROR;
- }
+ API_WRONG_ARGS(API_RETURN_ERROR);
weechat_infolist_free (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* infolist */
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
@@ -7405,26 +5656,15 @@ weechat_tcl_api_hdata_get (ClientData clientData, Tcl_Interp *interp,
char *result, *name;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hdata_get");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_get", API_RETURN_EMPTY);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hdata_get");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
name = Tcl_GetStringFromObj (objv[1], &i);
result = script_ptr2str (weechat_hdata_get (name));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7439,27 +5679,16 @@ weechat_tcl_api_hdata_get_var_offset (ClientData clientData, Tcl_Interp *interp,
char *hdata, *name;
int result, i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hdata_get_var_offset");
- TCL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "hdata_get_var_offset", API_RETURN_INT(0));
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hdata_get_var_offset");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
hdata = Tcl_GetStringFromObj (objv[1], &i);
name = Tcl_GetStringFromObj (objv[2], &i);
result = weechat_hdata_get_var_offset (script_str2ptr (hdata), name);
- TCL_RETURN_INT(result);
+ API_RETURN_INT(result);
}
/*
@@ -7477,27 +5706,16 @@ weechat_tcl_api_hdata_get_var_type_string (ClientData clientData,
const char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hdata_get_var_type_string");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_get_var_type_string", API_RETURN_EMPTY);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hdata_get_var_type_string");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
hdata = Tcl_GetStringFromObj (objv[1], &i);
name = Tcl_GetStringFromObj (objv[2], &i);
result = weechat_hdata_get_var_type_string (script_str2ptr (hdata), name);
- TCL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -7513,27 +5731,16 @@ weechat_tcl_api_hdata_get_var_hdata (ClientData clientData, Tcl_Interp *interp,
const char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hdata_get_var_hdata");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_get_var_hdata", API_RETURN_EMPTY);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hdata_get_var_hdata");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
hdata = Tcl_GetStringFromObj (objv[1], &i);
name = Tcl_GetStringFromObj (objv[2], &i);
result = weechat_hdata_get_var_hdata (script_str2ptr (hdata), name);
- TCL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -7548,20 +5755,9 @@ weechat_tcl_api_hdata_get_list (ClientData clientData, Tcl_Interp *interp,
char *hdata, *name, *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hdata_get_list");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_get_list", API_RETURN_EMPTY);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hdata_get_list");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
hdata = Tcl_GetStringFromObj (objv[1], &i);
name = Tcl_GetStringFromObj (objv[2], &i);
@@ -7569,7 +5765,7 @@ weechat_tcl_api_hdata_get_list (ClientData clientData, Tcl_Interp *interp,
result = script_ptr2str (weechat_hdata_get_list (script_str2ptr (hdata),
name));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7584,35 +5780,21 @@ weechat_tcl_api_hdata_move (ClientData clientData, Tcl_Interp *interp,
char *hdata, *pointer, *result;
int i, count;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hdata_move");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_move", API_RETURN_EMPTY);
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hdata_move");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
hdata = Tcl_GetStringFromObj (objv[1], &i);
pointer = Tcl_GetStringFromObj (objv[2], &i);
if (Tcl_GetIntFromObj (interp, objv[3], &count) != TCL_OK)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hdata_move");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
result = script_ptr2str (weechat_hdata_move (script_str2ptr (hdata),
script_str2ptr (pointer),
count));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7628,20 +5810,9 @@ weechat_tcl_api_hdata_integer (ClientData clientData, Tcl_Interp *interp,
char *hdata, *pointer, *name;
int result, i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hdata_integer");
- TCL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "hdata_integer", API_RETURN_INT(0));
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hdata_integer");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
hdata = Tcl_GetStringFromObj (objv[1], &i);
pointer = Tcl_GetStringFromObj (objv[2], &i);
@@ -7651,7 +5822,7 @@ weechat_tcl_api_hdata_integer (ClientData clientData, Tcl_Interp *interp,
script_str2ptr (pointer),
name);
- TCL_RETURN_INT(result);
+ API_RETURN_INT(result);
}
/*
@@ -7667,20 +5838,9 @@ weechat_tcl_api_hdata_long (ClientData clientData, Tcl_Interp *interp,
char *hdata, *pointer, *name;
int result, i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hdata_long");
- TCL_RETURN_LONG(0);
- }
-
+ API_FUNC(1, "hdata_long", API_RETURN_LONG(0));
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hdata_long");
- TCL_RETURN_LONG(0);
- }
+ API_WRONG_ARGS(API_RETURN_LONG(0));
hdata = Tcl_GetStringFromObj (objv[1], &i);
pointer = Tcl_GetStringFromObj (objv[2], &i);
@@ -7690,7 +5850,7 @@ weechat_tcl_api_hdata_long (ClientData clientData, Tcl_Interp *interp,
script_str2ptr (pointer),
name);
- TCL_RETURN_LONG(result);
+ API_RETURN_LONG(result);
}
/*
@@ -7707,20 +5867,9 @@ weechat_tcl_api_hdata_string (ClientData clientData, Tcl_Interp *interp,
const char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hdata_string");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_string", API_RETURN_EMPTY);
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hdata_string");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
hdata = Tcl_GetStringFromObj (objv[1], &i);
pointer = Tcl_GetStringFromObj (objv[2], &i);
@@ -7730,7 +5879,7 @@ weechat_tcl_api_hdata_string (ClientData clientData, Tcl_Interp *interp,
script_str2ptr (pointer),
name);
- TCL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -7746,20 +5895,9 @@ weechat_tcl_api_hdata_pointer (ClientData clientData, Tcl_Interp *interp,
char *hdata, *pointer, *name, *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hdata_pointer");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_pointer", API_RETURN_EMPTY);
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hdata_pointer");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
hdata = Tcl_GetStringFromObj (objv[1], &i);
pointer = Tcl_GetStringFromObj (objv[2], &i);
@@ -7769,7 +5907,7 @@ weechat_tcl_api_hdata_pointer (ClientData clientData, Tcl_Interp *interp,
script_str2ptr (pointer),
name));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7786,20 +5924,9 @@ weechat_tcl_api_hdata_time (ClientData clientData, Tcl_Interp *interp,
char timebuffer[64], *result, *hdata, *pointer, *name;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hdata_time");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_time", API_RETURN_EMPTY);
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hdata_time");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
hdata = Tcl_GetStringFromObj (objv[1], &i);
pointer = Tcl_GetStringFromObj (objv[2], &i);
@@ -7812,7 +5939,7 @@ weechat_tcl_api_hdata_time (ClientData clientData, Tcl_Interp *interp,
result = strdup (timebuffer);
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7828,27 +5955,16 @@ weechat_tcl_api_hdata_get_string (ClientData clientData, Tcl_Interp *interp,
const char *result;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hdata_get_string");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "hdata_get_string", API_RETURN_EMPTY);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hdata_get_string");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
hdata = Tcl_GetStringFromObj (objv[1], &i);
property = Tcl_GetStringFromObj (objv[2], &i);
result = weechat_hdata_get_string (script_str2ptr (hdata), property);
- TCL_RETURN_STRING(result);
+ API_RETURN_STRING(result);
}
/*
@@ -7859,36 +5975,22 @@ static int
weechat_tcl_api_upgrade_new (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *result, *filename;
int i, write;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "upgrade_new");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "upgrade_new", API_RETURN_EMPTY);
if (objc < 3)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "upgrade_new");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
if (Tcl_GetIntFromObj (interp, objv[2], &write) != TCL_OK)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "upgrade_new");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
filename = Tcl_GetStringFromObj (objv[1], &i);
result = script_ptr2str (weechat_upgrade_new (filename, write));
- TCL_RETURN_STRING_FREE(result);
+ API_RETURN_STRING_FREE(result);
}
/*
@@ -7903,26 +6005,12 @@ weechat_tcl_api_upgrade_write_object (ClientData clientData, Tcl_Interp *interp,
char *upgrade_file, *infolist;
int rc, i, object_id;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "upgrade_write_object");
- TCL_RETURN_INT(0);
- }
-
+ API_FUNC(1, "upgrade_write_object", API_RETURN_INT(0));
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "upgrade_write_object");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
if (Tcl_GetIntFromObj (interp, objv[2], &object_id) != TCL_OK)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "upgrade_write_object");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
upgrade_file = Tcl_GetStringFromObj (objv[1], &i);
infolist = Tcl_GetStringFromObj (objv[3], &i);
@@ -7931,7 +6019,7 @@ weechat_tcl_api_upgrade_write_object (ClientData clientData, Tcl_Interp *interp,
object_id,
script_str2ptr (infolist));
- TCL_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -7945,7 +6033,7 @@ weechat_tcl_api_upgrade_read_cb (void *data,
struct t_infolist *infolist)
{
struct t_script_callback *script_callback;
- void *tcl_argv[4];
+ void *func_argv[4];
char empty_arg[1] = { '\0' }, str_object_id[32];
int *rc, ret;
@@ -7955,15 +6043,15 @@ weechat_tcl_api_upgrade_read_cb (void *data,
{
snprintf (str_object_id, sizeof (str_object_id), "%d", object_id);
- tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- tcl_argv[1] = script_ptr2str (upgrade_file);
- tcl_argv[2] = str_object_id;
- tcl_argv[3] = script_ptr2str (infolist);
+ func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[1] = script_ptr2str (upgrade_file);
+ func_argv[2] = str_object_id;
+ func_argv[3] = script_ptr2str (infolist);
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
- "ssss", tcl_argv);
+ "ssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -7972,10 +6060,10 @@ weechat_tcl_api_upgrade_read_cb (void *data,
ret = *rc;
free (rc);
}
- if (tcl_argv[1])
- free (tcl_argv[1]);
- if (tcl_argv[3])
- free (tcl_argv[3]);
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[3])
+ free (func_argv[3]);
return ret;
}
@@ -7991,24 +6079,13 @@ static int
weechat_tcl_api_upgrade_read (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
- Tcl_Obj* objp;
+ Tcl_Obj *objp;
char *upgrade_file, *function, *data;
int i, rc;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "upgrade_read");
- TCL_RETURN_EMPTY;
- }
-
+ API_FUNC(1, "upgrade_read", API_RETURN_EMPTY);
if (objc < 4)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "upgrade_read");
- TCL_RETURN_EMPTY;
- }
+ API_WRONG_ARGS(API_RETURN_EMPTY);
upgrade_file = Tcl_GetStringFromObj (objv[1], &i);
function = Tcl_GetStringFromObj (objv[2], &i);
@@ -8021,7 +6098,7 @@ weechat_tcl_api_upgrade_read (ClientData clientData, Tcl_Interp *interp,
function,
data);
- TCL_RETURN_INT(rc);
+ API_RETURN_INT(rc);
}
/*
@@ -8036,26 +6113,15 @@ weechat_tcl_api_upgrade_close (ClientData clientData, Tcl_Interp *interp,
char *upgrade_file;
int i;
- /* make C compiler happy */
- (void) clientData;
-
- if (!tcl_current_script || !tcl_current_script->name)
- {
- WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "upgrade_close");
- TCL_RETURN_ERROR;
- }
-
+ API_FUNC(1, "upgrade_close", API_RETURN_ERROR);
if (objc < 2)
- {
- WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "upgrade_close");
- TCL_RETURN_INT(0);
- }
+ API_WRONG_ARGS(API_RETURN_INT(0));
upgrade_file = Tcl_GetStringFromObj (objv[1], &i);
weechat_upgrade_close (script_str2ptr (upgrade_file));
- TCL_RETURN_OK;
+ API_RETURN_OK;
}
/*
diff --git a/src/plugins/scripts/tcl/weechat-tcl.c b/src/plugins/scripts/tcl/weechat-tcl.c
index bfeba401b..bb2990c82 100644
--- a/src/plugins/scripts/tcl/weechat-tcl.c
+++ b/src/plugins/scripts/tcl/weechat-tcl.c
@@ -367,7 +367,7 @@ void
weechat_tcl_unload (struct t_plugin_script *script)
{
Tcl_Interp* interp;
- void *pointer;
+ int *rc;
if ((weechat_tcl_plugin->debug >= 1) || !tcl_quiet)
{
@@ -378,12 +378,12 @@ weechat_tcl_unload (struct t_plugin_script *script)
if (script->shutdown_func && script->shutdown_func[0])
{
- pointer = weechat_tcl_exec (script,
- WEECHAT_SCRIPT_EXEC_INT,
- script->shutdown_func,
- NULL, NULL);
- if (pointer)
- free (pointer);
+ rc = (int *)weechat_tcl_exec (script,
+ WEECHAT_SCRIPT_EXEC_INT,
+ script->shutdown_func,
+ NULL, NULL);
+ if (rc)
+ free (rc);
}
interp = (Tcl_Interp*)script->interpreter;