mirror of https://github.com/djcb/mu.git
* mu-guile-misc -> mu-guile-log, and some cleanups
This commit is contained in:
parent
3b78cdd023
commit
2f556738e8
|
@ -36,8 +36,8 @@ libmuguile_la_SOURCES= \
|
|||
mu-guile-msg.h \
|
||||
mu-guile-store.c \
|
||||
mu-guile-store.h \
|
||||
mu-guile-misc.c \
|
||||
mu-guile-misc.h \
|
||||
mu-guile-log.c \
|
||||
mu-guile-log.h \
|
||||
mu-guile-common.c \
|
||||
mu-guile-common.h
|
||||
|
||||
|
@ -48,7 +48,7 @@ libmuguile_la_LIBADD= \
|
|||
XFILES= \
|
||||
mu-guile-msg.x \
|
||||
mu-guile-store.x \
|
||||
mu-guile-misc.x
|
||||
mu-guile-log.x
|
||||
|
||||
BUILT_SOURCES=$(XFILES)
|
||||
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
#endif /*HAVE_CONFIG_H*/
|
||||
|
||||
#include "mu-guile-common.h"
|
||||
#include "mu-guile-store.h"
|
||||
#include "mu-guile-msg.h"
|
||||
#include "mu-guile-log.h"
|
||||
|
||||
void
|
||||
mu_guile_error (const char *func_name, int status,
|
||||
|
@ -45,6 +48,15 @@ mu_guile_g_error (const char *func_name, GError *err)
|
|||
|
||||
|
||||
|
||||
void
|
||||
mu_guile_init (void)
|
||||
{
|
||||
scm_with_guile (&mu_guile_msg_init, NULL);
|
||||
scm_with_guile (&mu_guile_store_init, NULL);
|
||||
scm_with_guile (&mu_guile_log_init, NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* backward compat for pre-2.x guile - note, this will fail miserably
|
||||
* if you don't use a UTF8 locale
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
**
|
||||
*/
|
||||
|
||||
#ifndef __MU_GUILE_UTILS_H__
|
||||
#define __MU_GUILE_UTILS_H__
|
||||
#ifndef __MU_GUILE_COMMON_H__
|
||||
#define __MU_GUILE_COMMON_H__
|
||||
|
||||
#include <libguile.h>
|
||||
|
||||
|
@ -30,8 +30,8 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
*
|
||||
/**
|
||||
* output an error
|
||||
*
|
||||
* @param func_name
|
||||
* @param status
|
||||
|
@ -42,7 +42,7 @@ void mu_guile_error (const char *func_name, int status,
|
|||
const char *fmt, SCM args);
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* display a GError as a Guile error
|
||||
*
|
||||
* @param func_name function name
|
||||
|
@ -50,6 +50,14 @@ void mu_guile_error (const char *func_name, int status,
|
|||
*/
|
||||
void mu_guile_g_error (const char *func_name, GError *err);
|
||||
|
||||
|
||||
/**
|
||||
* initialize the mu guile modules
|
||||
*
|
||||
*/
|
||||
void mu_guile_init (void);
|
||||
|
||||
|
||||
/* compatibility functions for old guile */
|
||||
#if HAVE_PRE2_GUILE
|
||||
SCM scm_from_utf8_string (const char* str);
|
||||
|
@ -58,5 +66,5 @@ char* scm_to_utf8_string (SCM scm);
|
|||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /*__MU_GUILE_UTILS_H__*/
|
||||
#endif /*__MU_GUILE_COMMON_H__*/
|
||||
|
||||
|
|
|
@ -17,13 +17,8 @@
|
|||
**
|
||||
*/
|
||||
|
||||
#include <mu-query.h>
|
||||
#include <mu-store.h>
|
||||
#include <mu-runtime.h>
|
||||
|
||||
#include "mu-guile-msg.h"
|
||||
#include "mu-guile-store.h"
|
||||
#include "mu-guile-common.h"
|
||||
#include "mu-guile-log.h"
|
||||
|
||||
enum _LogType {
|
||||
LOG_INFO,
|
||||
|
@ -62,7 +57,7 @@ write_log (LogType logtype, SCM FRM, SCM ARGS)
|
|||
}
|
||||
|
||||
|
||||
SCM_DEFINE (log_info, "mu:info", 1, 0, 1, (SCM FRM, SCM ARGS),
|
||||
SCM_DEFINE (log_info, "mu:log:info", 1, 0, 1, (SCM FRM, SCM ARGS),
|
||||
"log some message using a list of ARGS applied to FRM "
|
||||
"(in 'simple-format' notation).\n")
|
||||
#define FUNC_NAME s_info
|
||||
|
@ -71,7 +66,7 @@ SCM_DEFINE (log_info, "mu:info", 1, 0, 1, (SCM FRM, SCM ARGS),
|
|||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
SCM_DEFINE (log_warning, "mu:warning", 1, 0, 1, (SCM FRM, SCM ARGS),
|
||||
SCM_DEFINE (log_warning, "mu:log:warning", 1, 0, 1, (SCM FRM, SCM ARGS),
|
||||
"log some warning using a list of ARGS applied to FRM (in 'simple-format' "
|
||||
"notation).\n")
|
||||
#define FUNC_NAME s_warning
|
||||
|
@ -80,7 +75,7 @@ SCM_DEFINE (log_warning, "mu:warning", 1, 0, 1, (SCM FRM, SCM ARGS),
|
|||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
SCM_DEFINE (log_critical, "mu:critical", 1, 0, 1, (SCM FRM, SCM ARGS),
|
||||
SCM_DEFINE (log_critical, "mu:log:critical", 1, 0, 1, (SCM FRM, SCM ARGS),
|
||||
"log some critical message using a list of ARGS applied to FRM "
|
||||
"(in 'simple-format' notation).\n")
|
||||
#define FUNC_NAME s_critical
|
||||
|
@ -91,9 +86,9 @@ SCM_DEFINE (log_critical, "mu:critical", 1, 0, 1, (SCM FRM, SCM ARGS),
|
|||
|
||||
|
||||
void*
|
||||
mu_guile_misc_init (void *data)
|
||||
mu_guile_log_init (void *data)
|
||||
{
|
||||
#include "mu-guile-misc.x"
|
||||
#include "mu-guile-log.x"
|
||||
|
||||
return NULL;
|
||||
}
|
|
@ -17,8 +17,8 @@
|
|||
**
|
||||
*/
|
||||
|
||||
#ifndef __MU_GUILE_MISC_H__
|
||||
#define __MU_GUILE_MISC_H__
|
||||
#ifndef __MU_GUILE_LOG_H__
|
||||
#define __MU_GUILE_LOG_H__
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -26,14 +26,14 @@ extern "C" {
|
|||
#endif /*__cplusplus*/
|
||||
|
||||
/**
|
||||
* initialize misc mu functions
|
||||
* initialize mu logging functions
|
||||
*
|
||||
*/
|
||||
void *mu_guile_misc_init (void *data);
|
||||
void *mu_guile_log_init (void *data);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /*__cplusplus*/
|
||||
|
||||
#endif /*__MU_GUILE_MISC_H__*/
|
||||
#endif /*__MU_GUILE_LOG_H__*/
|
|
@ -23,10 +23,8 @@
|
|||
#include <mu-runtime.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include <libguile.h>
|
||||
#include <libmuguile/mu-guile-common.h>
|
||||
#include <libmuguile/mu-guile-msg.h>
|
||||
#include <libmuguile/mu-guile-store.h>
|
||||
#include <libmuguile/mu-guile-misc.h>
|
||||
|
||||
struct _MuileConfig {
|
||||
const char *muhome;
|
||||
|
@ -104,9 +102,7 @@ main (int argc, char *argv[])
|
|||
goto error;
|
||||
}
|
||||
|
||||
scm_with_guile (&mu_guile_msg_init, NULL);
|
||||
scm_with_guile (&mu_guile_store_init, NULL);
|
||||
scm_with_guile (&mu_guile_misc_init, NULL);
|
||||
mu_guile_init (); /* initialize mu guile modules */
|
||||
|
||||
if (opts->msgpath) {
|
||||
if (!(gboolean)scm_with_guile
|
||||
|
|
|
@ -19,11 +19,8 @@
|
|||
|
||||
#include <glib.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include <libguile.h>
|
||||
#include <libmuguile/mu-guile-common.h>
|
||||
#include <libmuguile/mu-guile-msg.h>
|
||||
#include <libmuguile/mu-guile-store.h>
|
||||
#include <libmuguile/mu-guile-misc.h>
|
||||
|
||||
#include "mu-runtime.h"
|
||||
#include "mu-util.h"
|
||||
|
@ -75,11 +72,9 @@ on_dir_change (GFileMonitor *mon, GFile *file, GFile *other_file,
|
|||
return;
|
||||
|
||||
if (fork() == 0) { /* run guile in child */
|
||||
|
||||
scm_with_guile (&mu_guile_msg_init, NULL);
|
||||
scm_with_guile (&mu_guile_store_init, NULL);
|
||||
scm_with_guile (&mu_guile_misc_init, NULL);
|
||||
|
||||
|
||||
mu_guile_init (); /* initialize mu guile modules */
|
||||
|
||||
if (!(gboolean)scm_with_guile
|
||||
((MuGuileFunc*)&mu_guile_msg_load_current, path)) {
|
||||
g_warning ("failed to set message in guile env");
|
||||
|
|
Loading…
Reference in New Issue