diff --git src plugins scripts perl weechat-perl-api src plugins scrip

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c
index 91ea5de..b689ba6 100644
--- a/src/plugins/scripts/perl/weechat-perl-api.c
+++ b/src/plugins/scripts/perl/weechat-perl-api.c
@@ -2716,7 +2716,7 @@ static XS (XS_weechat_info_get)
}
/*
- * weechat_perl_xs_init: initialize subroutines
+ * weechat_perl_api_init: initialize subroutines
*/
void
diff --git a/src/plugins/scripts/perl/weechat-perl.c b/src/plugins/scripts/perl/weechat-perl.c
index 4887436..c843ca7 100644
--- a/src/plugins/scripts/perl/weechat-perl.c
+++ b/src/plugins/scripts/perl/weechat-perl.c
@@ -117,7 +117,7 @@ weechat_perl_exec (struct t_plugin_script *script,
dSP;
#ifndef MULTIPLICITY
- int length = strlen (script->interpreter) + strlen (function) + 3;
+ length = strlen (script->interpreter) + strlen (function) + 3;
func = (char *)malloc (length * sizeof (char));
if (!func)
return NULL;
@@ -247,9 +247,6 @@ weechat_perl_load (char *filename)
perl_argv[0] = filename;
perl_argv[1] = pkgname;
perl_argv[2] = NULL;
- eval = weechat_perl_exec (plugin, &tempscript,
- WEECHAT_SCRIPT_EXEC_INT,
- "weechat_perl_load_eval_file", perl_argv);
#else
perl_current_interpreter = perl_alloc();
@@ -273,11 +270,11 @@ weechat_perl_load (char *filename)
eval_pv (perl_weechat_code, TRUE);
perl_argv[0] = filename;
perl_argv[1] = NULL;
+#endif
eval = weechat_perl_exec (&tempscript,
WEECHAT_SCRIPT_EXEC_INT,
"weechat_perl_load_eval_file",
perl_argv);
-#endif
if (!eval)
{
weechat_printf (NULL,
@@ -595,7 +592,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin)
}
perl_construct (perl_main);
- perl_parse (perl_main, weechat_perl_xs_init, 3, perl_args, NULL);
+ perl_parse (perl_main, weechat_perl_api_init, 3, perl_args, NULL);
eval_pv (perl_weechat_code, TRUE);
#endif
@@ -613,7 +610,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin)
* weechat_plugin_end: end Perl plugin
*/
-void
+int
weechat_plugin_end (struct t_weechat_plugin *plugin)
{
/* make C compiler happy */
@@ -631,4 +628,5 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
perl_main = NULL;
}
#endif
+ return WEECHAT_RC_OK;
}
diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c
index b117cb9..101ab35 100644
--- a/src/plugins/scripts/python/weechat-python.c
+++ b/src/plugins/scripts/python/weechat-python.c
@@ -649,7 +649,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin)
* weechat_plugin_end: shutdown Python interface
*/
-void
+int
weechat_plugin_end (struct t_weechat_plugin *plugin)
{
/* make C compiler happy */
@@ -673,5 +673,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to free interpreter"),
weechat_prefix ("error"), "python");
+ return WEECHAT_RC_ERROR;
}
+ return WEECHAT_RC_OK;
}
diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h
index 91112eb..b381b27 100644
--- a/src/plugins/weechat-plugin.h
+++ b/src/plugins/weechat-plugin.h
@@ -23,20 +23,30 @@
#include <sys/types.h>
+#ifdef __cplusplus
+# define BEGIN_CDECL extern "C" {
+# define END_CDECL }
+#else
+# define BEGIN_CDECL
+# define END_CDECL
+#endif
+
+BEGIN_CDECL
+
struct t_gui_buffer;
struct t_weelist;
/* macros for defining plugin infos */
#define WEECHAT_PLUGIN_NAME(__name) \
- char weechat_plugin_name[] = __name;
+ BEGIN_CDECL char weechat_plugin_name[] = __name; END_CDECL
#define WEECHAT_PLUGIN_AUTHOR(__author) \
- char weechat_plugin_author[] = __author;
+ BEGIN_CDECL char weechat_plugin_author[] = __author; END_CDECL
#define WEECHAT_PLUGIN_DESCRIPTION(__desc) \
- char weechat_plugin_description[] = __desc;
+ BEGIN_CDECL char weechat_plugin_description[] = __desc; END_CDECL
#define WEECHAT_PLUGIN_VERSION(__version) \
- char weechat_plugin_version[] = __version;
+ BEGIN_CDECL char weechat_plugin_version[] = __version; END_CDECL
#define WEECHAT_PLUGIN_LICENSE(__license) \
- char weechat_plugin_license[] = __license;
+ BEGIN_CDECL char weechat_plugin_license[] = __license; END_CDECL
/* return codes for plugin functions */
#define WEECHAT_RC_ERROR -1 /* function failed with an error */
@@ -340,6 +350,9 @@ struct t_weechat_plugin
/* WeeChat developers: ALWAYS add new functions at the end */
};
+int weechat_plugin_init (struct t_weechat_plugin *plugin);
+int weechat_plugin_end (struct t_weechat_plugin *plugin);
+
/* macros for easy call to plugin API */
/* strings */
@@ -654,4 +667,6 @@ struct t_weechat_plugin
#define weechat_infolist_free(__list) \
weechat_plugin->infolist_free(__list)
+END_CDECL
+
#endif /* weechat-plugin.h */