summaryrefslogtreecommitdiff
path: root/guile/mu-guile.hh
blob: 4954542dd7e03c257ae3d5f7e9d0ac94642f4d42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
** Copyright (C) 2011-2020 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
** Free Software Foundation; either version 3, or (at your option) any
** later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software Foundation,
** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**
*/

#ifndef __MU_GUILE_H__
#define __MU_GUILE_H__

#include <glib.h>
#include <mu-query.hh>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wredundant-decls"
#include <libguile.h>
#pragma GCC diagnostic pop

/**
 * get the singleton Store instance
 */
Mu::Store& mu_guile_store();

/**
 * whether mu-guile is initialized
 *
 * @return TRUE if MuGuile is Initialized, FALSE otherwise
 */
gboolean mu_guile_initialized();

/**
 * raise a guile error (based on a GError)
 *
 * @param func_name function name
 * @param err the error
 *
 * @return SCM_UNSPECIFIED
 */
SCM mu_guile_g_error(const char* func_name, GError* err);

/**
 * raise a guile error
 *
 * @param func_name function
 * @param status err code
 * @param fmt format string for error msg
 * @param args params for format string
 *
 * @return SCM_UNSPECIFIED
 */
SCM mu_guile_error(const char* func_name, int status, const char* fmt, SCM args);

/**
 * convert a string into an SCM -- . It assumes str is in UTF8 encoding, and
 * replace characters with '?' if needed.
 *
 * @param str a string
 *
 * @return a guile string or #f for empty
 */
SCM mu_guile_scm_from_string(const std::string& str);

/**
 * Initialize this mu guile module.
 *
 * @param data
 *
 * @return
 */
extern "C" {
void* mu_guile_init(void* data);
}
#endif /*__MU_GUILE_H__*/