* muile/libmuguile: support loading specific message, 'mu:current'
This commit is contained in:
@ -488,11 +488,39 @@ define_symbols (void)
|
||||
}
|
||||
|
||||
|
||||
gboolean
|
||||
mu_guile_msg_load_current (const char *path)
|
||||
{
|
||||
MuMsg *msg;
|
||||
GError *err;
|
||||
SCM msgsmob;
|
||||
|
||||
err = NULL;
|
||||
msg = mu_msg_new_from_file (path, NULL, &err);
|
||||
|
||||
if (!msg) {
|
||||
g_printerr ("error creating message for '%s'", path);
|
||||
if (err) {
|
||||
g_printerr (": %s", err->message);
|
||||
g_error_free (err);
|
||||
}
|
||||
g_printerr ("\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
msgsmob = mu_guile_msg_to_scm (msg);
|
||||
scm_c_define ("mu:current", msgsmob);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
mu_guile_msg_init (void *data)
|
||||
{
|
||||
|
||||
MSG_TAG = scm_make_smob_type ("msg", sizeof(MuMsgWrapper));
|
||||
|
||||
|
||||
scm_set_smob_mark (MSG_TAG, msg_mark);
|
||||
scm_set_smob_free (MSG_TAG, msg_free);
|
||||
scm_set_smob_print (MSG_TAG, msg_print);
|
||||
|
||||
@ -27,15 +27,28 @@
|
||||
extern "C" {
|
||||
#endif /*__cplusplus*/
|
||||
|
||||
/**
|
||||
typedef void* MuGuileFunc (void*);
|
||||
|
||||
/**
|
||||
* register MuMsg-related functions/smobs with guile; use with
|
||||
* scm_with_guile
|
||||
*
|
||||
*
|
||||
* @param data
|
||||
*/
|
||||
void *mu_guile_msg_init (void *data);
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* set 'mu:msg:current in the guile env
|
||||
*
|
||||
* @param path path to a message
|
||||
*
|
||||
* @return TRUE if it worked, FALSE otherwise
|
||||
*/
|
||||
gboolean mu_guile_msg_load_current (const char *path);
|
||||
|
||||
|
||||
/**
|
||||
* create an SCM for the MuMsg*
|
||||
*
|
||||
* @param msg a MuMsg instance
|
||||
|
||||
Reference in New Issue
Block a user