diff options
Diffstat (limited to 'src/plugins/scripts')
-rw-r--r-- | src/plugins/scripts/lua/weechat-lua.c | 48 | ||||
-rw-r--r-- | src/plugins/scripts/perl/weechat-perl-api.c | 220 | ||||
-rw-r--r-- | src/plugins/scripts/perl/weechat-perl.c | 64 | ||||
-rw-r--r-- | src/plugins/scripts/python/weechat-python.c | 85 | ||||
-rw-r--r-- | src/plugins/scripts/ruby/weechat-ruby.c | 116 |
5 files changed, 266 insertions, 267 deletions
diff --git a/src/plugins/scripts/lua/weechat-lua.c b/src/plugins/scripts/lua/weechat-lua.c index dd5b76649..52c5ccf74 100644 --- a/src/plugins/scripts/lua/weechat-lua.c +++ b/src/plugins/scripts/lua/weechat-lua.c @@ -69,7 +69,7 @@ char *lua_action_remove_list = NULL; void * weechat_lua_exec (struct t_plugin_script *script, - int ret_type, const char *function, char **argv) + int ret_type, const char *function, char **argv) { void *ret_value; int argc, *ret_i; @@ -128,10 +128,10 @@ weechat_lua_exec (struct t_plugin_script *script, if (lua_pcall (lua_current_interpreter, argc, 1, 0) != 0) { - weechat_printf (NULL, + weechat_printf (NULL, weechat_gettext ("%s%s: unable to run function \"%s\""), weechat_prefix ("error"), LUA_PLUGIN_NAME, function); - weechat_printf (NULL, + weechat_printf (NULL, weechat_gettext ("%s%s: error: %s"), weechat_prefix ("error"), LUA_PLUGIN_NAME, lua_tostring (lua_current_interpreter, -1)); @@ -140,19 +140,19 @@ weechat_lua_exec (struct t_plugin_script *script, } if (ret_type == WEECHAT_SCRIPT_EXEC_STRING) - ret_value = strdup ((char *) lua_tostring (lua_current_interpreter, -1)); + ret_value = strdup ((char *) lua_tostring (lua_current_interpreter, -1)); else if (ret_type == WEECHAT_SCRIPT_EXEC_INT) { - ret_i = malloc (sizeof (*ret_i)); - if (ret_i) - *ret_i = lua_tonumber (lua_current_interpreter, -1); - ret_value = ret_i; + ret_i = malloc (sizeof (*ret_i)); + if (ret_i) + *ret_i = lua_tonumber (lua_current_interpreter, -1); + ret_value = ret_i; } else { WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, function); lua_current_script = old_lua_current_script; - return NULL; + return NULL; } lua_current_script = old_lua_current_script; @@ -165,13 +165,13 @@ weechat_lua_load (const char *filename) { FILE *fp; char *weechat_lua_code = { - "weechat_outputs = {\n" - " write = function (self, str)\n" - " weechat.print(\"\", \"lua: stdout/stderr: \" .. str)\n" + "weechat_outputs = {\n" + " write = function (self, str)\n" + " weechat.print(\"\", \"lua: stdout/stderr: \" .. str)\n" " end\n" - "}\n" - "io.stdout = weechat_outputs\n" - "io.stderr = weechat_outputs\n" + "}\n" + "io.stdout = weechat_outputs\n" + "io.stderr = weechat_outputs\n" }; if ((fp = fopen (filename, "r")) == NULL) @@ -235,7 +235,7 @@ weechat_lua_load (const char *filename) weechat_printf (NULL, weechat_gettext ("%s%s: unable to load file \"%s\""), weechat_prefix ("error"), LUA_PLUGIN_NAME, filename); - weechat_printf (NULL, + weechat_printf (NULL, weechat_gettext ("%s%s: error: %s"), weechat_prefix ("error"), LUA_PLUGIN_NAME, lua_tostring (lua_current_interpreter, -1)); @@ -250,15 +250,15 @@ weechat_lua_load (const char *filename) weechat_gettext ("%s%s: unable to execute file " "\"%s\""), weechat_prefix ("error"), LUA_PLUGIN_NAME, filename); - weechat_printf (NULL, + weechat_printf (NULL, weechat_gettext ("%s%s: error: %s"), weechat_prefix ("error"), LUA_PLUGIN_NAME, lua_tostring (lua_current_interpreter, -1)); lua_close (lua_current_interpreter); fclose (fp); - /* if script was registered, removing from list */ - if (lua_current_script) - script_remove (weechat_lua_plugin, &lua_scripts, &last_lua_script, + /* if script was registered, removing from list */ + if (lua_current_script) + script_remove (weechat_lua_plugin, &lua_scripts, &last_lua_script, lua_current_script); return 0; } @@ -270,7 +270,7 @@ weechat_lua_load (const char *filename) weechat_gettext ("%s%s: function \"register\" not " "found (or failed) in file \"%s\""), weechat_prefix ("error"), LUA_PLUGIN_NAME, filename); - lua_close (lua_current_interpreter); + lua_close (lua_current_interpreter); return 0; } @@ -311,10 +311,10 @@ weechat_lua_unload (struct t_plugin_script *script) { r = weechat_lua_exec (script, WEECHAT_SCRIPT_EXEC_INT, - script->shutdown_func, + script->shutdown_func, lua_argv); - if (r) - free (r); + if (r) + free (r); } interpreter = script->interpreter; diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c index cd420b905..4406b097c 100644 --- a/src/plugins/scripts/perl/weechat-perl-api.c +++ b/src/plugins/scripts/perl/weechat-perl-api.c @@ -452,7 +452,7 @@ XS (XS_weechat_api_list_new) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "list_new"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } result = script_ptr2str (weechat_list_new ()); @@ -475,7 +475,7 @@ XS (XS_weechat_api_list_add) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "list_add"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 4) @@ -512,7 +512,7 @@ XS (XS_weechat_api_list_search) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "list_search"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 2) @@ -545,7 +545,7 @@ XS (XS_weechat_api_list_casesearch) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "list_casesearch"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 2) @@ -578,7 +578,7 @@ XS (XS_weechat_api_list_get) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "list_get"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 2) @@ -608,7 +608,7 @@ XS (XS_weechat_api_list_set) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "list_set"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } if (items < 2) @@ -640,7 +640,7 @@ XS (XS_weechat_api_list_next) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "list_next"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 1) @@ -669,7 +669,7 @@ XS (XS_weechat_api_list_prev) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "list_prev"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 1) @@ -698,7 +698,7 @@ XS (XS_weechat_api_list_string) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "list_string"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 1) @@ -727,7 +727,7 @@ XS (XS_weechat_api_list_size) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "list_size"); - PERL_RETURN_INT(0); + PERL_RETURN_INT(0); } if (items < 1) @@ -756,7 +756,7 @@ XS (XS_weechat_api_list_remove) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "list_remove"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } if (items < 2) @@ -787,7 +787,7 @@ XS (XS_weechat_api_list_remove_all) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "list_remove_all"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } if (items < 1) @@ -815,7 +815,7 @@ XS (XS_weechat_api_list_free) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "list_free"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } if (items < 1) @@ -885,7 +885,7 @@ XS (XS_weechat_api_config_new) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_new"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 3) @@ -1143,7 +1143,7 @@ XS (XS_weechat_api_config_new_section) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_new_section"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 14) @@ -1205,7 +1205,7 @@ XS (XS_weechat_api_config_search_section) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_search_section"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 2) @@ -1351,7 +1351,7 @@ XS (XS_weechat_api_config_new_option) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_new_option"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 17) @@ -1416,7 +1416,7 @@ XS (XS_weechat_api_config_search_option) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_search_option"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 3) @@ -1451,7 +1451,7 @@ XS (XS_weechat_api_config_string_to_boolean) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_string_to_boolean"); - PERL_RETURN_INT(0); + PERL_RETURN_INT(0); } if (items < 1) @@ -1481,7 +1481,7 @@ XS (XS_weechat_api_config_option_reset) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_option_reset"); - PERL_RETURN_INT(0); + PERL_RETURN_INT(0); } if (items < 2) @@ -1514,7 +1514,7 @@ XS (XS_weechat_api_config_option_set) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_option_set"); - PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR); + PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR); } if (items < 3) @@ -1549,7 +1549,7 @@ XS (XS_weechat_api_config_option_set_null) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_option_set_null"); - PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR); + PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR); } if (items < 2) @@ -1582,7 +1582,7 @@ XS (XS_weechat_api_config_option_unset) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_option_unset"); - PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR); + PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR); } if (items < 1) @@ -1613,7 +1613,7 @@ XS (XS_weechat_api_config_option_rename) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_option_rename"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } if (items < 2) @@ -1646,7 +1646,7 @@ XS (XS_weechat_api_config_option_is_null) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_option_is_null"); - PERL_RETURN_INT(1); + PERL_RETURN_INT(1); } if (items < 1) @@ -1676,7 +1676,7 @@ XS (XS_weechat_api_config_option_default_is_null) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_option_default_is_null"); - PERL_RETURN_INT(1); + PERL_RETURN_INT(1); } if (items < 1) @@ -1705,7 +1705,7 @@ XS (XS_weechat_api_config_boolean) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_boolean"); - PERL_RETURN_INT(0); + PERL_RETURN_INT(0); } if (items < 1) @@ -1734,7 +1734,7 @@ XS (XS_weechat_api_config_boolean_default) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_boolean_default"); - PERL_RETURN_INT(0); + PERL_RETURN_INT(0); } if (items < 1) @@ -1763,7 +1763,7 @@ XS (XS_weechat_api_config_integer) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_integer"); - PERL_RETURN_INT(0); + PERL_RETURN_INT(0); } if (items < 1) @@ -1792,7 +1792,7 @@ XS (XS_weechat_api_config_integer_default) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_integer_default"); - PERL_RETURN_INT(0); + PERL_RETURN_INT(0); } if (items < 1) @@ -1821,7 +1821,7 @@ XS (XS_weechat_api_config_string) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_string"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 1) @@ -1850,7 +1850,7 @@ XS (XS_weechat_api_config_string_default) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_string_default"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 1) @@ -1879,7 +1879,7 @@ XS (XS_weechat_api_config_color) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_color"); - PERL_RETURN_INT(0); + PERL_RETURN_INT(0); } if (items < 1) @@ -1908,7 +1908,7 @@ XS (XS_weechat_api_config_color_default) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_color_default"); - PERL_RETURN_INT(0); + PERL_RETURN_INT(0); } if (items < 1) @@ -1937,7 +1937,7 @@ XS (XS_weechat_api_config_write_option) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_write_option"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } if (items < 2) @@ -1970,7 +1970,7 @@ XS (XS_weechat_api_config_write_line) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_write_line"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } if (items < 3) @@ -2004,7 +2004,7 @@ XS (XS_weechat_api_config_write) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_write"); - PERL_RETURN_INT(-1); + PERL_RETURN_INT(-1); } if (items < 1) @@ -2033,7 +2033,7 @@ XS (XS_weechat_api_config_read) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_read"); - PERL_RETURN_INT(-1); + PERL_RETURN_INT(-1); } if (items < 1) @@ -2062,7 +2062,7 @@ XS (XS_weechat_api_config_reload) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_reload"); - PERL_RETURN_INT(-1); + PERL_RETURN_INT(-1); } if (items < 1) @@ -2090,7 +2090,7 @@ XS (XS_weechat_api_config_option_free) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_option_free"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } if (items < 1) @@ -2121,7 +2121,7 @@ XS (XS_weechat_api_config_section_free_options) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_section_free_options"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } if (items < 1) @@ -2151,7 +2151,7 @@ XS (XS_weechat_api_config_section_free) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_section_free"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } if (items < 1) @@ -2181,7 +2181,7 @@ XS (XS_weechat_api_config_free) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_free"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } if (items < 1) @@ -2212,7 +2212,7 @@ XS (XS_weechat_api_config_get) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_get"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 1) @@ -2241,7 +2241,7 @@ XS (XS_weechat_api_config_get_plugin) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_get_plugin"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 1) @@ -2307,7 +2307,7 @@ XS (XS_weechat_api_config_set_plugin) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_set_plugin"); - PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR); + PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR); } if (items < 2) @@ -2343,7 +2343,7 @@ XS (XS_weechat_api_config_unset_plugin) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_unset_plugin"); - PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR); + PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR); } if (items < 1) @@ -2614,7 +2614,7 @@ XS (XS_weechat_api_hook_command) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_command"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 7) @@ -2702,7 +2702,7 @@ XS (XS_weechat_api_hook_command_run) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_command_run"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 3) @@ -2781,7 +2781,7 @@ XS (XS_weechat_api_hook_timer) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_timer"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 5) @@ -2857,7 +2857,7 @@ XS (XS_weechat_api_hook_fd) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_fd"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 6) @@ -3136,7 +3136,7 @@ XS (XS_weechat_api_hook_print) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_print"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 6) @@ -3239,7 +3239,7 @@ XS (XS_weechat_api_hook_signal) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_signal"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 3) @@ -3278,7 +3278,7 @@ XS (XS_weechat_api_hook_signal_send) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_signal_send"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } if (items < 3) @@ -3369,7 +3369,7 @@ XS (XS_weechat_api_hook_config) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_config"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 3) @@ -3453,7 +3453,7 @@ XS (XS_weechat_api_hook_completion) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_completion"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 4) @@ -3493,7 +3493,7 @@ XS (XS_weechat_api_hook_completion_list_add) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_completion_list_add"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } if (items < 4) @@ -3559,7 +3559,7 @@ XS (XS_weechat_api_hook_modifier) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_modifier"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 3) @@ -3597,7 +3597,7 @@ XS (XS_weechat_api_hook_modifier_exec) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_modifier_exec"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 3) @@ -3659,7 +3659,7 @@ XS (XS_weechat_api_hook_info) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_info"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 4) @@ -3735,7 +3735,7 @@ XS (XS_weechat_api_hook_infolist) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hook_infolist"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 4) @@ -3774,7 +3774,7 @@ XS (XS_weechat_api_unhook) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "unhook"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } if (items < 1) @@ -3805,7 +3805,7 @@ XS (XS_weechat_api_unhook_all) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "unhook_all"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } script_api_unhook_all (perl_current_script); @@ -3952,7 +3952,7 @@ XS (XS_weechat_api_buffer_search) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "buffer_search"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 2) @@ -3985,7 +3985,7 @@ XS (XS_weechat_api_buffer_search_main) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "buffer_search_main"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } result = script_ptr2str (weechat_buffer_search_main ()); @@ -4009,7 +4009,7 @@ XS (XS_weechat_api_current_buffer) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "current_buffer"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } result = script_ptr2str (weechat_current_buffer ()); @@ -4031,7 +4031,7 @@ XS (XS_weechat_api_buffer_clear) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "buffer_clear"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } if (items < 1) @@ -4059,7 +4059,7 @@ XS (XS_weechat_api_buffer_close) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "buffer_close"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } if (items < 1) @@ -4089,7 +4089,7 @@ XS (XS_weechat_api_buffer_merge) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "buffer_merge"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } if (items < 2) @@ -4118,7 +4118,7 @@ XS (XS_weechat_api_buffer_unmerge) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "buffer_unmerge"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } if (items < 2) @@ -4149,7 +4149,7 @@ XS (XS_weechat_api_buffer_get_integer) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "buffer_get_integer"); - PERL_RETURN_INT(-1); + PERL_RETURN_INT(-1); } if (items < 2) @@ -4182,7 +4182,7 @@ XS (XS_weechat_api_buffer_get_string) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "buffer_get_string"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 2) @@ -4214,7 +4214,7 @@ XS (XS_weechat_api_buffer_get_pointer) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "buffer_get_pointer"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 2) @@ -4314,7 +4314,7 @@ XS (XS_weechat_api_current_window) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "current_window"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } result = script_ptr2str (weechat_current_window ()); @@ -4338,7 +4338,7 @@ XS (XS_weechat_api_window_get_integer) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "window_get_integer"); - PERL_RETURN_INT(-1); + PERL_RETURN_INT(-1); } if (items < 2) @@ -4371,7 +4371,7 @@ XS (XS_weechat_api_window_get_string) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "window_get_string"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 2) @@ -4403,7 +4403,7 @@ XS (XS_weechat_api_window_get_pointer) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "window_get_pointer"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 2) @@ -4435,7 +4435,7 @@ XS (XS_weechat_api_window_set_title) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "window_set_title"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } if (items < 1) @@ -4464,7 +4464,7 @@ XS (XS_weechat_api_nicklist_add_group) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_add_group"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 5) @@ -4502,7 +4502,7 @@ XS (XS_weechat_api_nicklist_search_group) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_search_group"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 3) @@ -4537,7 +4537,7 @@ XS (XS_weechat_api_nicklist_add_nick) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_add_nick"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 7) @@ -4579,7 +4579,7 @@ XS (XS_weechat_api_nicklist_search_nick) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_search_nick"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 3) @@ -4614,7 +4614,7 @@ XS (XS_weechat_api_nicklist_remove_group) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_remove_group"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } if (items < 2) @@ -4647,7 +4647,7 @@ XS (XS_weechat_api_nicklist_remove_nick) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_remove_nick"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } if (items < 2) @@ -4679,7 +4679,7 @@ XS (XS_weechat_api_nicklist_remove_all) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_remove_all"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } if (items < 2) @@ -4708,7 +4708,7 @@ XS (XS_weechat_api_bar_item_search) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "bar_item_search"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 1) @@ -4773,7 +4773,7 @@ XS (XS_weechat_api_bar_item_new) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "bar_item_new"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 3) @@ -4810,7 +4810,7 @@ XS (XS_weechat_api_bar_item_update) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "bar_item_update"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } if (items < 1) @@ -4838,7 +4838,7 @@ XS (XS_weechat_api_bar_item_remove) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "bar_item_remove"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } if (items < 1) @@ -4869,7 +4869,7 @@ XS (XS_weechat_api_bar_search) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "bar_search"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 1) @@ -4900,7 +4900,7 @@ XS (XS_weechat_api_bar_new) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "bar_new"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 15) @@ -4959,7 +4959,7 @@ XS (XS_weechat_api_bar_set) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "bar_set"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } if (items < 3) @@ -4991,7 +4991,7 @@ XS (XS_weechat_api_bar_update) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "bar_update"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } if (items < 1) @@ -5019,7 +5019,7 @@ XS (XS_weechat_api_bar_remove) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "bar_remove"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } if (items < 1) @@ -5084,7 +5084,7 @@ XS (XS_weechat_api_info_get) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "info_get"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 2) @@ -5117,7 +5117,7 @@ XS (XS_weechat_api_infolist_new) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_new"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } result = script_ptr2str (weechat_infolist_new ()); @@ -5140,7 +5140,7 @@ XS (XS_weechat_api_infolist_new_item) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_new_item"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 1) @@ -5171,7 +5171,7 @@ XS (XS_weechat_api_infolist_new_var_integer) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_new_var_integer"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 3) @@ -5205,7 +5205,7 @@ XS (XS_weechat_api_infolist_new_var_string) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_new_var_string"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 3) @@ -5240,7 +5240,7 @@ XS (XS_weechat_api_infolist_new_var_pointer) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_new_var_pointer"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 3) @@ -5275,7 +5275,7 @@ XS (XS_weechat_api_infolist_new_var_time) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_new_var_time"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 3) @@ -5309,7 +5309,7 @@ XS (XS_weechat_api_infolist_get) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_get"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 3) @@ -5344,7 +5344,7 @@ XS (XS_weechat_api_infolist_next) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_next"); - PERL_RETURN_INT(0); + PERL_RETURN_INT(0); } if (items < 1) @@ -5373,7 +5373,7 @@ XS (XS_weechat_api_infolist_prev) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_prev"); - PERL_RETURN_INT(0); + PERL_RETURN_INT(0); } if (items < 1) @@ -5402,7 +5402,7 @@ XS (XS_weechat_api_infolist_fields) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_fields"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 1) @@ -5432,7 +5432,7 @@ XS (XS_weechat_api_infolist_integer) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_integer"); - PERL_RETURN_INT(0); + PERL_RETURN_INT(0); } if (items < 2) @@ -5465,7 +5465,7 @@ XS (XS_weechat_api_infolist_string) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_string"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 2) @@ -5498,7 +5498,7 @@ XS (XS_weechat_api_infolist_pointer) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_pointer"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 2) @@ -5531,7 +5531,7 @@ XS (XS_weechat_api_infolist_time) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_time"); - PERL_RETURN_EMPTY; + PERL_RETURN_EMPTY; } if (items < 2) @@ -5563,7 +5563,7 @@ XS (XS_weechat_api_infolist_free) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_free"); - PERL_RETURN_ERROR; + PERL_RETURN_ERROR; } if (items < 1) diff --git a/src/plugins/scripts/perl/weechat-perl.c b/src/plugins/scripts/perl/weechat-perl.c index fc6e04323..76b4b9948 100644 --- a/src/plugins/scripts/perl/weechat-perl.c +++ b/src/plugins/scripts/perl/weechat-perl.c @@ -126,7 +126,7 @@ char *perl_weechat_code = void * weechat_perl_exec (struct t_plugin_script *script, - int ret_type, const char *function, char **argv) + int ret_type, const char *function, char **argv) { char *func; unsigned int count; @@ -173,7 +173,7 @@ weechat_perl_exec (struct t_plugin_script *script, weechat_gettext ("%s%s: error: %s"), weechat_prefix ("error"), PERL_PLUGIN_NAME, SvPV_nolen (ERRSV)); - (void) POPs; /* poping the 'undef' */ + (void) POPs; /* poping the 'undef' */ mem_err = 0; } else @@ -302,7 +302,7 @@ weechat_perl_load (const char *filename) perl_construct (perl_current_interpreter); temp_script.interpreter = (PerlInterpreter *) perl_current_interpreter; perl_parse (perl_current_interpreter, weechat_perl_api_init, - perl_args_count, perl_args, NULL); + perl_args_count, perl_args, NULL); eval_pv (perl_weechat_code, TRUE); perl_argv[0] = (char *)filename; @@ -316,23 +316,23 @@ weechat_perl_load (const char *filename) perl_argv[2] = NULL; #endif eval = weechat_perl_exec (&temp_script, - WEECHAT_SCRIPT_EXEC_INT, - "weechat_perl_load_eval_file", + WEECHAT_SCRIPT_EXEC_INT, + "weechat_perl_load_eval_file", perl_argv); if (!eval) { - weechat_printf (NULL, + weechat_printf (NULL, weechat_gettext ("%s%s: not enough memory to parse " "file \"%s\""), weechat_prefix ("error"), PERL_PLUGIN_NAME, filename); - return 0; + return 0; } if (*eval != 0) { - if (*eval == 2) - { - weechat_printf (NULL, + if (*eval == 2) + { + weechat_printf (NULL, weechat_gettext ("%s%s: unable to parse file " "\"%s\""), weechat_prefix ("error"), PERL_PLUGIN_NAME, @@ -351,42 +351,42 @@ weechat_perl_load (const char *filename) "weechat_perl_load_eval_file_error", FALSE), len)); #endif - } - else if (*eval == 1) - { - weechat_printf (NULL, + } + else if (*eval == 1) + { + weechat_printf (NULL, weechat_gettext ("%s%s: unable to run file \"%s\""), weechat_prefix ("error"), PERL_PLUGIN_NAME, filename); - } - else + } + else { - weechat_printf (NULL, + weechat_printf (NULL, weechat_gettext ("%s%s: unknown error while " "loading file \"%s\""), weechat_prefix ("error"), PERL_PLUGIN_NAME, filename); - } + } #ifdef MULTIPLICITY - perl_destruct (perl_current_interpreter); + perl_destruct (perl_current_interpreter); perl_free (perl_current_interpreter); #endif - if (perl_current_script && (perl_current_script != &temp_script)) + if (perl_current_script && (perl_current_script != &temp_script)) { script_remove (weechat_perl_plugin, &perl_scripts, &last_perl_script, perl_current_script); } - - free (eval); - return 0; + + free (eval); + return 0; } free (eval); if (!perl_current_script) { - weechat_printf (NULL, + weechat_printf (NULL, weechat_gettext ("%s%s: function \"register\" not " "found (or failed) in file \"%s\""), weechat_prefix ("error"), PERL_PLUGIN_NAME, filename); @@ -444,10 +444,10 @@ weechat_perl_unload (struct t_plugin_script *script) { r = (int *) weechat_perl_exec (script, WEECHAT_SCRIPT_EXEC_INT, - script->shutdown_func, + script->shutdown_func, perl_argv); - if (r) - free (r); + if (r) + free (r); } interpreter = script->interpreter; @@ -464,7 +464,7 @@ weechat_perl_unload (struct t_plugin_script *script) perl_free (interpreter); #else if (interpreter) - free (interpreter); + free (interpreter); #endif } @@ -794,7 +794,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) perl_construct (perl_main); perl_parse (perl_main, weechat_perl_api_init, perl_args_count, - perl_args, NULL); + perl_args, NULL); eval_pv (perl_weechat_code, TRUE); #endif @@ -841,9 +841,9 @@ weechat_plugin_end (struct t_weechat_plugin *plugin) /* free perl intepreter */ if (perl_main) { - perl_destruct (perl_main); - perl_free (perl_main); - perl_main = NULL; + perl_destruct (perl_main); + perl_free (perl_main); + perl_main = NULL; } #endif diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c index 7cc56321c..446a16257 100644 --- a/src/plugins/scripts/python/weechat-python.c +++ b/src/plugins/scripts/python/weechat-python.c @@ -67,7 +67,7 @@ char python_buffer_output[128]; void * weechat_python_exec (struct t_plugin_script *script, - int ret_type, const char *function, char **argv) + int ret_type, const char *function, char **argv) { struct t_plugin_script *old_python_current_script; PyThreadState *old_interpreter; @@ -97,10 +97,10 @@ weechat_python_exec (struct t_plugin_script *script, weechat_printf (NULL, weechat_gettext ("%s%s: unable to run function \"%s\""), weechat_prefix ("error"), PYTHON_PLUGIN_NAME, function); - /* PyEval_ReleaseThread (python_current_script->interpreter); */ + /* PyEval_ReleaseThread (python_current_script->interpreter); */ if (old_interpreter) PyThreadState_Swap (old_interpreter); - return NULL; + return NULL; } python_current_script = script; @@ -184,7 +184,7 @@ weechat_python_exec (struct t_plugin_script *script, because of '#define WEECHAT_RC_OK 0' */ if (rc == NULL) - rc = PyInt_FromLong (0); + rc = PyInt_FromLong (0); if (PyErr_Occurred()) { @@ -193,19 +193,18 @@ weechat_python_exec (struct t_plugin_script *script, } else if (PyString_Check (rc) && (ret_type == WEECHAT_SCRIPT_EXEC_STRING)) { - if (PyString_AsString (rc)) - ret_value = strdup (PyString_AsString(rc)); - else - ret_value = NULL; - - Py_XDECREF(rc); + if (PyString_AsString (rc)) + ret_value = strdup (PyString_AsString(rc)); + else + ret_value = NULL; + + Py_XDECREF(rc); } else if (PyInt_Check (rc) && (ret_type == WEECHAT_SCRIPT_EXEC_INT)) { - - ret_i = malloc (sizeof (*ret_i)); - if (ret_i) - *ret_i = (int) PyInt_AsLong(rc); + ret_i = malloc (sizeof (*ret_i)); + if (ret_i) + *ret_i = (int) PyInt_AsLong(rc); ret_value = ret_i; Py_XDECREF(rc); @@ -253,39 +252,39 @@ weechat_python_output (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &msg)) { if (strlen(python_buffer_output) > 0) - { - weechat_printf (NULL, + { + weechat_printf (NULL, weechat_gettext ("%s: stdout/stderr: %s%s"), PYTHON_PLUGIN_NAME, python_buffer_output, ""); - python_buffer_output[0] = '\0'; - } + python_buffer_output[0] = '\0'; + } } else { - m = msg; - while ((p = strchr (m, '\n')) != NULL) - { - *p = '\0'; - if (strlen (m) + strlen (python_buffer_output) > 0) + m = msg; + while ((p = strchr (m, '\n')) != NULL) + { + *p = '\0'; + if (strlen (m) + strlen (python_buffer_output) > 0) { - weechat_printf (NULL, + weechat_printf (NULL, weechat_gettext ("%s: stdout/stderr: %s%s"), PYTHON_PLUGIN_NAME, python_buffer_output, m); } - *p = '\n'; - python_buffer_output[0] = '\0'; - m = ++p; - } - - if (strlen(m) + strlen(python_buffer_output) > sizeof(python_buffer_output)) - { - weechat_printf (NULL, + *p = '\n'; + python_buffer_output[0] = '\0'; + m = ++p; + } + + if (strlen(m) + strlen(python_buffer_output) > sizeof(python_buffer_output)) + { + weechat_printf (NULL, weechat_gettext ("%s: stdout/stderr: %s%s"), PYTHON_PLUGIN_NAME, python_buffer_output, m); - python_buffer_output[0] = '\0'; - } - else - strcat (python_buffer_output, m); + python_buffer_output[0] = '\0'; + } + else + strcat (python_buffer_output, m); } Py_INCREF(Py_None); @@ -361,7 +360,7 @@ weechat_python_load (const char *filename) "module"), weechat_prefix ("error"), PYTHON_PLUGIN_NAME); fclose (fp); - + Py_EndInterpreter (python_current_interpreter); /* PyEval_ReleaseLock (); */ @@ -497,7 +496,7 @@ weechat_python_load (const char *filename) weechat_gettext ("%s%s: function \"register\" not " "found (or failed) in file \"%s\""), weechat_prefix ("error"), PYTHON_PLUGIN_NAME, filename); - + if (PyErr_Occurred ()) PyErr_Print (); Py_EndInterpreter (python_current_interpreter); @@ -543,9 +542,9 @@ weechat_python_unload (struct t_plugin_script *script) if (script->shutdown_func && script->shutdown_func[0]) { r = (int *) weechat_python_exec (script, WEECHAT_SCRIPT_EXEC_INT, - script->shutdown_func, NULL); - if (r) - free (r); + script->shutdown_func, NULL); + if (r) + free (r); } old_interpreter = PyThreadState_Swap (NULL); @@ -914,9 +913,9 @@ weechat_plugin_end (struct t_weechat_plugin *plugin) /* free Python interpreter */ if (python_mainThreadState != NULL) { - /* PyEval_AcquireLock (); */ + /* PyEval_AcquireLock (); */ PyThreadState_Swap (python_mainThreadState); - /* PyEval_ReleaseLock (); */ + /* PyEval_ReleaseLock (); */ python_mainThreadState = NULL; } diff --git a/src/plugins/scripts/ruby/weechat-ruby.c b/src/plugins/scripts/ruby/weechat-ruby.c index cff3d4829..166b4685a 100644 --- a/src/plugins/scripts/ruby/weechat-ruby.c +++ b/src/plugins/scripts/ruby/weechat-ruby.c @@ -221,7 +221,7 @@ weechat_ruby_print_exception (VALUE err) void * weechat_ruby_exec (struct t_plugin_script *script, - int ret_type, const char *function, char **argv) + int ret_type, const char *function, char **argv) { VALUE rc, err; int ruby_error, *ret_i; @@ -336,48 +336,48 @@ weechat_ruby_exec (struct t_plugin_script *script, if (ruby_error) { - weechat_printf (NULL, + weechat_printf (NULL, weechat_gettext ("%s%s: unable to run function \"%s\""), weechat_prefix ("error"), RUBY_PLUGIN_NAME, function); - - err = rb_gv_get("$!"); - weechat_ruby_print_exception(err); - return NULL; + err = rb_gv_get("$!"); + weechat_ruby_print_exception(err); + + return NULL; } if ((TYPE(rc) == T_STRING) && (ret_type == WEECHAT_SCRIPT_EXEC_STRING)) { - if (STR2CSTR (rc)) - ret_value = strdup (STR2CSTR (rc)); - else - ret_value = NULL; + if (STR2CSTR (rc)) + ret_value = strdup (STR2CSTR (rc)); + else + ret_value = NULL; } else if ((TYPE(rc) == T_FIXNUM) && (ret_type == WEECHAT_SCRIPT_EXEC_INT)) { - ret_i = malloc (sizeof (*ret_i)); - if (ret_i) - *ret_i = NUM2INT(rc); - ret_value = ret_i; + ret_i = malloc (sizeof (*ret_i)); + if (ret_i) + *ret_i = NUM2INT(rc); + ret_value = ret_i; } else { - weechat_printf (NULL, + weechat_printf (NULL, weechat_gettext ("%s%s: function \"%s\" must return a " "valid value"), weechat_prefix ("error"), RUBY_PLUGIN_NAME, function); ruby_current_script = old_ruby_current_script; - return WEECHAT_RC_OK; + return WEECHAT_RC_OK; } if (ret_value == NULL) { - weechat_printf (NULL, + weechat_printf (NULL, weechat_gettext ("%s%s: not enough memory in function " "\"%s\""), weechat_prefix ("error"), RUBY_PLUGIN_NAME, function); ruby_current_script = old_ruby_current_script; - return NULL; + return NULL; } ruby_current_script = old_ruby_current_script; @@ -402,32 +402,32 @@ weechat_ruby_output (VALUE self, VALUE str) m = msg; while ((p = strchr (m, '\n')) != NULL) { - *p = '\0'; - if (strlen (m) + strlen (ruby_buffer_output) > 0) + *p = '\0'; + if (strlen (m) + strlen (ruby_buffer_output) > 0) { weechat_printf (NULL, weechat_gettext ("%s%s: stdout/stderr: %s%s"), weechat_prefix ("error"), RUBY_PLUGIN_NAME, ruby_buffer_output, m); } - *p = '\n'; - ruby_buffer_output[0] = '\0'; - m = ++p; + *p = '\n'; + ruby_buffer_output[0] = '\0'; + m = ++p; } if (strlen(m) + strlen(ruby_buffer_output) > sizeof(ruby_buffer_output)) { - weechat_printf (NULL, + weechat_printf (NULL, weechat_gettext ("%s%s: stdout/stderr: %s%s"), weechat_prefix ("error"), RUBY_PLUGIN_NAME, ruby_buffer_output, m); - ruby_buffer_output[0] = '\0'; + ruby_buffer_output[0] = '\0'; } else - strcat (ruby_buffer_output, m); + strcat (ruby_buffer_output, m); if (msg) - free (msg); + free (msg); return Qnil; } @@ -483,19 +483,19 @@ weechat_ruby_load (const char *filename) ruby_current_script_filename = filename; ruby_retcode = rb_protect_funcall (curModule, rb_intern("load_eval_file"), - &ruby_error, 1, rb_str_new2(filename)); + &ruby_error, 1, rb_str_new2(filename)); if (ruby_retcode == Qnil) { - err = rb_gv_get("$!"); - weechat_ruby_print_exception(err); - return 0; + err = rb_gv_get("$!"); + weechat_ruby_print_exception(err); + return 0; } if (NUM2INT(ruby_retcode) != 0) { - switch (NUM2INT(ruby_retcode)) - { + switch (NUM2INT(ruby_retcode)) + { case 1: weechat_printf (NULL, weechat_gettext ("%s%s: unable to read file " @@ -518,14 +518,14 @@ weechat_ruby_load (const char *filename) weechat_prefix ("error"), RUBY_PLUGIN_NAME, filename); break; - } - - if (NUM2INT(ruby_retcode) == 1 || NUM2INT(ruby_retcode) == 2) - { - weechat_ruby_print_exception(rb_iv_get(curModule, "@load_eval_file_error")); - } - - return 0; + } + + if (NUM2INT(ruby_retcode) == 1 || NUM2INT(ruby_retcode) == 2) + { + weechat_ruby_print_exception(rb_iv_get(curModule, "@load_eval_file_error")); + } + + return 0; } ruby_retcode = rb_protect_funcall (curModule, rb_intern("weechat_init"), @@ -533,27 +533,27 @@ weechat_ruby_load (const char *filename) if (ruby_error) { - weechat_printf (NULL, + weechat_printf (NULL, weechat_gettext ("%s%s: unable to eval function " "\"weechat_init\" in file \"%s\""), weechat_prefix ("error"), RUBY_PLUGIN_NAME, filename); - - err = rb_gv_get("$!"); - weechat_ruby_print_exception(err); - - if (ruby_current_script != NULL) + + err = rb_gv_get("$!"); + weechat_ruby_print_exception(err); + + if (ruby_current_script != NULL) { - script_remove (weechat_ruby_plugin, + script_remove (weechat_ruby_plugin, &ruby_scripts, &last_ruby_script, ruby_current_script); } - - return 0; + + return 0; } if (ruby_current_script == NULL) { - weechat_printf (NULL, + weechat_printf (NULL, weechat_gettext ("%s%s: function \"register\" not " "found (or failed) in file \"%s\""), weechat_prefix ("error"), RUBY_PLUGIN_NAME, filename); @@ -598,10 +598,10 @@ weechat_ruby_unload (struct t_plugin_script *script) { r = (int *) weechat_ruby_exec (script, WEECHAT_SCRIPT_EXEC_INT, - script->shutdown_func, + script->shutdown_func, ruby_argv); - if (r) - free (r); + if (r) + free (r); } interpreter = script->interpreter; @@ -614,7 +614,7 @@ weechat_ruby_unload (struct t_plugin_script *script) script); if (interpreter) - rb_gc_unregister_address (interpreter); + rb_gc_unregister_address (interpreter); } /* @@ -651,7 +651,7 @@ weechat_ruby_unload_all () { while (ruby_scripts) { - weechat_ruby_unload (ruby_scripts); + weechat_ruby_unload (ruby_scripts); } } @@ -927,7 +927,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) " rescue => e\n" " return 1\n" " end\n" - "\n" + "\n" " begin\n" " module_eval(lines)\n" " rescue Exception => e\n" @@ -991,7 +991,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) weechat_prefix ("error"), RUBY_PLUGIN_NAME); VALUE err = rb_gv_get("$!"); weechat_ruby_print_exception(err); - return WEECHAT_RC_ERROR; + return WEECHAT_RC_ERROR; } ruby_quiet = 1; |