summaryrefslogtreecommitdiff
path: root/src/plugins/scripts/tcl
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2011-10-26 18:51:16 +0200
committerSebastien Helleu <flashcode@flashtux.org>2011-10-26 18:51:16 +0200
commitd95aef21346b04c1fc17d52b96d0dfaa0cf3d43c (patch)
tree9b1ede10258e6a196ad6b699415ca09c42d68670 /src/plugins/scripts/tcl
parentb3ac47bcf1bd096c1b9484bd8dbe19e6eaf015aa (diff)
downloadweechat-d95aef21346b04c1fc17d52b96d0dfaa0cf3d43c.zip
script plugins: use new macros to reduce code length
Diffstat (limited to 'src/plugins/scripts/tcl')
-rw-r--r--src/plugins/scripts/tcl/weechat-tcl-api.c3656
-rw-r--r--src/plugins/scripts/tcl/weechat-tcl.c14
2 files changed, 868 insertions, 2802 deletions
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;