Factor out some common typemaps into src/base-typemaps.i

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15026 57a11ea4-9604-0410-9ed3-97b8803252fd
zzzoldfeatures/remove-group2
Chris Shoemaker 20 years ago
parent e60faaee40
commit 838ff86fbd

@ -47,6 +47,7 @@ endif
MAINTAINERCLEANFILES = swig-runtime.h
EXTRA_DIST = \
base-typemaps.i \
README.modules \
gnc-test-env \
valgrind-gnucash.supp \

@ -76,9 +76,9 @@ libgncmod_app_utils_la_LIBADD = \
${GLIB_LIBS}
if BUILDING_FROM_SVN
swig-app-utils.c: app-utils.i ${gncinclude_HEADERS}
swig-app-utils.c: app-utils.i
$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
-I${top_srcdir}/src/engine -I${top_srcdir}/lib/libqof/qof -o $@ $<
-I${top_srcdir}/src -o $@ $<
endif
gncmoddir = ${GNC_SHAREDIR}/guile-modules/gnucash

@ -17,29 +17,7 @@
SCM scm_init_sw_app_utils_module (void);
%}
//%import "engine.i"
%typemap(in) GNCPrintAmountInfo "$1 = gnc_scm2printinfo($input);"
%typemap(out) GNCPrintAmountInfo "$result = gnc_printinfo2scm($1);"
%typemap(out) GncCommodityList {
SCM list = SCM_EOL;
GList *node;
for (node = $1; node; node = node->next)
list = scm_cons(gnc_quoteinfo2scm(node->data), list);
$result = scm_reverse(list);
}
// Temporary SWIG<->G-wrap converters for engine types
%typemap(in) gboolean "$1 = SCM_NFALSEP($input) ? TRUE : FALSE;"
%typemap(out) gboolean "$result = $1 ? SCM_BOOL_T : SCM_BOOL_F;"
%typemap(in) gnc_numeric "$1 = gnc_scm_to_numeric($input);"
%typemap(out) gnc_numeric "$result = gnc_numeric_to_scm($1);"
// End of temporary typemaps.
%import "base-typemaps.i"
typedef void (*GNCOptionChangeCallback) (gpointer user_data);
typedef int GNCOptionDBHandle;
@ -55,6 +33,16 @@ void gnc_option_db_destroy(GNCOptionDB *odb);
void gnc_option_db_set_option_selectable_by_name(SCM guile_option,
const char *section, const char *name, gboolean selectable);
%typemap(out) GncCommodityList {
SCM list = SCM_EOL;
GList *node;
for (node = $1; node; node = node->next)
list = scm_cons(gnc_quoteinfo2scm(node->data), list);
$result = scm_reverse(list);
}
%inline %{
typedef GList GncCommodityList;
@ -89,8 +77,6 @@ gnc_numeric gnc_convert_to_euro(const gnc_commodity * currency,
gnc_numeric gnc_convert_from_euro(const gnc_commodity * currency,
gnc_numeric value);
typedef int time_t;
time_t gnc_accounting_period_fiscal_start(void);
time_t gnc_accounting_period_fiscal_end(void);

@ -0,0 +1,64 @@
%typemap(in) gboolean "$1 = SCM_NFALSEP($input) ? TRUE : FALSE;"
%typemap(out) gboolean "$result = $1 ? SCM_BOOL_T : SCM_BOOL_F;"
%typemap(in) Timespec "$1 = gnc_timepair2timespec($input);"
%typemap(out) Timespec "$result = gnc_timespec2timepair($1);"
%typemap(in) GUID "$1 = gnc_scm2guid($input);"
%typemap(out) GUID "$result = gnc_guid2scm($1);"
%typemap(in) GUID * (GUID g) " g = gnc_scm2guid($input); $1 = &g; "
%typemap(out) GUID * " $result = ($1) ? gnc_guid2scm(*($1)): SCM_UNDEFINED; "
%typemap(in) gnc_numeric "$1 = gnc_scm_to_numeric($input);"
%typemap(out) gnc_numeric "$result = gnc_numeric_to_scm($1);"
%typemap(in) gint64 " $1 = gnc_scm_to_gint64($input); "
%typemap(out) gint64 " $result = gnc_gint64_to_scm($1); "
/* Not sure why SWIG doesn't figure this out. */
typedef void * gpointer;
typedef int gint;
typedef int time_t;
typedef unsigned int guint;
typedef char * URLType;
typedef char gchar;
%typemap(newfree) gchar * "g_free($1);"
%typemap(in) GNCPrintAmountInfo "$1 = gnc_scm2printinfo($input);"
%typemap(out) GNCPrintAmountInfo "$result = gnc_printinfo2scm($1);"
%define GLIST_HELPER_INOUT(ListType, ElemSwigType)
%typemap(in) ListType * {
SCM list = $input;
GList *c_list = NULL;
while (!SCM_NULLP(list)) {
Account *p;
SCM p_scm = SCM_CAR(list);
if (SCM_FALSEP(p_scm) || SCM_NULLP(p_scm))
p = NULL;
else
p = SWIG_MustGetPtr(p_scm, ElemSwigType, 1, 0);
c_list = g_list_prepend(c_list, p);
list = SCM_CDR(list);
}
$1 = g_list_reverse(c_list);
}
%typemap(out) ListType * {
SCM list = SCM_EOL;
GList *node;
for (node = $1; node; node = node->next)
list = scm_cons(SWIG_NewPointerObj(node->data,
ElemSwigType, 0), list);
$result = scm_reverse(list);
}
%enddef

@ -68,7 +68,7 @@ libgncmod_business_core_la_LIBADD = \
if BUILDING_FROM_SVN
swig-business-core.c: business-core.i ${noinst_HEADERS}
$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
-I${top_srcdir}/src/engine -o $@ $<
-I${top_srcdir}/src -o $@ $<
endif
gncmoddir = ${GNC_SHAREDIR}/guile-modules/gnucash

@ -20,21 +20,7 @@
SCM scm_init_sw_business_core_module (void);
%}
// Temporary SWIG<->G-wrap converters for engine types
%typemap(in) gboolean "$1 = SCM_NFALSEP($input) ? TRUE : FALSE;"
%typemap(out) gboolean "$result = $1 ? SCM_BOOL_T : SCM_BOOL_F;"
%typemap(in) Timespec "$1 = gnc_timepair2timespec($input);"
%typemap(out) Timespec "$result = gnc_timespec2timepair($1);"
%typemap(in) GUID "$1 = gnc_scm2guid($input);"
%typemap(out) GUID "$result = gnc_guid2scm($1);"
%typemap(in) gnc_numeric "$1 = gnc_scm_to_numeric($input);"
%typemap(out) gnc_numeric "$result = gnc_numeric_to_scm($1);"
// End of temporary typemaps.
%import "base-typemaps.i"
%rename(gncOwnerReturnGUID) gncOwnerRetGUID;
@ -77,33 +63,14 @@ static GncEmployee * gncEmployeeLookupFlip(GUID g, QofBook *b)
%}
%typemap(out) EntryList * {
SCM list = SCM_EOL;
GList *node;
for (node = $1; node; node = node->next)
list = scm_cons(SWIG_NewPointerObj(node->data,
SWIGTYPE_p__gncEntry, 0), list);
$result = scm_reverse(list);
}
%typemap(out) AccountValueList * {
SCM list = SCM_EOL;
GList *node;
for (node = $1; node; node = node->next)
list = scm_cons(SWIG_NewPointerObj(node->data,
SWIGTYPE_p__gncAccountValue, 0), list);
$result = scm_reverse(list);
}
GLIST_HELPER_INOUT(EntryList, SWIGTYPE_p__gncEntry);
GLIST_HELPER_INOUT(AccountValueList, SWIGTYPE_p__gncAccountValue);
%typemap(in) GncAccountValue * "$1 = gnc_scm_to_account_value_ptr($input);"
%typemap(out) GncAccountValue * "$result = gnc_account_value_ptr_to_scm($1);"
/* Parse the header file to generate wrappers */
/* Parse the header files to generate wrappers */
%include <gncAddress.h>
%include <gncBillTerm.h>
%include <gncCustomer.h>

@ -41,8 +41,9 @@ libgncmod_dialog_tax_table_la_LIBADD = \
${EFENCE_LIBS}
if BUILDING_FROM_SVN
swig-dialog-tax-table.c: dialog-tax-table.i ${noinst_HEADERS}
$(SWIG) -guile $(SWIG_ARGS) -Linkage module -o $@ $<
swig-dialog-tax-table.c: dialog-tax-table.i
$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
-I${top_srcdir}/src -o $@ $<
endif
gncmoddir = ${GNC_SHAREDIR}/guile-modules/gnucash

@ -7,4 +7,6 @@
SCM scm_init_sw_dialog_tax_table_module (void);
%}
%import "base-typemaps.i"
TaxTableWindow * gnc_ui_tax_table_window_new (GNCBook *book);

@ -26,7 +26,8 @@ noinst_HEADERS = \
if BUILDING_FROM_SVN
swig-core-utils.c: core-utils.i
$(SWIG) -guile $(SWIG_ARGS) -Linkage module -o $@ $<
$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
-I${top_srcdir}/src -o $@ $<
endif
AM_CFLAGS = \

@ -1,6 +1,5 @@
%module sw_core_utils
%{
//#include <gnc-gconf-utils.h>
#include <gnc-glib-utils.h>
#include <gnc-main.h>
#include <glib.h>
@ -8,12 +7,7 @@
SCM scm_init_sw_core_utils_module (void);
%}
typedef char gchar;
%typemap(newfree) gchar * "g_free($1);"
%typemap(in) gboolean " $1 = SCM_NFALSEP($input) ? TRUE : FALSE; "
%typemap(out) gboolean " $result = $1 ? SCM_BOOL_T : SCM_BOOL_F; "
%import "base-typemaps.i"
%newobject g_find_program_in_path;
gchar * g_find_program_in_path(const gchar *);

@ -170,7 +170,7 @@ noinst_DATA = .scm-links
if BUILDING_FROM_SVN
swig-engine.c: engine.i ${gncinclude_HEADERS} ${noinst_HEADERS}
$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
-I${top_srcdir}/lib/libqof/qof -o $@ $<
-I${top_srcdir}/lib/libqof/qof -I${top_srcdir}/src -o $@ $<
endif
iso-4217-currencies.c: iso-4217-currencies.scm iso-currencies-to-c

@ -22,65 +22,8 @@
SCM scm_init_sw_engine_module (void);
%}
/* Not sure why SWIG doesn't figure this out. */
typedef unsigned int guint;
typedef char gchar;
typedef void * gpointer;
typedef int gint;
//%import "glib.h"
%import "base-typemaps.i"
//typedef const gchar * QofIdType;
//%import "qofid.h"
%typemap(in) gint64 " $1 = gnc_scm_to_gint64($input); "
%typemap(out) gint64 " $result = gnc_gint64_to_scm($1); "
%typemap(in) gboolean " $1 = SCM_NFALSEP($input) ? TRUE : FALSE; "
%typemap(out) gboolean " $result = $1 ? SCM_BOOL_T : SCM_BOOL_F; "
%typemap(in) Timespec " $1 = gnc_timepair2timespec($input); "
%typemap(out) Timespec " $result = gnc_timespec2timepair($1); "
%typemap(in) GUID " $1 = gnc_scm2guid($input); "
%typemap(out) GUID " $result = gnc_guid2scm($1); "
%typemap(in) GUID * (GUID g) " g = gnc_scm2guid($input); $1 = &g; "
%typemap(out) GUID * " $result = ($1) ? gnc_guid2scm(*($1)): SCM_UNDEFINED; "
%typemap(in) gnc_numeric " $1 = gnc_scm_to_numeric($input); "
%typemap(out) gnc_numeric " $result = gnc_numeric_to_scm($1); "
%define GLIST_HELPER_INOUT(ListType, ElemSwigType)
%typemap(in) ListType * {
SCM list = $input;
GList *c_list = NULL;
while (!SCM_NULLP(list)) {
Account *p;
SCM p_scm = SCM_CAR(list);
if (SCM_FALSEP(p_scm) || SCM_NULLP(p_scm))
p = NULL;
else
p = SWIG_MustGetPtr(p_scm, ElemSwigType, 1, 0);
c_list = g_list_prepend(c_list, p);
list = SCM_CDR(list);
}
$1 = g_list_reverse(c_list);
}
%typemap(out) ListType * {
SCM list = SCM_EOL;
GList *node;
for (node = $1; node; node = node->next)
list = scm_cons(SWIG_NewPointerObj(node->data,
ElemSwigType, 0), list);
$result = scm_reverse(list);
}
%enddef
GLIST_HELPER_INOUT(SplitList, SWIGTYPE_p_Split);
GLIST_HELPER_INOUT(TransList, SWIGTYPE_p_Transaction);
@ -113,8 +56,10 @@ static const GUID * gncBudgetGetGUID(GncBudget *x)
%typemap(newfree) gchar * "g_free($1);"
/* NB: Should cover all the functions currently used, but not all that
* are wrapped */
/* NB: The object ownership annotations should already cover all the
functions currently used in guile, but not all the functions that are
wrapped. So, we should contract the interface to wrap only the used
functions. */
%newobject xaccGroupGetSubAccountsSorted;
%newobject xaccGroupGetAccountListSorted;
@ -138,7 +83,6 @@ static const GUID * gncBudgetGetGUID(GncBudget *x)
%newobject gnc_build_book_path;
/* Parse the header file to generate wrappers */
//#define QOF_ID_BOOK "Book"
%inline {
static QofIdType QOF_ID_BOOK_SCM (void) { return QOF_ID_BOOK; }
}

@ -28,7 +28,8 @@ noinst_DATA = .scm-links
if BUILDING_FROM_SVN
swig-gnc-module.c: gnc-module.i
$(SWIG) -guile $(SWIG_ARGS) -Linkage module -o $@ $<
$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
-I${top_srcdir}/src -o $@ $<
endif
EXTRA_DIST = \

@ -5,8 +5,7 @@
SCM scm_init_sw_gnc_module_module (void);
%}
typedef char gchar;
typedef int gint;
%import "base-typemaps.i"
void gnc_module_system_init(void);
void gnc_module_system_refresh(void);

@ -189,9 +189,9 @@ libgncmod_gnome_utils_la_LIBADD = \
${LIBXML2_LIBS}
if BUILDING_FROM_SVN
swig-gnome-utils.c: gnome-utils.i ${noinst_HEADERS} ${gncinclude_HEADERS}
swig-gnome-utils.c: gnome-utils.i gnc-html.h print-session.h
$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
-I${top_srcdir}/src/engine -o $@ $<
-I${top_srcdir}/src -o $@ $<
endif
gncmoddir = ${GNC_SHAREDIR}/guile-modules/gnucash

@ -9,7 +9,6 @@
#include <gnc-amount-edit.h>
#include <gnc-date-edit.h>
#include <gnc-file.h>
//#include <gnc-gconf-utils.h>
#include <gnc-gnome-utils.h>
#include <gnc-gui-query.h>
#include <gnc-html.h>
@ -24,18 +23,11 @@
SCM scm_init_sw_gnome_utils_module (void);
%}
// Temporary SWIG<->G-wrap converters for engine types
%typemap(in) gboolean "$1 = SCM_NFALSEP($input) ? TRUE : FALSE;"
%typemap(out) gboolean "$result = $1 ? SCM_BOOL_T : SCM_BOOL_F;"
%import "base-typemaps.i"
// End of temporary typemaps.
typedef char * URLType;
typedef char gchar;
//%include "gnc-main-window.h"
/* Parse the header file to generate wrappers */
%include "gnc-html.h"
/* Parse the header file to generate wrappers */
GNCOptionWin * gnc_options_dialog_new(gchar *title);
void gnc_options_dialog_destroy(GNCOptionWin * win);
@ -60,11 +52,7 @@ void
gnc_info_dialog(GtkWidget *parent,
const char *format, ...);
void gnc_add_scm_extension (SCM extension);
//char * gnc_html_encode_string(const char * str);
//char * gnc_build_url (const gchar * type, const gchar * location,
// const gchar * label);
void gnc_set_busy_cursor (GtkWidget *w, gboolean update_now);
void gnc_unset_busy_cursor (GtkWidget *w);

@ -89,9 +89,9 @@ noinst_HEADERS = \
window-reconcile.h
if BUILDING_FROM_SVN
swig-gnome.c: gnome.i ${noinst_HEADERS}
swig-gnome.c: gnome.i dialog-progress.h
$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
-I${top_srcdir}/src/engine -o $@ $<
-I${top_srcdir}/src -o $@ $<
endif
EXTRA_DIST = \

@ -8,10 +8,7 @@
SCM scm_init_sw_gnome_module (void);
%}
// Temporary SWIG<->G-wrap converters for engine types
%typemap(in) gboolean "$1 = SCM_NFALSEP($input) ? TRUE : FALSE;"
%typemap(out) gboolean "$result = $1 ? SCM_BOOL_T : SCM_BOOL_F;"
// End of temporary typemaps.
%import "base-typemaps.i"
/* Parse the header file to generate wrappers */
%include <dialog-progress.h>

@ -51,9 +51,9 @@ libgncmod_report_gnome_la_LIBADD = \
${GLIB_LIBS}
if BUILDING_FROM_SVN
swig-report-gnome.c: report-gnome.i ${gncinclude_HEADERS}
swig-report-gnome.c: report-gnome.i
$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
-I${top_srcdir}/src/engine -o $@ $<
-I${top_srcdir}/src -o $@ $<
endif
gncmoddir = ${GNC_SHAREDIR}/guile-modules/gnucash/report

@ -10,6 +10,8 @@
SCM scm_init_sw_report_gnome_module (void);
%}
%import "base-typemaps.i"
void gnc_report_raise_editor(SCM report);
void gnc_main_window_open_report(int report_id, GncMainWindow *window);
GtkWidget * gnc_report_window_default_params_editor(SCM options, SCM report);

@ -18,8 +18,9 @@ libgncmod_report_system_la_LIBADD = \
${GLIB_LIBS}
if BUILDING_FROM_SVN
swig-report-system.c: report-system.i ${gncinclude_HEADERS}
$(SWIG) -guile $(SWIG_ARGS) -Linkage module -o $@ $<
swig-report-system.c: report-system.i
$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
-I${top_srcdir}/src -o $@ $<
endif
AM_CFLAGS = \

@ -7,7 +7,7 @@
SCM scm_init_sw_report_system_module (void);
%}
typedef int gint;
%import "base-typemaps.i"
SCM gnc_report_find(gint id);
gint gnc_report_add(SCM report);

Loading…
Cancel
Save