From 489fd3fcf4d001e2d8b0d16bbf316c57f083b8aa Mon Sep 17 00:00:00 2001 From: djcb Date: Fri, 30 Dec 2011 15:00:37 +0200 Subject: [PATCH] * mu-guile-util: remove guile 1.8 backward compat stuff --- guile/mu-guile-util.c | 119 +++--------------------------------------- guile/mu-guile-util.h | 12 ----- 2 files changed, 6 insertions(+), 125 deletions(-) diff --git a/guile/mu-guile-util.c b/guile/mu-guile-util.c index f485f670..27a9958a 100644 --- a/guile/mu-guile-util.c +++ b/guile/mu-guile-util.c @@ -16,7 +16,13 @@ ** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ** */ + +#include +#include + #include "mu-guile-util.h" +#include "mu-guile-msg.h" + SCM mu_guile_util_error (const char *func_name, int status, @@ -40,116 +46,3 @@ mu_guile_util_g_error (const char *func_name, GError *err) return SCM_UNSPECIFIED; } - - - -#include -#include - -#include "mu-guile-util.h" -#include "mu-guile-msg.h" - -struct _GuileConfig { - const char *muhome; - char *msgpath; -}; -typedef struct _GuileConfig GuileConfig; - - -static GuileConfig* -guile_config_new (int *argcp, char ***argvp) -{ - GOptionContext *octx; - GuileConfig *opts = g_new0 (GuileConfig, 1); - GOptionEntry entries[] = { - {"muhome", 0, 0, G_OPTION_ARG_FILENAME, &opts->muhome, - "specify an alternative mu directory", NULL}, - {"msg", 0, 0, G_OPTION_ARG_FILENAME, &opts->msgpath, - "specify path to a message to load as mu:current-msg)", NULL}, - {NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL}/* sentinel */ - }; - - octx = g_option_context_new ("- mu guile options"); - g_option_context_add_main_entries (octx, entries, "mu guile"); - - if (!g_option_context_parse (octx, argcp, argvp, NULL)) { - g_option_context_free (octx); - g_printerr ("mu guile: error in options\n"); - return NULL; - } - - if (opts->msgpath) - opts->msgpath = mu_util_dir_expand (opts->msgpath); - - g_option_context_free (octx); - - return opts; -} - -static void -guile_config_destroy (GuileConfig *conf) -{ - g_free (conf->msgpath); - g_free (conf); -} - - - -gboolean -mu_guile_util_run (int *argcp, char **argvp[]) -{ - GuileConfig *opts; - -#ifdef HAVE_PRE2_GUILE - g_warning ("Note: mu guile will not function properly unless you are using a" - "UTF-8 locale."); -#endif /* HAVE_PRE2_GUILE */ - - opts = guile_config_new (argcp, argvp); - if (!opts) - goto error; - - if (!mu_runtime_init (opts->muhome /* NULL is okay */, - "mu-guile")) - goto error; - - /* FIXME: mu_guile_init (); /\* initialize mu guile modules *\/ */ - - if (opts->msgpath) { - if (!(gboolean)scm_with_guile - ((MuGuileFunc*)&mu_guile_msg_load_current, - opts->msgpath)) - goto error; - } - - scm_shell (*argcp, *argvp); - - mu_runtime_uninit (); - guile_config_destroy (opts); - - return TRUE; -error: - guile_config_destroy (opts); - return FALSE; -} - - - -/* - * 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*/ diff --git a/guile/mu-guile-util.h b/guile/mu-guile-util.h index 00a230b4..c37fbfca 100644 --- a/guile/mu-guile-util.h +++ b/guile/mu-guile-util.h @@ -21,11 +21,6 @@ #define __MU_GUILE_UTIL_H__ #include - -#if HAVE_CONFIG_H -#include -#endif /*HAVE_CONFIG_H*/ - #include G_BEGIN_DECLS @@ -61,13 +56,6 @@ SCM mu_guile_util_error (const char *func_name, int status, */ SCM mu_guile_util_g_error (const char *func_name, GError *err); - -/* compatibility functions for guile 1.8 */ -#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_UTIL_H__*/