* mu-guile-misc -> mu-guile-log, and some cleanups
This commit is contained in:
@ -36,8 +36,8 @@ libmuguile_la_SOURCES= \
|
|||||||
mu-guile-msg.h \
|
mu-guile-msg.h \
|
||||||
mu-guile-store.c \
|
mu-guile-store.c \
|
||||||
mu-guile-store.h \
|
mu-guile-store.h \
|
||||||
mu-guile-misc.c \
|
mu-guile-log.c \
|
||||||
mu-guile-misc.h \
|
mu-guile-log.h \
|
||||||
mu-guile-common.c \
|
mu-guile-common.c \
|
||||||
mu-guile-common.h
|
mu-guile-common.h
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ libmuguile_la_LIBADD= \
|
|||||||
XFILES= \
|
XFILES= \
|
||||||
mu-guile-msg.x \
|
mu-guile-msg.x \
|
||||||
mu-guile-store.x \
|
mu-guile-store.x \
|
||||||
mu-guile-misc.x
|
mu-guile-log.x
|
||||||
|
|
||||||
BUILT_SOURCES=$(XFILES)
|
BUILT_SOURCES=$(XFILES)
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,9 @@
|
|||||||
#endif /*HAVE_CONFIG_H*/
|
#endif /*HAVE_CONFIG_H*/
|
||||||
|
|
||||||
#include "mu-guile-common.h"
|
#include "mu-guile-common.h"
|
||||||
|
#include "mu-guile-store.h"
|
||||||
|
#include "mu-guile-msg.h"
|
||||||
|
#include "mu-guile-log.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
mu_guile_error (const char *func_name, int status,
|
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
|
* backward compat for pre-2.x guile - note, this will fail miserably
|
||||||
* if you don't use a UTF8 locale
|
* if you don't use a UTF8 locale
|
||||||
|
|||||||
@ -17,8 +17,8 @@
|
|||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __MU_GUILE_UTILS_H__
|
#ifndef __MU_GUILE_COMMON_H__
|
||||||
#define __MU_GUILE_UTILS_H__
|
#define __MU_GUILE_COMMON_H__
|
||||||
|
|
||||||
#include <libguile.h>
|
#include <libguile.h>
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* output an error
|
||||||
*
|
*
|
||||||
* @param func_name
|
* @param func_name
|
||||||
* @param status
|
* @param status
|
||||||
@ -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);
|
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 */
|
/* compatibility functions for old guile */
|
||||||
#if HAVE_PRE2_GUILE
|
#if HAVE_PRE2_GUILE
|
||||||
SCM scm_from_utf8_string (const char* str);
|
SCM scm_from_utf8_string (const char* str);
|
||||||
@ -58,5 +66,5 @@ char* scm_to_utf8_string (SCM scm);
|
|||||||
|
|
||||||
G_END_DECLS
|
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-common.h"
|
||||||
|
#include "mu-guile-log.h"
|
||||||
|
|
||||||
enum _LogType {
|
enum _LogType {
|
||||||
LOG_INFO,
|
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 "
|
"log some message using a list of ARGS applied to FRM "
|
||||||
"(in 'simple-format' notation).\n")
|
"(in 'simple-format' notation).\n")
|
||||||
#define FUNC_NAME s_info
|
#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
|
#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' "
|
"log some warning using a list of ARGS applied to FRM (in 'simple-format' "
|
||||||
"notation).\n")
|
"notation).\n")
|
||||||
#define FUNC_NAME s_warning
|
#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
|
#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 "
|
"log some critical message using a list of ARGS applied to FRM "
|
||||||
"(in 'simple-format' notation).\n")
|
"(in 'simple-format' notation).\n")
|
||||||
#define FUNC_NAME s_critical
|
#define FUNC_NAME s_critical
|
||||||
@ -91,9 +86,9 @@ SCM_DEFINE (log_critical, "mu:critical", 1, 0, 1, (SCM FRM, SCM ARGS),
|
|||||||
|
|
||||||
|
|
||||||
void*
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -17,8 +17,8 @@
|
|||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __MU_GUILE_MISC_H__
|
#ifndef __MU_GUILE_LOG_H__
|
||||||
#define __MU_GUILE_MISC_H__
|
#define __MU_GUILE_LOG_H__
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@ -26,14 +26,14 @@ extern "C" {
|
|||||||
#endif /*__cplusplus*/
|
#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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /*__cplusplus*/
|
#endif /*__cplusplus*/
|
||||||
|
|
||||||
#endif /*__MU_GUILE_MISC_H__*/
|
#endif /*__MU_GUILE_LOG_H__*/
|
||||||
@ -23,10 +23,8 @@
|
|||||||
#include <mu-runtime.h>
|
#include <mu-runtime.h>
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
|
||||||
#include <libguile.h>
|
#include <libmuguile/mu-guile-common.h>
|
||||||
#include <libmuguile/mu-guile-msg.h>
|
#include <libmuguile/mu-guile-msg.h>
|
||||||
#include <libmuguile/mu-guile-store.h>
|
|
||||||
#include <libmuguile/mu-guile-misc.h>
|
|
||||||
|
|
||||||
struct _MuileConfig {
|
struct _MuileConfig {
|
||||||
const char *muhome;
|
const char *muhome;
|
||||||
@ -104,9 +102,7 @@ main (int argc, char *argv[])
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
scm_with_guile (&mu_guile_msg_init, NULL);
|
mu_guile_init (); /* initialize mu guile modules */
|
||||||
scm_with_guile (&mu_guile_store_init, NULL);
|
|
||||||
scm_with_guile (&mu_guile_misc_init, NULL);
|
|
||||||
|
|
||||||
if (opts->msgpath) {
|
if (opts->msgpath) {
|
||||||
if (!(gboolean)scm_with_guile
|
if (!(gboolean)scm_with_guile
|
||||||
|
|||||||
@ -19,11 +19,8 @@
|
|||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
|
#include <libmuguile/mu-guile-common.h>
|
||||||
#include <libguile.h>
|
|
||||||
#include <libmuguile/mu-guile-msg.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-runtime.h"
|
||||||
#include "mu-util.h"
|
#include "mu-util.h"
|
||||||
@ -76,9 +73,7 @@ on_dir_change (GFileMonitor *mon, GFile *file, GFile *other_file,
|
|||||||
|
|
||||||
if (fork() == 0) { /* run guile in child */
|
if (fork() == 0) { /* run guile in child */
|
||||||
|
|
||||||
scm_with_guile (&mu_guile_msg_init, NULL);
|
mu_guile_init (); /* initialize mu guile modules */
|
||||||
scm_with_guile (&mu_guile_store_init, NULL);
|
|
||||||
scm_with_guile (&mu_guile_misc_init, NULL);
|
|
||||||
|
|
||||||
if (!(gboolean)scm_with_guile
|
if (!(gboolean)scm_with_guile
|
||||||
((MuGuileFunc*)&mu_guile_msg_load_current, path)) {
|
((MuGuileFunc*)&mu_guile_msg_load_current, path)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user