r14682 - gnucash/branches/swigify/src/business/business-core - Add temporary type-support for types that haven't been wrapped yet.

Chris Shoemaker chris at cvs.gnucash.org
Tue Aug 15 23:21:02 EDT 2006


Author: chris
Date: 2006-08-15 23:21:02 -0400 (Tue, 15 Aug 2006)
New Revision: 14682
Trac: http://svn.gnucash.org/trac/changeset/14682

Modified:
   gnucash/branches/swigify/src/business/business-core/business-core.i
   gnucash/branches/swigify/src/business/business-core/businessmod-core.c
Log:
   Add temporary type-support for types that haven't been wrapped yet.
   Make more custom wrappers equivalent to the "LookupDirect" macro functions.


Modified: gnucash/branches/swigify/src/business/business-core/business-core.i
===================================================================
--- gnucash/branches/swigify/src/business/business-core/business-core.i	2006-08-16 03:04:50 UTC (rev 14681)
+++ gnucash/branches/swigify/src/business/business-core/business-core.i	2006-08-16 03:21:02 UTC (rev 14682)
@@ -16,25 +16,61 @@
 #include <gncBusGuile.h>
 #include "engine-helpers.h"
 #include "gncBusGuile.h"
+
+#include <g-wrap-wct.h> //Temporary. Adds no link dep?!?
 %}
 
 %import "engine.i"
 
+// Temporary SWIG<->G-wrap converters 
+%typemap(in) QofBook * {
+  $1 = (QofBook *)gw_wcp_get_ptr($input);
+}
+
+%typemap(out) QofBook * {
+  $result = gw_wcp_assimilate_ptr($1, scm_c_eval_string("<gnc:Book*>"));
+}
+
+
 %rename(gncOwnerReturnGUID) gncOwnerRetGUID;
 
 %inline %{
 GUID gncTaxTableReturnGUID(GncTaxTable *x)
 { return (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null())); }
+
 GUID gncInvoiceReturnGUID(GncInvoice *x)
 { return (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null())); }
+
 GUID gncJobReturnGUID(GncJob *x)
 { return (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null())); }
+
 GUID gncVendorReturnGUID(GncVendor *x)
 { return (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null())); }
+
 GUID gncCustomerReturnGUID(GncCustomer *x)
 { return (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null())); }
+
 GUID gncEmployeeReturnGUID(GncEmployee *x)
 { return (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null())); }
+
+GncTaxTable * gncTaxTableLookupFlip(GUID g, QofBook *b) 
+{ return gncTaxTableLookup(b, &g); }
+
+GncInvoice * gncInvoiceLookupFlip(GUID g, QofBook *b) 
+{ return gncInvoiceLookup(b, &g); }
+
+GncJob * gncJobLookupFlip(GUID g, QofBook *b) 
+{ return gncJobLookup(b, &g); }
+
+GncVendor * gncVendorLookupFlip(GUID g, QofBook *b) 
+{ return gncVendorLookup(b, &g); }
+
+GncCustomer * gncCustomerLookupFlip(GUID g, QofBook *b) 
+{ return gncCustomerLookup(b, &g); }
+
+GncEmployee * gncEmployeeLookupFlip(GUID g, QofBook *b) 
+{ return gncEmployeeLookup(b, &g); }
+
 %}
 
 //%typemap(in) EntryList {

Modified: gnucash/branches/swigify/src/business/business-core/businessmod-core.c
===================================================================
--- gnucash/branches/swigify/src/business/business-core/businessmod-core.c	2006-08-16 03:04:50 UTC (rev 14681)
+++ gnucash/branches/swigify/src/business/business-core/businessmod-core.c	2006-08-16 03:21:02 UTC (rev 14682)
@@ -43,6 +43,7 @@
 #include "gncOwnerP.h"
 #include "gncTaxTableP.h"
 #include "gncVendorP.h"
+#include "g-wrap-wct.h" //temp
 
 extern SCM scm_init_sw_business_core_module (void);
 
@@ -100,6 +101,23 @@
   scm_c_eval_string("(use-modules (sw_business_core))");
   scm_c_eval_string("(use-modules (gnucash business-core))");
 
+  // temp code until gnc:id-type is wrapped
+  {
+      SCM wct_gnc_id_type = scm_c_eval_string("<gnc:id-type>");
+      SCM tmp;
+      
+      tmp = gw_wcp_assimilate_ptr(INVOICE_FROM_TXN, wct_gnc_id_type);
+      scm_c_define("gnc:invoice-from-txn", tmp);
+      tmp = gw_wcp_assimilate_ptr(INVOICE_FROM_LOT, wct_gnc_id_type);
+      scm_c_define("gnc:invoice-from-lot", tmp);
+      tmp = gw_wcp_assimilate_ptr(INVOICE_OWNER, wct_gnc_id_type);
+      scm_c_define("gnc:invoice-owner", tmp);
+      tmp = gw_wcp_assimilate_ptr(OWNER_PARENTG, wct_gnc_id_type);
+      scm_c_define("gnc:owner-parentg", tmp);
+      tmp = gw_wcp_assimilate_ptr(OWNER_FROM_LOT, wct_gnc_id_type);
+      scm_c_define("gnc:owner-from-lot", tmp);
+  }
+
   return TRUE;
 }
 



More information about the gnucash-changes mailing list