2015-09-29 14:08:48 -05:00
|
|
|
/********************************************************************\
|
|
|
|
* 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 2 of *
|
|
|
|
* the License, 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, contact: *
|
|
|
|
* *
|
|
|
|
* Free Software Foundation Voice: +1-617-542-5942 *
|
|
|
|
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
|
|
|
|
* Boston, MA 02110-1301, USA gnu@gnu.org *
|
|
|
|
* *
|
|
|
|
\********************************************************************/
|
|
|
|
|
2006-10-15 14:02:05 -05:00
|
|
|
%module sw_core_utils
|
|
|
|
%{
|
2013-12-08 12:02:25 -06:00
|
|
|
#include <config.h>
|
2013-12-11 08:45:40 -06:00
|
|
|
#include <gnc-environment.h>
|
2006-10-15 14:02:05 -05:00
|
|
|
#include <gnc-glib-utils.h>
|
2013-10-07 09:06:23 -05:00
|
|
|
#include <gnc-prefs.h>
|
2010-08-29 14:02:57 -05:00
|
|
|
#include <gnc-path.h>
|
2010-09-08 02:14:05 -05:00
|
|
|
#include <gnc-filepath-utils.h>
|
2011-01-30 22:29:48 -06:00
|
|
|
#include <gnc-locale-utils.h>
|
2006-10-15 14:02:05 -05:00
|
|
|
#include <glib.h>
|
2020-09-16 16:41:04 -05:00
|
|
|
#include <glib/gi18n.h>
|
2019-02-21 10:00:15 -06:00
|
|
|
#include <gnc-version.h>
|
2020-06-07 12:38:22 -05:00
|
|
|
#include <libintl.h>
|
|
|
|
|
2011-11-20 12:27:00 -06:00
|
|
|
%}
|
|
|
|
#if defined(SWIGGUILE)
|
|
|
|
%{
|
2013-12-14 10:40:42 -06:00
|
|
|
#include "guile-mappings.h"
|
|
|
|
|
2006-10-15 14:02:05 -05:00
|
|
|
SCM scm_init_sw_core_utils_module (void);
|
|
|
|
%}
|
2011-11-20 12:27:00 -06:00
|
|
|
#endif
|
|
|
|
#if defined(SWIGPYTHON)
|
|
|
|
%{
|
2019-10-01 09:27:28 -05:00
|
|
|
PyObject* SWIG_init (void);
|
2011-11-20 12:27:00 -06:00
|
|
|
%}
|
|
|
|
#endif
|
2006-10-15 22:35:56 -05:00
|
|
|
%import "base-typemaps.i"
|
2006-10-15 14:02:05 -05:00
|
|
|
|
2013-12-11 08:45:40 -06:00
|
|
|
%include <gnc-environment.h>
|
2013-10-07 09:06:23 -05:00
|
|
|
%include <gnc-prefs.h>
|
2019-02-21 10:00:15 -06:00
|
|
|
%include <gnc-version.h>
|
2006-10-15 14:02:05 -05:00
|
|
|
|
2010-12-30 09:51:32 -06:00
|
|
|
%newobject gnc_path_get_bindir;
|
2010-10-13 11:11:44 -05:00
|
|
|
gchar * gnc_path_get_bindir(void);
|
2010-12-30 09:51:32 -06:00
|
|
|
|
2019-04-04 13:34:55 -05:00
|
|
|
%newobject gnc_path_get_scmdir;
|
|
|
|
gchar * gnc_path_get_scmdir(void);
|
|
|
|
|
|
|
|
%newobject gnc_path_get_reportsdir;
|
|
|
|
gchar * gnc_path_get_reportsdir(void);
|
|
|
|
|
2020-02-29 09:16:05 -06:00
|
|
|
%newobject gnc_path_get_localedir;
|
|
|
|
gchar * gnc_path_get_localedir(void);
|
|
|
|
|
|
|
|
/* Name of our gettext-domain (defined in config.h) */
|
|
|
|
%constant char* GETTEXT_PACKAGE = GETTEXT_PACKAGE;
|
|
|
|
|
2010-12-30 09:51:32 -06:00
|
|
|
%newobject gnc_path_get_stdreportsdir;
|
2010-08-29 14:02:57 -05:00
|
|
|
gchar * gnc_path_get_stdreportsdir(void);
|
2010-12-30 09:51:32 -06:00
|
|
|
|
2017-08-22 09:33:34 -05:00
|
|
|
%newobject gnc_build_userdata_path;
|
|
|
|
gchar * gnc_build_userdata_path(const gchar *);
|
2012-12-18 04:25:49 -06:00
|
|
|
|
2019-04-04 13:34:55 -05:00
|
|
|
%newobject gnc_file_path_absolute;
|
|
|
|
gchar *gnc_file_path_absolute (const gchar *, const gchar *);
|
|
|
|
|
2021-12-27 11:44:00 -06:00
|
|
|
%newobject gnc_resolve_file_path;
|
|
|
|
gchar *gnc_resolve_file_path (const gchar *);
|
|
|
|
|
2021-07-30 10:16:01 -05:00
|
|
|
%newobject gnc_build_scm_path;
|
2019-06-14 02:21:15 -05:00
|
|
|
gchar * gnc_build_scm_path(const gchar *);
|
2021-07-30 10:16:01 -05:00
|
|
|
|
|
|
|
%newobject gnc_build_report_path;
|
2010-09-08 02:14:05 -05:00
|
|
|
gchar * gnc_build_report_path(const gchar *);
|
2021-07-30 10:16:01 -05:00
|
|
|
|
|
|
|
%newobject gnc_build_stdreports_path;
|
2010-09-08 02:14:05 -05:00
|
|
|
gchar * gnc_build_stdreports_path(const gchar *);
|
2021-07-30 10:16:01 -05:00
|
|
|
|
|
|
|
%newobject gnc_build_reports_path;
|
2019-04-04 13:34:55 -05:00
|
|
|
gchar * gnc_build_reports_path(const gchar *);
|
2010-08-29 14:02:57 -05:00
|
|
|
|
2007-05-29 11:24:38 -05:00
|
|
|
%newobject gnc_utf8_strip_invalid_strdup;
|
|
|
|
gchar * gnc_utf8_strip_invalid_strdup(const gchar *);
|
2010-12-30 09:51:32 -06:00
|
|
|
|
2008-04-01 17:07:28 -05:00
|
|
|
%newobject gnc_locale_from_utf8;
|
|
|
|
gchar * gnc_locale_from_utf8(const gchar *);
|
2010-12-30 09:51:32 -06:00
|
|
|
|
2008-04-02 13:10:35 -05:00
|
|
|
%newobject gnc_locale_to_utf8;
|
|
|
|
gchar * gnc_locale_to_utf8(const gchar *);
|
2010-12-30 09:51:32 -06:00
|
|
|
|
2011-01-30 22:29:48 -06:00
|
|
|
const char * gnc_locale_default_iso_currency_code (void);
|
|
|
|
|
2019-06-14 10:43:52 -05:00
|
|
|
%newobject gnc_locale_name;
|
|
|
|
gchar *gnc_locale_name (void);
|
|
|
|
|
2011-11-20 12:27:00 -06:00
|
|
|
#if defined(SWIGGUILE)
|
2020-01-15 02:29:27 -06:00
|
|
|
%init {
|
|
|
|
{
|
|
|
|
char tmp[100];
|
|
|
|
|
|
|
|
#define SET_ENUM(e) snprintf(tmp, 100, "(set! %s (%s))", (e), (e)); \
|
|
|
|
scm_c_eval_string(tmp);
|
|
|
|
|
|
|
|
/* Enum conversions go here */
|
2020-01-15 03:39:03 -06:00
|
|
|
SET_ENUM ("GNC-PREFS-GROUP-GENERAL");
|
|
|
|
SET_ENUM ("GNC-PREFS-GROUP-GENERAL-REGISTER");
|
|
|
|
SET_ENUM ("GNC-PREFS-GROUP-GENERAL-REPORT");
|
|
|
|
SET_ENUM ("GNC-PREFS-GROUP-WARNINGS");
|
|
|
|
SET_ENUM ("GNC-PREFS-GROUP-WARNINGS-TEMP");
|
|
|
|
SET_ENUM ("GNC-PREFS-GROUP-WARNINGS-PERM");
|
|
|
|
SET_ENUM ("GNC-PREFS-GROUP-ACCT-SUMMARY");
|
|
|
|
|
|
|
|
SET_ENUM ("GNC-PREF-VERSION");
|
|
|
|
SET_ENUM ("GNC-PREF-SAVE-GEOMETRY");
|
|
|
|
SET_ENUM ("GNC-PREF-LAST-PATH");
|
|
|
|
SET_ENUM ("GNC-PREF-USE-NEW");
|
|
|
|
SET_ENUM ("GNC-PREF-ACCOUNTING-LABELS");
|
|
|
|
SET_ENUM ("GNC-PREF-ACCOUNT-SEPARATOR");
|
|
|
|
SET_ENUM ("GNC-PREF-NEGATIVE-IN-RED");
|
|
|
|
SET_ENUM ("GNC-PREF-NUM-SOURCE");
|
|
|
|
SET_ENUM ("GNC-PREF-DATE-FORMAT");
|
|
|
|
SET_ENUM ("GNC-PREF-DATE-COMPL-THISYEAR");
|
|
|
|
SET_ENUM ("GNC-PREF-DATE-COMPL-SLIDING");
|
|
|
|
SET_ENUM ("GNC-PREF-DATE-BACKMONTHS");
|
|
|
|
SET_ENUM ("GNC-PREF-SHOW-LEAF-ACCT-NAMES");
|
|
|
|
SET_ENUM ("GNC-PREF-ENTER-MOVES-TO-END");
|
|
|
|
SET_ENUM ("GNC-PREF-DRAW-HOR-LINES");
|
|
|
|
SET_ENUM ("GNC-PREF-DRAW-VERT-LINES");
|
|
|
|
SET_ENUM ("GNC-PREF-ALT-COLOR-BY-TRANS");
|
|
|
|
SET_ENUM ("GNC-PREF-USE-THEME-COLORS");
|
|
|
|
SET_ENUM ("GNC-PREF-USE-GNUCASH-COLOR-THEME");
|
|
|
|
SET_ENUM ("GNC-PREF-TAB-TRANS-MEMORISED");
|
|
|
|
SET_ENUM ("GNC-PREF-FUTURE-AFTER-BLANK");
|
|
|
|
SET_ENUM ("GNC-PREF-START-CHOICE-ABS");
|
|
|
|
SET_ENUM ("GNC-PREF-START-CHOICE-REL");
|
|
|
|
SET_ENUM ("GNC-PREF-START-DATE");
|
|
|
|
SET_ENUM ("GNC-PREF-START-PERIOD");
|
|
|
|
SET_ENUM ("GNC-PREF-END-CHOICE-ABS");
|
|
|
|
SET_ENUM ("GNC-PREF-END-CHOICE-REL");
|
|
|
|
SET_ENUM ("GNC-PREF-END-DATE");
|
|
|
|
SET_ENUM ("GNC-PREF-END-PERIOD");
|
|
|
|
SET_ENUM ("GNC-PREF-CURRENCY-OTHER");
|
|
|
|
SET_ENUM ("GNC-PREF-CURRENCY-CHOICE-LOCALE");
|
|
|
|
SET_ENUM ("GNC-PREF-CURRENCY-CHOICE-OTHER");
|
2020-01-15 02:29:27 -06:00
|
|
|
|
|
|
|
#undef SET_ENUM
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-10-26 17:47:07 -05:00
|
|
|
%rename ("gnc:ngettext") ngettext;
|
|
|
|
extern const char* ngettext (const char *msgid1, const char *msgid2,
|
|
|
|
unsigned long int n);
|
2020-06-07 12:38:22 -05:00
|
|
|
%rename ("gnc:gettext") gettext;
|
|
|
|
extern const char* gettext(const char*);
|
2020-09-16 16:41:04 -05:00
|
|
|
%rename ("gnc:C_gettext") wrap_C_;
|
|
|
|
%inline %{
|
2022-04-01 20:08:19 -05:00
|
|
|
/* This helper function wraps the C_() macro in a function. */
|
2020-09-16 16:41:04 -05:00
|
|
|
const char* wrap_C_(const char* context, const char* msg);
|
|
|
|
const char* wrap_C_(const char* context, const char* msg)
|
|
|
|
{
|
2022-04-01 20:08:19 -05:00
|
|
|
return g_dpgettext2 (NULL, context, msg);
|
2020-09-16 16:41:04 -05:00
|
|
|
}
|
|
|
|
%}
|
2008-04-02 13:10:35 -05:00
|
|
|
%rename ("gnc-utf8?") wrap_gnc_utf8_validate;
|
|
|
|
%inline %{
|
|
|
|
/* This helper function wraps gnc_utf8_validate() into a predicate. */
|
|
|
|
gboolean wrap_gnc_utf8_validate(const gchar *);
|
|
|
|
gboolean wrap_gnc_utf8_validate(const gchar * str)
|
|
|
|
{
|
|
|
|
return gnc_utf8_validate(str, -1, 0);
|
|
|
|
}
|
2020-06-07 12:38:22 -05:00
|
|
|
|
2008-04-02 13:10:35 -05:00
|
|
|
%}
|
2015-02-23 17:26:45 -06:00
|
|
|
#elif defined(SWIGPYTHON)
|
2011-11-20 12:27:00 -06:00
|
|
|
gboolean gnc_utf8_validate(const gchar *, gssize, const gchar**);
|
|
|
|
#endif
|