mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[Python] Export core-utils SWIG wrappers to Python.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@21600 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
adb4a6fee6
commit
4ee898d90b
@ -93,7 +93,7 @@ typedef char gchar;
|
||||
}
|
||||
|
||||
%typemap(in) gchar * {
|
||||
$1 = ($1_type)PyString_AsString($input);
|
||||
$1 = ($1_ltype)PyString_AsString($input);
|
||||
}
|
||||
|
||||
%typemap(out) gchar * {
|
||||
|
@ -14,7 +14,7 @@ libgnc_core_utils_la_SOURCES = \
|
||||
gnc-main.c \
|
||||
gnc-path.c \
|
||||
gnc-uri-utils.c \
|
||||
swig-core-utils.c
|
||||
swig-core-utils-guile.c
|
||||
|
||||
libgnc_core_utils_la_LIBADD = \
|
||||
${GUILE_LIBS} \
|
||||
@ -24,6 +24,7 @@ libgnc_core_utils_la_LIBADD = \
|
||||
${GCONF_LIBS} \
|
||||
${QOF_LIBS}
|
||||
|
||||
|
||||
noinst_HEADERS = \
|
||||
binreloc.h \
|
||||
gnc-main.h \
|
||||
@ -38,9 +39,14 @@ noinst_HEADERS = \
|
||||
gnc-uri-utils.h
|
||||
|
||||
if BUILDING_FROM_SVN
|
||||
swig-core-utils.c: core-utils.i ${top_srcdir}/src/base-typemaps.i
|
||||
swig-core-utils-guile.c: core-utils.i ${top_srcdir}/src/base-typemaps.i
|
||||
$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
|
||||
-I${top_srcdir}/src -o $@ $<
|
||||
if WITH_PYTHON
|
||||
swig-core-utils-python.c: core-utils.i ${top_srcdir}/src/base-typemaps.i
|
||||
$(SWIG) -python -Wall -Werror $(SWIG_ARGS) \
|
||||
-I${top_srcdir}/src -o $@ $<
|
||||
endif
|
||||
endif
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
@ -62,6 +68,29 @@ if GNUCASH_SEPARATE_BUILDDIR
|
||||
SCM_FILE_LINKS = ${gncmod_DATA}
|
||||
endif
|
||||
|
||||
if WITH_PYTHON
|
||||
|
||||
lib_LTLIBRARIES += libgnc-core-utils-python.la
|
||||
|
||||
libgnc_core_utils_python_la_SOURCES = \
|
||||
swig-core-utils-python.c
|
||||
|
||||
libgnc_core_utils_python_la_LIBADD = \
|
||||
${PYTHON_LIBS} \
|
||||
${top_builddir}/src/core-utils/libgnc-core-utils.la
|
||||
|
||||
libgnc_core_utils_python_la_CPPFLAGS = \
|
||||
${GLIB_CFLAGS} \
|
||||
${GCONF_CFLAGS} \
|
||||
${GTK_MAC_CFLAGS} \
|
||||
${QOF_CFLAGS} \
|
||||
${PYTHON_CPPFLAGS} \
|
||||
-I${top_srcdir}/src/libqof/qof \
|
||||
-I${top_builddir}/src \
|
||||
-I${top_srcdir}/src
|
||||
|
||||
endif
|
||||
|
||||
.scm-links:
|
||||
$(RM) -rf gnucash
|
||||
mkdir -p gnucash
|
||||
|
@ -7,10 +7,22 @@
|
||||
#include <gnc-filepath-utils.h>
|
||||
#include <gnc-locale-utils.h>
|
||||
#include <glib.h>
|
||||
|
||||
%}
|
||||
#if defined(SWIGGUILE)
|
||||
%{
|
||||
SCM scm_init_sw_core_utils_module (void);
|
||||
%}
|
||||
|
||||
#endif
|
||||
#if defined(SWIGPYTHON)
|
||||
%{
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
PyObject*
|
||||
#else
|
||||
void
|
||||
#endif
|
||||
SWIG_init (void);
|
||||
%}
|
||||
#endif
|
||||
%import "base-typemaps.i"
|
||||
|
||||
gboolean gnc_is_debugging(void);
|
||||
@ -41,6 +53,7 @@ gchar * gnc_locale_to_utf8(const gchar *);
|
||||
|
||||
const char * gnc_locale_default_iso_currency_code (void);
|
||||
|
||||
#if defined(SWIGGUILE)
|
||||
%rename ("gnc-utf8?") wrap_gnc_utf8_validate;
|
||||
%inline %{
|
||||
/* This helper function wraps gnc_utf8_validate() into a predicate. */
|
||||
@ -50,3 +63,6 @@ const char * gnc_locale_default_iso_currency_code (void);
|
||||
return gnc_utf8_validate(str, -1, 0);
|
||||
}
|
||||
%}
|
||||
#elsif defined(SWIGPYTHON)
|
||||
gboolean gnc_utf8_validate(const gchar *, gssize, const gchar**);
|
||||
#endif
|
||||
|
@ -11,7 +11,7 @@ libgncmod_python_la_LDFLAGS = -avoid-version \
|
||||
|
||||
libgncmod_python_la_LIBADD = \
|
||||
${top_builddir}/src/gnc-module/libgnc-module.la \
|
||||
${top_builddir}/src/core-utils/libgnc-core-utils.la \
|
||||
${top_builddir}/src/core-utils/libgnc-core-utils-python.la \
|
||||
${top_builddir}/src/app-utils/libgncmod-app-utils-python.la \
|
||||
${PYTHON_LIBS} \
|
||||
${PYTHON_EXTRA_LIBS} \
|
||||
|
@ -39,8 +39,10 @@ libgncmod_python_gnc_module_description(void)
|
||||
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
extern PyObject* PyInit__sw_app_utils(void);
|
||||
extern PyObject* PyInit__sw_core_utils(void);
|
||||
#else
|
||||
extern void init_sw_app_utils(void);
|
||||
extern void init_sw_core_utils(void);
|
||||
#endif
|
||||
|
||||
int
|
||||
@ -53,8 +55,10 @@ libgncmod_python_gnc_module_init(int refcount)
|
||||
Py_Initialize();
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
PyInit__sw_app_utils();
|
||||
PyInit__sw_core_utils();
|
||||
#else
|
||||
init_sw_app_utils();
|
||||
init_sw_core_utils();
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user