From c8e3cf2b8e2d62a0c768a8b6a9ca8bf69c06136a Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Mon, 18 Feb 2013 05:34:35 +0100 Subject: Upgrade to guile 2.0 (Aleix Conchillo) --- .gitignore | 1 + configure.ac | 12 ++------ mixguile/mixguile_cmd_dispatcher.c | 2 +- mixguile/xmixguile_cmd_dispatcher.c | 55 +++++++++++++++++++------------------ mixguile/xmixguile_cmd_dispatcher.h | 2 +- 5 files changed, 34 insertions(+), 38 deletions(-) diff --git a/.gitignore b/.gitignore index 53723f7..a82084b 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,4 @@ /ylwrap /img /doc/manual/ +/autom4te.cache/ diff --git a/configure.ac b/configure.ac index 179297d..01b8fee 100644 --- a/configure.ac +++ b/configure.ac @@ -90,21 +90,13 @@ AC_ARG_WITH(guile, esac], [wguile=true]) if test x$wguile = xtrue; then -dnl AC_CHECK_HEADER(guile/gh.h,,wguile=false) - AC_MSG_CHECKING(for Guile) - guile-config link > /dev/null || { - AC_MSG_RESULT(no) - wguile=false - } + PKG_CHECK_MODULES(GUILE,guile-2.0 >= 2.0,[wguile=true],[wguile=false]) fi if test x$wguile = xtrue; then - GUILE_CFLAGS="`guile-config compile`" - GUILE_LDFLAGS="`guile-config link`" - LIBS="$LIBS $GUILE_LDFLAGS" + LIBS="$LIBS $GUILE_LIBS" AM_CFLAGS="$AM_CFLAGS $GUILE_CFLAGS" AC_SUBST(MAKE_GUILE) - AC_MSG_RESULT(yes) fi AM_CONDITIONAL(MAKE_GUILE, test x$wguile = xtrue) diff --git a/mixguile/mixguile_cmd_dispatcher.c b/mixguile/mixguile_cmd_dispatcher.c index b302f39..a226423 100644 --- a/mixguile/mixguile_cmd_dispatcher.c +++ b/mixguile/mixguile_cmd_dispatcher.c @@ -24,7 +24,7 @@ #include #include -#include +#include #include "mixguile.h" #include "xmixguile_cmd_dispatcher.h" diff --git a/mixguile/xmixguile_cmd_dispatcher.c b/mixguile/xmixguile_cmd_dispatcher.c index d6baf47..bbc411d 100644 --- a/mixguile/xmixguile_cmd_dispatcher.c +++ b/mixguile/xmixguile_cmd_dispatcher.c @@ -22,7 +22,7 @@ #include #include -#include +#include #include "xmixguile_cmd_dispatcher.h" @@ -30,6 +30,7 @@ static mixguile_cmd_dispatcher_t *dispatcher_; static mix_vm_cmd_dispatcher_t *vm_dispatcher_; static mix_vm_t *vm_; +static SCM mutex_; /* register a NULL-terminated list of scm commands */ void @@ -56,6 +57,7 @@ register_cmd_dispatcher_ (mixguile_cmd_dispatcher_t *dis) dispatcher_ = dis; vm_dispatcher_ = mixguile_cmd_dispatcher_get_vm_dispatcher (dis); vm_ = (mix_vm_t *) mix_vm_cmd_dispatcher_get_vm (vm_dispatcher_); + mutex_ = scm_make_mutex (); } /* commands */ @@ -65,12 +67,12 @@ mixvm_cmd_ (SCM cmd, SCM arg) char *com = NULL, *argu = NULL; gboolean result; - SCM_ASSERT (SCM_STRINGP (cmd) || SCM_SYMBOLP (cmd), - cmd, SCM_ARG1, "mixvm-cmd"); - SCM_ASSERT (SCM_STRINGP (arg) || SCM_SYMBOLP (arg), - arg, SCM_ARG2, "mixvm-cmd"); + SCM_ASSERT (scm_is_string (cmd) || scm_is_symbol (cmd), + cmd, SCM_ARG1, "mixvm-cmd"); + SCM_ASSERT (scm_is_string (arg) || scm_is_symbol (arg), + arg, SCM_ARG2, "mixvm-cmd"); - SCM_DEFER_INTS; + scm_lock_mutex (mutex_); com = scm_to_locale_string (cmd); argu = scm_to_locale_string (arg); result = mix_vm_cmd_dispatcher_dispatch (vm_dispatcher_, @@ -79,7 +81,7 @@ mixvm_cmd_ (SCM cmd, SCM arg) g_free (com); g_free (argu); - SCM_ALLOW_INTS; + scm_unlock_mutex (mutex_); return SCM_UNSPECIFIED; } @@ -116,9 +118,10 @@ mix_reg_ (SCM reg) char *regis; long val = MIX_WORD_MAX + 1; - SCM_ASSERT (SCM_STRINGP (reg) || SCM_SYMBOLP (reg), reg, SCM_ARG1, "mix-reg"); + SCM_ASSERT (scm_is_string (reg) || scm_is_symbol (reg), + reg, SCM_ARG1, "mix-reg"); - SCM_DEFER_INTS; + scm_lock_mutex (mutex_); if (SCM_SYMBOLP (reg)) reg = scm_symbol_to_string (reg); regis = scm_to_locale_string (reg); switch (regis[0]) @@ -140,7 +143,7 @@ mix_reg_ (SCM reg) } g_free (regis); - SCM_ALLOW_INTS; + scm_unlock_mutex (mutex_); SCM_ASSERT (val <= MIX_WORD_MAX, reg, SCM_ARG1, "mix-reg"); @@ -154,11 +157,11 @@ mix_set_reg_ (SCM reg, SCM value) long val; gboolean result = TRUE; - SCM_ASSERT (SCM_STRINGP (reg) || SCM_SYMBOLP (reg), reg, SCM_ARG1, - "mix-set-reg!"); - SCM_ASSERT (SCM_NUMBERP (value), value, SCM_ARG2, "mix-set-reg!"); + SCM_ASSERT (scm_is_string (reg) || scm_is_symbol (reg), + reg, SCM_ARG1, "mix-set-reg!"); + SCM_ASSERT (scm_is_number (value), value, SCM_ARG2, "mix-set-reg!"); - SCM_DEFER_INTS; + scm_lock_mutex (mutex_); if (SCM_SYMBOLP (reg)) reg = scm_symbol_to_string (reg); regis = scm_to_locale_string (reg); val = scm_to_long (value); @@ -182,7 +185,7 @@ mix_set_reg_ (SCM reg, SCM value) } g_free (regis); - SCM_ALLOW_INTS; + scm_unlock_mutex (mutex_); SCM_ASSERT (result, reg, SCM_ARG1, "mix-set-reg!"); @@ -256,10 +259,10 @@ mix_set_cmp_ (SCM value) gchar *val = NULL; mix_cmpflag_t result = -1; - SCM_ASSERT (SCM_STRINGP (value) || SCM_SYMBOLP (value), value, SCM_ARG1, - "mix-set-cmp!"); + SCM_ASSERT (scm_is_string (value) || scm_is_symbol (value), + value, SCM_ARG1, "mix-set-cmp!"); - SCM_DEFER_INTS; + scm_lock_mutex (mutex_); val = scm_to_locale_string (value); if (strlen (val) == 1) { @@ -272,7 +275,7 @@ mix_set_cmp_ (SCM value) } } g_free (val); - SCM_ALLOW_INTS; + scm_unlock_mutex (mutex_); SCM_ASSERT (result != -1, value, SCM_ARG1, "mix-set-cmp!"); mix_vm_set_cmpflag (vm_, result); return SCM_BOOL_T; @@ -456,22 +459,22 @@ mix_add_hook_ (SCM cmd, SCM function, gboolean pre) mix_vm_command_t command; const gchar *fun = pre? "mix-add-pre-hook" : "mix-add-post-hook"; - SCM_ASSERT (SCM_STRINGP (cmd) || SCM_SYMBOLP (cmd), cmd, SCM_ARG1, fun); + SCM_ASSERT (scm_is_string (cmd) || scm_is_symbol (cmd), cmd, SCM_ARG1, fun); SCM_ASSERT (scm_is_true (scm_procedure_p (function)), function, SCM_ARG2, fun); - SCM_DEFER_INTS; + scm_lock_mutex (mutex_); cmdstr = scm_to_locale_string (cmd); command = mix_vm_command_from_string (cmdstr); g_free (cmdstr); - SCM_ALLOW_INTS; + scm_unlock_mutex (mutex_); SCM_ASSERT (command != MIX_CMD_INVALID, cmd, SCM_ARG1, fun); - SCM_DEFER_INTS; + scm_lock_mutex (mutex_); if (pre) mix_vm_cmd_dispatcher_pre_hook (vm_dispatcher_, command, scm_hook_, (gpointer) define_hook_procedure_ (function)); else mix_vm_cmd_dispatcher_post_hook (vm_dispatcher_, command, scm_hook_, (gpointer) define_hook_procedure_ (function)); - SCM_ALLOW_INTS; + scm_unlock_mutex (mutex_); return SCM_BOOL_T; } @@ -482,14 +485,14 @@ mix_add_global_hook_ (SCM function, gboolean pre) pre? "mix-add-global-pre-hook" : "mix-add-global-post-hook"; SCM_ASSERT (scm_is_true (scm_procedure_p (function)), function, SCM_ARG1, fun); - SCM_DEFER_INTS; + scm_lock_mutex (mutex_); if (pre) mix_vm_cmd_dispatcher_global_pre_hook (vm_dispatcher_, scm_global_hook_, (gpointer) define_hook_procedure_ (function)); else mix_vm_cmd_dispatcher_global_post_hook (vm_dispatcher_, scm_global_hook_, (gpointer) define_hook_procedure_ (function)); - SCM_ALLOW_INTS; + scm_unlock_mutex (mutex_); return SCM_BOOL_T; } diff --git a/mixguile/xmixguile_cmd_dispatcher.h b/mixguile/xmixguile_cmd_dispatcher.h index f6d987a..4298267 100644 --- a/mixguile/xmixguile_cmd_dispatcher.h +++ b/mixguile/xmixguile_cmd_dispatcher.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include "mixguile_cmd_dispatcher.h" /* the cmd dispatcher type */ -- cgit v1.2.3