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 *
|
|
|
|
* *
|
|
|
|
\********************************************************************/
|
|
|
|
|
2011-01-27 13:09:27 -06:00
|
|
|
#if defined(SWIGGUILE)
|
|
|
|
%{
|
2008-01-06 09:10:59 -06:00
|
|
|
/* Disable -Waddress. GCC 4.2 warns (and fails to compile with -Werror) when
|
|
|
|
* passing the address of a guid on the stack to QOF_BOOK_LOOKUP_ENTITY via
|
|
|
|
* gncInvoiceLookup and friends. When the macro gets inlined, the compiler
|
|
|
|
* emits a warning that the guid null pointer test is always true.
|
|
|
|
*/
|
|
|
|
#if (__GNUC__ >= 4 && __GNUC_MINOR__ >= 2)
|
2008-09-19 11:09:12 -05:00
|
|
|
# pragma GCC diagnostic warning "-Waddress"
|
2008-01-06 09:10:59 -06:00
|
|
|
#endif
|
2006-10-15 14:02:05 -05:00
|
|
|
%}
|
2011-01-27 13:09:27 -06:00
|
|
|
#endif
|
2006-10-15 14:02:05 -05:00
|
|
|
|
|
|
|
%rename(gncOwnerReturnGUID) gncOwnerRetGUID;
|
|
|
|
|
|
|
|
%inline %{
|
2010-03-27 16:01:21 -05:00
|
|
|
static GncGUID gncTaxTableReturnGUID(GncTaxTable *x)
|
2006-10-15 14:02:05 -05:00
|
|
|
{ return (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null())); }
|
|
|
|
|
2010-03-27 16:01:21 -05:00
|
|
|
static GncGUID gncInvoiceReturnGUID(GncInvoice *x)
|
2006-10-15 14:02:05 -05:00
|
|
|
{ return (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null())); }
|
|
|
|
|
2010-03-27 16:01:21 -05:00
|
|
|
static GncGUID gncJobReturnGUID(GncJob *x)
|
2006-10-15 14:02:05 -05:00
|
|
|
{ return (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null())); }
|
|
|
|
|
2010-03-27 16:01:21 -05:00
|
|
|
static GncGUID gncVendorReturnGUID(GncVendor *x)
|
2006-10-15 14:02:05 -05:00
|
|
|
{ return (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null())); }
|
|
|
|
|
2010-03-27 16:01:21 -05:00
|
|
|
static GncGUID gncCustomerReturnGUID(GncCustomer *x)
|
2006-10-15 14:02:05 -05:00
|
|
|
{ return (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null())); }
|
|
|
|
|
2010-03-27 16:01:21 -05:00
|
|
|
static GncGUID gncEmployeeReturnGUID(GncEmployee *x)
|
2006-10-15 14:02:05 -05:00
|
|
|
{ return (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null())); }
|
|
|
|
|
2010-03-27 16:01:21 -05:00
|
|
|
static GncTaxTable * gncTaxTableLookupFlip(GncGUID g, QofBook *b)
|
2006-10-15 14:02:05 -05:00
|
|
|
{ return gncTaxTableLookup(b, &g); }
|
|
|
|
|
2010-03-27 16:01:21 -05:00
|
|
|
static GncInvoice * gncInvoiceLookupFlip(GncGUID g, QofBook *b)
|
2006-10-15 14:02:05 -05:00
|
|
|
{ return gncInvoiceLookup(b, &g); }
|
|
|
|
|
2010-03-27 16:01:21 -05:00
|
|
|
static GncJob * gncJobLookupFlip(GncGUID g, QofBook *b)
|
2006-10-15 14:02:05 -05:00
|
|
|
{ return gncJobLookup(b, &g); }
|
|
|
|
|
2010-03-27 16:01:21 -05:00
|
|
|
static GncVendor * gncVendorLookupFlip(GncGUID g, QofBook *b)
|
2006-10-15 14:02:05 -05:00
|
|
|
{ return gncVendorLookup(b, &g); }
|
|
|
|
|
2010-03-27 16:01:21 -05:00
|
|
|
static GncCustomer * gncCustomerLookupFlip(GncGUID g, QofBook *b)
|
2006-10-15 14:02:05 -05:00
|
|
|
{ return gncCustomerLookup(b, &g); }
|
|
|
|
|
2010-03-27 16:01:21 -05:00
|
|
|
static GncEmployee * gncEmployeeLookupFlip(GncGUID g, QofBook *b)
|
2006-10-15 14:02:05 -05:00
|
|
|
{ return gncEmployeeLookup(b, &g); }
|
|
|
|
|
|
|
|
%}
|
|
|
|
|
2010-11-22 14:17:18 -06:00
|
|
|
GLIST_HELPER_INOUT(GncInvoiceList, SWIGTYPE_p__gncInvoice);
|
2006-10-15 22:35:56 -05:00
|
|
|
GLIST_HELPER_INOUT(EntryList, SWIGTYPE_p__gncEntry);
|
2017-09-09 02:03:52 -05:00
|
|
|
GLIST_HELPER_INOUT(GncTaxTableGetTables, SWIGTYPE_p__gncTaxTable);
|
2009-04-23 19:49:17 -05:00
|
|
|
GLIST_HELPER_INOUT(GncTaxTableEntryList, SWIGTYPE_p__gncTaxTableEntry);
|
2010-10-02 09:59:33 -05:00
|
|
|
GLIST_HELPER_INOUT(OwnerList, SWIGTYPE_p__gncOwner);
|
2006-10-15 14:02:05 -05:00
|
|
|
|
2011-01-27 13:09:27 -06:00
|
|
|
#if defined(SWIGGUILE)
|
2006-10-15 14:02:05 -05:00
|
|
|
%typemap(in) GncAccountValue * "$1 = gnc_scm_to_account_value_ptr($input);"
|
|
|
|
%typemap(out) GncAccountValue * "$result = gnc_account_value_ptr_to_scm($1);"
|
2007-10-06 18:05:16 -05:00
|
|
|
%typemap(in) AccountValueList * {
|
|
|
|
SCM list = $input;
|
|
|
|
GList *c_list = NULL;
|
|
|
|
|
2009-12-31 08:41:12 -06:00
|
|
|
while (!scm_is_null(list)) {
|
2007-10-06 18:05:16 -05:00
|
|
|
GncAccountValue *p;
|
|
|
|
|
|
|
|
SCM p_scm = SCM_CAR(list);
|
2009-12-31 08:41:12 -06:00
|
|
|
if (scm_is_false(p_scm) || scm_is_null(p_scm))
|
2007-10-06 18:05:16 -05:00
|
|
|
p = NULL;
|
|
|
|
else
|
|
|
|
p = gnc_scm_to_account_value_ptr(p_scm);
|
|
|
|
|
|
|
|
c_list = g_list_prepend(c_list, p);
|
|
|
|
list = SCM_CDR(list);
|
|
|
|
}
|
|
|
|
|
|
|
|
$1 = g_list_reverse(c_list);
|
|
|
|
}
|
|
|
|
%typemap(out) AccountValueList * {
|
|
|
|
SCM list = SCM_EOL;
|
|
|
|
GList *node;
|
|
|
|
|
|
|
|
for (node = $1; node; node = node->next)
|
|
|
|
list = scm_cons(gnc_account_value_ptr_to_scm(node->data), list);
|
|
|
|
|
|
|
|
$result = scm_reverse(list);
|
|
|
|
}
|
2011-01-27 13:09:27 -06:00
|
|
|
#endif
|
2006-10-15 14:02:05 -05:00
|
|
|
|
|
|
|
|
2006-10-15 22:35:56 -05:00
|
|
|
/* Parse the header files to generate wrappers */
|
2006-10-15 14:02:05 -05:00
|
|
|
%include <gncAddress.h>
|
|
|
|
%include <gncBillTerm.h>
|
2010-10-02 09:59:33 -05:00
|
|
|
%include <gncBusiness.h>
|
2006-10-15 14:02:05 -05:00
|
|
|
%include <gncCustomer.h>
|
|
|
|
%include <gncEmployee.h>
|
|
|
|
%include <gncEntry.h>
|
|
|
|
%include <gncInvoice.h>
|
|
|
|
%include <gncJob.h>
|
|
|
|
%include <gncOrder.h>
|
|
|
|
%include <gncOwner.h>
|
|
|
|
%include <gncTaxTable.h>
|
|
|
|
%include <gncVendor.h>
|
2011-01-27 13:09:27 -06:00
|
|
|
#if defined(SWIGGUILE)
|
2006-10-15 14:02:05 -05:00
|
|
|
%include <gncBusGuile.h>
|
2011-01-27 13:09:27 -06:00
|
|
|
#endif
|
2010-12-07 18:33:29 -06:00
|
|
|
/* Import query bindings for the below invoice query functions (but
|
|
|
|
* don't generate bindings for them). */
|
2017-08-06 10:12:16 -05:00
|
|
|
%import <qofquery.h>
|
2006-10-15 14:02:05 -05:00
|
|
|
|
|
|
|
#define URL_TYPE_CUSTOMER GNC_ID_CUSTOMER
|
|
|
|
#define URL_TYPE_VENDOR GNC_ID_VENDOR
|
|
|
|
#define URL_TYPE_EMPLOYEE GNC_ID_EMPLOYEE
|
2008-10-26 17:12:14 -05:00
|
|
|
#define URL_TYPE_JOB GNC_ID_JOB
|
2006-10-15 14:02:05 -05:00
|
|
|
#define URL_TYPE_INVOICE GNC_ID_INVOICE
|
|
|
|
// not exactly clean
|
|
|
|
#define URL_TYPE_OWNERREPORT "owner-report"
|
|
|
|
|
2010-11-22 14:17:18 -06:00
|
|
|
%inline %{
|
|
|
|
static QofQuery * qof_query_create_for_invoices(void) {
|
|
|
|
return qof_query_create_for(GNC_ID_INVOICE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GncInvoiceList * qof_query_run_for_invoices(QofQuery *q) {
|
|
|
|
return qof_query_run(q);
|
|
|
|
}
|
|
|
|
%}
|
|
|
|
|
2011-01-27 13:09:27 -06:00
|
|
|
#if defined(SWIGGUILE)
|
2006-10-15 14:02:05 -05:00
|
|
|
%init {
|
|
|
|
{
|
|
|
|
char tmp[100];
|
|
|
|
|
|
|
|
#define SET_ENUM(e) snprintf(tmp, 100, "(set! %s (%s))", (e), (e)); \
|
|
|
|
scm_c_eval_string(tmp);
|
|
|
|
|
|
|
|
SET_ENUM("GNC-OWNER-CUSTOMER");
|
|
|
|
SET_ENUM("GNC-OWNER-VENDOR");
|
|
|
|
SET_ENUM("GNC-OWNER-EMPLOYEE");
|
|
|
|
SET_ENUM("GNC-OWNER-JOB");
|
|
|
|
SET_ENUM("GNC-AMT-TYPE-VALUE");
|
|
|
|
SET_ENUM("GNC-AMT-TYPE-PERCENT");
|
|
|
|
|
|
|
|
SET_ENUM("URL-TYPE-CUSTOMER");
|
|
|
|
SET_ENUM("URL-TYPE-VENDOR");
|
|
|
|
SET_ENUM("URL-TYPE-EMPLOYEE");
|
2008-10-26 17:12:14 -05:00
|
|
|
SET_ENUM("URL-TYPE-JOB");
|
2006-10-15 14:02:05 -05:00
|
|
|
SET_ENUM("URL-TYPE-INVOICE");
|
|
|
|
SET_ENUM("URL-TYPE-OWNERREPORT");
|
|
|
|
|
|
|
|
SET_ENUM("INVOICE-FROM-TXN");
|
|
|
|
SET_ENUM("INVOICE-FROM-LOT");
|
|
|
|
SET_ENUM("INVOICE-OWNER");
|
2010-10-07 15:04:26 -05:00
|
|
|
SET_ENUM("INVOICE-BILLTO");
|
2006-10-15 14:02:05 -05:00
|
|
|
SET_ENUM("OWNER-PARENTG");
|
|
|
|
SET_ENUM("OWNER-FROM-LOT");
|
|
|
|
|
2011-11-10 09:05:26 -06:00
|
|
|
SET_ENUM("GNC-INVOICE-UNDEFINED");
|
|
|
|
SET_ENUM("GNC-INVOICE-CUST-INVOICE");
|
|
|
|
SET_ENUM("GNC-INVOICE-VEND-INVOICE");
|
|
|
|
SET_ENUM("GNC-INVOICE-EMPL-INVOICE");
|
|
|
|
SET_ENUM("GNC-INVOICE-CUST-CREDIT-NOTE");
|
|
|
|
SET_ENUM("GNC-INVOICE-VEND-CREDIT-NOTE");
|
|
|
|
SET_ENUM("GNC-INVOICE-EMPL-CREDIT-NOTE");
|
2006-10-15 14:02:05 -05:00
|
|
|
|
2015-02-23 17:26:45 -06:00
|
|
|
#undef SET_ENUM
|
2006-10-15 14:02:05 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2011-01-27 13:09:27 -06:00
|
|
|
#endif
|