guile: fix arguments given to callbacks (separate arguments instead of one list with arguments inside), guile >= 2.0 is now required (bug #38350)

Unfortunately this breaks compatibility with existing guile scripts, but this
change is needed to keep consistency with other scripting languages.

Now guile >= 2.0 is required, WeeChat can not compile any more with guile 1.8.
v2.8-utf8proc
Sebastien Helleu 2013-02-19 22:49:59 +01:00
parent c43d48a9df
commit 9857b44e4e
17 changed files with 46 additions and 43 deletions

View File

@ -22,6 +22,8 @@ Version 0.4.1 (under dev!)
* aspell: add completion "aspell_dicts" (list of aspell installed dictionaries)
* aspell: add info "aspell_dict" (dictionaries used on a buffer)
* aspell: optimization on spellers to improve speed (save state by buffer)
* guile: fix arguments given to callbacks (separate arguments instead of one
list with arguments inside), guile >= 2.0 is now required (bug #38350)
* guile: fix crash on calls to callbacks during load of script (bug #38343)
* guile: fix compilation with guile 2.0
* irc: fix display of malformed CTCP (without closing char) (bug #38347)

9
NEWS
View File

@ -1,12 +1,19 @@
WeeChat Release Notes
=====================
Sébastien Helleu <flashcode@flashtux.org>
v0.4.1-dev, 2013-01-20
v0.4.1-dev, 2013-02-19
Version 0.4.1 (under dev!)
--------------------------
Important release notes:
* the way to give arguments for guile callbacks has been fixed: now arguments
are sent individually (instead of a list with all arguments inside).
Therefore, existing guile scripts must be modified accordingly.
Moreover, WeeChat now requires Guile ≥ 2.0 to compile.
Version 0.4.0 (2013-01-20)
--------------------------

View File

@ -33,5 +33,5 @@ ENDIF(GUILE_FOUND)
FIND_PACKAGE(PkgConfig)
IF(PKG_CONFIG_FOUND)
pkg_search_module(GUILE guile-2.0 guile-1.8)
pkg_search_module(GUILE guile-2.0)
ENDIF(PKG_CONFIG_FOUND)

View File

@ -740,7 +740,7 @@ if test "x$enable_guile" = "xyes" ; then
if test "x$PKGCONFIG" != "x"; then
AC_MSG_CHECKING(for Guile headers and librairies)
echo
for v in "2.0" "1.8" ; do
for v in "2.0" ; do
pkgconfig_guile_found=`$PKGCONFIG --exists guile-$v 2>/dev/null`
if test "x$?" = "x0" ; then
GUILE_VERSION=`$PKGCONFIG --modversion guile-$v`
@ -754,7 +754,7 @@ if test "x$enable_guile" = "xyes" ; then
if test "x$guile_found" = "xno" ; then
AC_MSG_WARN([
*** Guile couldn't be found on your system.
*** Guile >= 2.0 couldn't be found on your system.
*** WeeChat will be built without Guile (scheme) support.])
enable_guile="no"
not_found="$not_found guile"

2
debian/control vendored
View File

@ -5,7 +5,7 @@ Maintainer: Emmanuel Bouthenot <kolter@debian.org>
Build-Depends-Indep: asciidoc (>= 8.5), source-highlight
Build-Depends: debhelper (>= 7.0.50), cmake, libncursesw5-dev,
ruby1.9.1, ruby1.9.1-dev, libperl-dev, python-dev, libaspell-dev, liblua5.1-0-dev,
tcl8.5-dev, guile-1.8-dev, libcurl4-gnutls-dev, libgcrypt11-dev, libgnutls-dev,
tcl8.5-dev, guile-2.0-dev, libcurl4-gnutls-dev, libgcrypt11-dev, libgnutls-dev,
zlib1g-dev, dpkg-dev (>= 1.13.19), pkg-config
Standards-Version: 3.9.4
Homepage: http://weechat.org/

View File

@ -343,8 +343,8 @@ weechat::hook_timer 1000 0 1 timer_cb test
[source,lisp]
----------------------------------------
(define (timer_cb args)
(weechat:print "" (string-append "timer! data=" (list-ref args 0)))
(define (timer_cb data remaining_calls)
(weechat:print "" (string-append "timer! data=" data))
weechat:WEECHAT_RC_OK
)

View File

@ -101,7 +101,7 @@ welche Pakete optional genutzt werden können.
| ruby1.9.1-dev | ≥ 1.8 | | ruby Erweiterung
| liblua5.1-0-dev | | | lua Erweiterung
| tcl-dev | ≥ 8.5 | | tcl Erweiterung
| guile-1.8-dev | ≥ 1.8 | | guile (scheme) Erweiterung
| guile-2.0-dev | ≥ 2.0 | | guile (scheme) Erweiterung
| asciidoc | ≥ 8.5.0 | | erstellt Dokumentation (HTML Dateien)
| source-highlight | | | Syntax Highlight für Quelltext in HTML Dokumentation
|========================================

View File

@ -336,8 +336,8 @@ weechat::hook_timer 1000 0 1 timer_cb test
[source,lisp]
----------------------------------------
(define (timer_cb args)
(weechat:print "" (string-append "timer! data=" (list-ref args 0)))
(define (timer_cb data remaining_calls)
(weechat:print "" (string-append "timer! data=" data))
weechat:WEECHAT_RC_OK
)

View File

@ -101,7 +101,7 @@ compile WeeChat.
| ruby1.9.1-dev | ≥ 1.8 | | ruby plugin
| liblua5.1-0-dev | | | lua plugin
| tcl-dev | ≥ 8.5 | | tcl plugin
| guile-1.8-dev | ≥ 1.8 | | guile (scheme) plugin
| guile-2.0-dev | ≥ 2.0 | | guile (scheme) plugin
| asciidoc | ≥ 8.5.0 | | build documentation (HTML files)
| source-highlight | | | syntax highlight for sources in HTML documentation
|========================================

View File

@ -345,8 +345,8 @@ weechat::hook_timer 1000 0 1 timer_cb test
[source,lisp]
----------------------------------------
(define (timer_cb args)
(weechat:print "" (string-append "timer! data=" (list-ref args 0)))
(define (timer_cb data remaining_calls)
(weechat:print "" (string-append "timer! data=" data))
weechat:WEECHAT_RC_OK
)

View File

@ -103,7 +103,7 @@ compiler WeeChat.
| ruby1.9.1-dev | ≥ 1.8 | | extension ruby
| liblua5.1-0-dev | | | extension lua
| tcl-dev | ≥ 8.5 | | extension tcl
| guile-1.8-dev | ≥ 1.8 | | extension guile (scheme)
| guile-2.0-dev | ≥ 2.0 | | extension guile (scheme)
| asciidoc | ≥ 8.5.0 | | construction de la documentation (fichiers HTML)
| source-highlight | | | coloration des sources dans la documentation HTML
|========================================

View File

@ -348,8 +348,8 @@ weechat::hook_timer 1000 0 1 timer_cb test
[source,lisp]
----------------------------------------
(define (timer_cb args)
(weechat:print "" (string-append "timer! data=" (list-ref args 0)))
(define (timer_cb data remaining_calls)
(weechat:print "" (string-append "timer! data=" data))
weechat:WEECHAT_RC_OK
)

View File

@ -108,7 +108,7 @@ compilare WeeChat.
| ruby1.9.1-dev | ≥ 1.8 | | plugin ruby
| liblua5.1-0-dev | | | plugin lua
| tcl-dev | ≥ 8.5 | | plugin tcl
| guile-1.8-dev | ≥ 1.8 | | plugin guile (scheme)
| guile-2.0-dev | ≥ 2.0 | | plugin guile (scheme)
| asciidoc | ≥ 8.5.0 | | compilazione della documentazione (file HTML)
| source-highlight | | | evidenziazione della sintassi per i sorgenti nella documentazione HTML
|========================================

View File

@ -328,8 +328,8 @@ weechat::hook_timer 1000 0 1 timer_cb test
[source,lisp]
----------------------------------------
(define (timer_cb args)
(weechat:print "" (string-append "timer! data=" (list-ref args 0)))
(define (timer_cb data remaining_calls)
(weechat:print "" (string-append "timer! data=" data))
weechat:WEECHAT_RC_OK
)

View File

@ -93,7 +93,7 @@ WeeChat は cmake または autotools を使ってコンパイルできます (c
| ruby1.9.1-dev | ≥ 1.8 | | ruby プラグイン
| liblua5.1-0-dev | | | lua プラグイン
| tcl-dev | ≥ 8.5 | | tcl プラグイン
| guile-1.8-dev | | | guile (scheme) プラグイン
| guile-2.0-dev | ≥ 2.0 | | guile (scheme) プラグイン
| asciidoc | ≥ 8.5.0 | | 文書の生成 (HTML ファイル)
| source-highlight | | | HTML 文書に含まれるソースコードのシンタックスハイライト
|========================================

View File

@ -339,8 +339,8 @@ weechat::hook_timer 1000 0 1 timer_cb test
[source,lisp]
----------------------------------------
(define (timer_cb args)
(weechat:print "" (string-append "timer! data=" (list-ref args 0)))
(define (timer_cb data remaining_calls)
(weechat:print "" (string-append "timer! data=" data))
weechat:WEECHAT_RC_OK
)

View File

@ -53,8 +53,9 @@ char *guile_stdout = NULL;
struct t_guile_function
{
SCM proc;
SCM args;
SCM proc; /* proc to call */
SCM *argv; /* arguments for proc */
size_t nargs; /* length of arguments */
};
/*
@ -109,17 +110,18 @@ weechat_guile_catch (void *procedure, void *data)
}
/*
* Encapsulates call to scm_call_1 (to give arguments).
* Encapsulates call to scm_call_n (to give arguments).
*/
SCM
weechat_guile_scm_call_1 (void *proc)
weechat_guile_scm_call_n (void *proc)
{
struct t_guile_function *guile_function;
guile_function = (struct t_guile_function *)proc;
return scm_call_1 (guile_function->proc, guile_function->args);
return scm_call_n (guile_function->proc,
guile_function->argv, guile_function->nargs);
}
/*
@ -127,7 +129,7 @@ weechat_guile_scm_call_1 (void *proc)
*/
SCM
weechat_guile_exec_function (const char *function, SCM args)
weechat_guile_exec_function (const char *function, SCM *argv, size_t nargs)
{
SCM func, func2, value;
struct t_guile_function guile_function;
@ -135,11 +137,12 @@ weechat_guile_exec_function (const char *function, SCM args)
func = weechat_guile_catch (scm_c_lookup, (void *)function);
func2 = weechat_guile_catch (scm_variable_ref, func);
if (args)
if (argv)
{
guile_function.proc = func2;
guile_function.args = args;
value = weechat_guile_catch (weechat_guile_scm_call_1, &guile_function);
guile_function.argv = argv;
guile_function.nargs = nargs;
value = weechat_guile_catch (weechat_guile_scm_call_n, &guile_function);
}
else
{
@ -255,7 +258,7 @@ weechat_guile_exec (struct t_plugin_script *script,
char *format, void **argv)
{
struct t_plugin_script *old_guile_current_script;
SCM argv_list, rc, old_current_module;
SCM rc, old_current_module;
void *argv2[17], *ret_value;
int i, argc, *ret_int;
@ -290,20 +293,11 @@ weechat_guile_exec (struct t_plugin_script *script,
{
argv2[i] = SCM_UNDEFINED;
}
argv_list = scm_list_n (argv2[0], argv2[1],
argv2[2], argv2[3],
argv2[4], argv2[5],
argv2[6], argv2[7],
argv2[8], argv2[9],
argv2[10], argv2[11],
argv2[12], argv2[13],
argv2[14], argv2[15],
argv2[16]);
rc = weechat_guile_exec_function (function, argv_list);
rc = weechat_guile_exec_function (function, (SCM *)argv2, argc);
}
else
{
rc = weechat_guile_exec_function (function, NULL);
rc = weechat_guile_exec_function (function, NULL, 0);
}
ret_value = NULL;