* don't try to use guile if it's pre-2.x; but add some beginning compat
functions for 1.8 and friends
This commit is contained in:
@ -18,7 +18,7 @@ include $(top_srcdir)/gtest.mk
|
||||
|
||||
# enforce compiling this dir first before decending into tests/
|
||||
SUBDIRS= .
|
||||
INCLUDES=-I${top_srcdir}/src ${GUILE_CFLAGS} ${GLIB_CFLAGS}
|
||||
INCLUDES=-I${top_srcdir} -I${top_srcdir}/src ${GUILE_CFLAGS} ${GLIB_CFLAGS}
|
||||
|
||||
# don't use -Werror, as it might break on other compilers
|
||||
# use -Wno-unused-parameters, because some callbacks may not
|
||||
|
||||
@ -16,6 +16,9 @@
|
||||
** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**
|
||||
*/
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif /*HAVE_CONFIG_H*/
|
||||
|
||||
#include "mu-guile-common.h"
|
||||
|
||||
@ -39,3 +42,25 @@ mu_guile_g_error (const char *func_name, GError *err)
|
||||
scm_from_utf8_string (err->message),
|
||||
SCM_UNDEFINED, SCM_UNDEFINED);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* backward compat for pre-2.x guile - note, this will fail miserably
|
||||
* if you don't use a UTF8 locale
|
||||
*/
|
||||
#if HAVE_PRE2_GUILE
|
||||
|
||||
SCM
|
||||
scm_from_utf8_string (const char* str)
|
||||
{
|
||||
return scm_from_locale_string (str);
|
||||
}
|
||||
|
||||
char*
|
||||
scm_to_utf8_string (SCM scm)
|
||||
{
|
||||
return scm_to_locale_string (scm);
|
||||
}
|
||||
|
||||
#endif /*HAVE_PRE2_GUILE*/
|
||||
|
||||
@ -21,6 +21,11 @@
|
||||
#define __MU_GUILE_UTILS_H__
|
||||
|
||||
#include <libguile.h>
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif /*HAVE_CONFIG_H*/
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
@ -44,7 +49,13 @@ void mu_guile_error (const char *func_name, int status,
|
||||
* @param err Gerror
|
||||
*/
|
||||
void mu_guile_g_error (const char *func_name, GError *err);
|
||||
|
||||
|
||||
/* compatibility functions for old guile */
|
||||
#if HAVE_PRE2_GUILE
|
||||
SCM scm_from_utf8_string (const char* str);
|
||||
char* scm_to_utf8_string (SCM scm);
|
||||
#endif /*HAVE_PRE2_GUILE*/
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /*__MU_GUILE_UTILS_H__*/
|
||||
|
||||
@ -146,9 +146,9 @@ SCM_DEFINE (msg_prio, "mu:msg:priority", 1, 0, 0,
|
||||
prio = mu_msg_get_prio (msgwrap->_msg);
|
||||
|
||||
switch (prio) {
|
||||
case MU_MSG_PRIO_LOW: return scm_from_utf8_symbol("low");
|
||||
case MU_MSG_PRIO_NORMAL: return scm_from_utf8_symbol("normal");
|
||||
case MU_MSG_PRIO_HIGH: return scm_from_utf8_symbol("high");
|
||||
case MU_MSG_PRIO_LOW: return scm_from_locale_symbol("low");
|
||||
case MU_MSG_PRIO_NORMAL: return scm_from_locale_symbol("normal");
|
||||
case MU_MSG_PRIO_HIGH: return scm_from_locale_symbol("high");
|
||||
default:
|
||||
g_return_val_if_reached (SCM_UNDEFINED);
|
||||
}
|
||||
@ -167,7 +167,7 @@ check_flag (MuMsgFlags flag, FlagData *fdata)
|
||||
{
|
||||
if (fdata->flags & flag) {
|
||||
SCM item;
|
||||
item = scm_list_1 (scm_from_utf8_symbol(mu_msg_flag_name(flag)));
|
||||
item = scm_list_1 (scm_from_locale_symbol(mu_msg_flag_name(flag)));
|
||||
fdata->lst = scm_append_x (scm_list_2(fdata->lst, item));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user