r14663 - gnucash/branches/swigify/src/business - The arguments that point to structs defined in the same module as the

Chris Shoemaker chris at cvs.gnucash.org
Sun Aug 13 15:08:12 EDT 2006


Author: chris
Date: 2006-08-13 15:08:11 -0400 (Sun, 13 Aug 2006)
New Revision: 14663
Trac: http://svn.gnucash.org/trac/changeset/14663

Modified:
   gnucash/branches/swigify/src/business/business-gnome/Makefile.am
   gnucash/branches/swigify/src/business/business-gnome/business-gnome.i
   gnucash/branches/swigify/src/business/business-gnome/business-options-gnome.c
   gnucash/branches/swigify/src/business/business-gnome/dialog-invoice.c
   gnucash/branches/swigify/src/business/business-utils/business-options.c
Log:
   The arguments that point to structs defined in the same module as the 
   function being wrapped are typed as taking a pointer to the "real" struct, 
   not the "public" typedef'd name of the struct.  If functions in other
   modules use the same pointer arguments, and SWIG isn't told about the
   typedef to the struct, then these wrappers will be typed with an
   incompatible generic pointer type with the public type name.

   This commit resolves this by 1) using SWIG's %import directive to see the
   typedef to the struct name, 2) associated -Imodule lines in Makefile.am, 
   3) using the mangled form of the real struct name anywhere we need a 
   runtime type query.  Got it?


Modified: gnucash/branches/swigify/src/business/business-gnome/Makefile.am
===================================================================
--- gnucash/branches/swigify/src/business/business-gnome/Makefile.am	2006-08-13 18:57:03 UTC (rev 14662)
+++ gnucash/branches/swigify/src/business/business-gnome/Makefile.am	2006-08-13 19:08:11 UTC (rev 14663)
@@ -90,7 +90,10 @@
 
 
 swig-business-gnome.c: business-gnome.i
-	swig -guile $(SWIG_ARGS) -Linkage module -o $@ $<
+	swig -guile $(SWIG_ARGS) -Linkage module \
+	-I${top_srcdir}/src/business/business-core \
+	-I${top_srcdir}/src/engine \
+	-o $@ $<
 
 # For Business Reports
 gncscmmoddir = ${GNC_SHAREDIR}/guile-modules/gnucash/report/

Modified: gnucash/branches/swigify/src/business/business-gnome/business-gnome.i
===================================================================
--- gnucash/branches/swigify/src/business/business-gnome/business-gnome.i	2006-08-13 18:57:03 UTC (rev 14662)
+++ gnucash/branches/swigify/src/business/business-gnome/business-gnome.i	2006-08-13 19:08:11 UTC (rev 14663)
@@ -12,9 +12,10 @@
 #include <dialog-order.h>
 #include <dialog-payment.h>
 #include <dialog-vendor.h>
-
 %}
 
+%import "business-core.i"
+
 /* Parse the header file to generate wrappers */
 %include <business-urls.h>
 %include <dialog-billterms.h>

Modified: gnucash/branches/swigify/src/business/business-gnome/business-options-gnome.c
===================================================================
--- gnucash/branches/swigify/src/business/business-gnome/business-options-gnome.c	2006-08-13 18:57:03 UTC (rev 14662)
+++ gnucash/branches/swigify/src/business/business-gnome/business-options-gnome.c	2006-08-13 19:08:11 UTC (rev 14663)
@@ -147,7 +147,7 @@
 		   "Item is not a gw:wcp.", value);
 
   //owner = gw_wcp_get_ptr (value);
-  owner = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p_GncOwner"), 1, 0);
+  owner = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncOwner"), 1, 0);
 
   /* XXX: should we verify that the owner type is correct? */
   if (!owner) {
@@ -172,7 +172,7 @@
   owner.type = type;
   gnc_owner_get_owner (widget, &owner);
 
-  return SWIG_NewPointerObj(&owner, SWIG_TypeQuery("_p_GncOwner"), 0);
+  return SWIG_NewPointerObj(&owner, SWIG_TypeQuery("_p__gncOwner"), 0);
   //return gw_wcp_assimilate_ptr (&owner, scm_c_eval_string("<gnc:GncOwner*>"));
 }
 
@@ -217,7 +217,7 @@
 		   "Item is not a gw:wcp.", value);
 
   //customer = gw_wcp_get_ptr (value);
-  customer = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p_GncCustomer"), 1, 0);
+  customer = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncCustomer"), 1, 0);
   gncOwnerInitCustomer (&owner, customer);
 
   widget = gnc_option_get_widget (option);
@@ -234,7 +234,7 @@
   gnc_owner_get_owner (widget, &owner);
 
   return SWIG_NewPointerObj(owner.owner.undefined, 
-                            SWIG_TypeQuery("_p_GncCustomer"), 0);
+                            SWIG_TypeQuery("_p__gncCustomer"), 0);
   //return gw_wcp_assimilate_ptr (owner.owner.undefined,
   //				scm_c_eval_string("<gnc:GncCustomer*>"));
 }
@@ -280,7 +280,7 @@
 		   "Item is not a gw:wcp.", value);
 
   //vendor = gw_wcp_get_ptr (value);
-  vendor = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p_GncVendor"), 1, 0);
+  vendor = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncVendor"), 1, 0);
   gncOwnerInitVendor (&owner, vendor);
 
   widget = gnc_option_get_widget (option);
@@ -297,7 +297,7 @@
   gnc_owner_get_owner (widget, &owner);
 
   return SWIG_NewPointerObj(owner.owner.undefined, 
-                            SWIG_TypeQuery("_p_GncVendor"), 0);
+                            SWIG_TypeQuery("_p__gncVendor"), 0);
   //return gw_wcp_assimilate_ptr (owner.owner.undefined,
   //			scm_c_eval_string("<gnc:GncVendor*>"));
 }
@@ -342,7 +342,7 @@
 		   "Item is not a gw:wcp.", value);
 
   //employee = gw_wcp_get_ptr (value);
-  employee = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p_GncEmployee"), 1, 0);
+  employee = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncEmployee"), 1, 0);
   gncOwnerInitEmployee (&owner, employee);
 
   widget = gnc_option_get_widget (option);
@@ -359,7 +359,7 @@
   gnc_owner_get_owner (widget, &owner);
 
   return SWIG_NewPointerObj(owner.owner.undefined, 
-                            SWIG_TypeQuery("_p_GncEmployee"), 0);
+                            SWIG_TypeQuery("_p__gncEmployee"), 0);
   //return gw_wcp_assimilate_ptr (owner.owner.undefined,
   //			scm_c_eval_string("<gnc:GncEmployee*>"));
 }
@@ -419,7 +419,7 @@
 		   "Item is not a gw:wcp.", value);
 
   //invoice = gw_wcp_get_ptr (value);
-  invoice = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p_GncInvoice"), 1, 0);
+  invoice = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncInvoice"), 1, 0);
 
   widget = gnc_option_get_widget (option);
   gnc_general_search_set_selected (GNC_GENERAL_SEARCH (widget), invoice);
@@ -435,7 +435,7 @@
   GncInvoice *invoice;
 
   invoice = gnc_general_search_get_selected (GNC_GENERAL_SEARCH (widget));
-  return SWIG_NewPointerObj(invoice, SWIG_TypeQuery("_p_GncInvoice"), 0);
+  return SWIG_NewPointerObj(invoice, SWIG_TypeQuery("_p__gncInvoice"), 0);
   //return gw_wcp_assimilate_ptr (invoice, scm_c_eval_string("<gnc:GncInvoice*>"));
 }
 
@@ -498,7 +498,7 @@
 		   "Item is not a gw:wcp.", value);
 
   //taxtable = gw_wcp_get_ptr (value);
-  taxtable= SWIG_MustGetPtr(value, SWIG_TypeQuery("_p_GncTaxTable"), 1, 0);
+  taxtable= SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncTaxTable"), 1, 0);
 
   widget = gnc_option_get_widget (option);
   gnc_ui_optionmenu_set_value (widget, taxtable);
@@ -512,7 +512,7 @@
   GncTaxTable *taxtable;
 
   taxtable = gnc_ui_optionmenu_get_value (widget);
-  return SWIG_NewPointerObj(taxtable, SWIG_TypeQuery("_p_GncTaxTable"), 0);
+  return SWIG_NewPointerObj(taxtable, SWIG_TypeQuery("_p__gncTaxTable"), 0);
   //return gw_wcp_assimilate_ptr (taxtable, scm_c_eval_string("<gnc:GncTaxTable*>"));
 }
 

Modified: gnucash/branches/swigify/src/business/business-gnome/dialog-invoice.c
===================================================================
--- gnucash/branches/swigify/src/business/business-gnome/dialog-invoice.c	2006-08-13 18:57:03 UTC (rev 14662)
+++ gnucash/branches/swigify/src/business/business-gnome/dialog-invoice.c	2006-08-13 19:08:11 UTC (rev 14663)
@@ -571,7 +571,7 @@
   func = scm_c_eval_string ("gnc:invoice-report-create");
   g_return_if_fail (SCM_PROCEDUREP (func));
 
-  arg = SWIG_NewPointerObj(invoice, SWIG_TypeQuery("_p_GncInvoice"), 0);
+  arg = SWIG_NewPointerObj(invoice, SWIG_TypeQuery("_p__gncInvoice"), 0);
   //arg = gw_wcp_assimilate_ptr (invoice, scm_c_eval_string("<gnc:GncInvoice*>"));
   args = scm_cons (arg, args);
 
@@ -763,7 +763,7 @@
   //qtype = scm_c_eval_string("<gnc:GncOwner*>");
   //g_return_if_fail (qtype != SCM_UNDEFINED);
 
-  arg = SWIG_NewPointerObj(owner, SWIG_TypeQuery("_p_GncOwner"), 0);
+  arg = SWIG_NewPointerObj(owner, SWIG_TypeQuery("_p__gncOwner"), 0);
   //arg = gw_wcp_assimilate_ptr (owner, qtype);
   g_return_if_fail (arg != SCM_UNDEFINED);
   args = scm_cons (arg, args);

Modified: gnucash/branches/swigify/src/business/business-utils/business-options.c
===================================================================
--- gnucash/branches/swigify/src/business/business-utils/business-options.c	2006-08-13 18:57:03 UTC (rev 14662)
+++ gnucash/branches/swigify/src/business/business-utils/business-options.c	2006-08-13 19:08:11 UTC (rev 14663)
@@ -61,7 +61,7 @@
 				     GncTaxTable * default_value)
 {
   LOOKUP_OPTION("gnc_option_db_lookup_taxtable_option");
-  return SWIG_MustGetPtr(value, SWIG_TypeQuery("_p_GncTaxTable"), 1, 0);
+  return SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncTaxTable"), 1, 0);
 }
 
 GncInvoice*
@@ -71,7 +71,7 @@
 				    GncInvoice * default_value)
 {
   LOOKUP_OPTION("gnc_option_db_lookup_invoice_option");
-  return SWIG_MustGetPtr(value, SWIG_TypeQuery("_p_GncInvoice"), 1, 0);
+  return SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncInvoice"), 1, 0);
 }
 
 GncCustomer*
@@ -81,7 +81,7 @@
 				     GncCustomer * default_value)
 {
   LOOKUP_OPTION("gnc_option_db_lookup_customer_option");
-  return SWIG_MustGetPtr(value, SWIG_TypeQuery("_p_GncCustomer"), 1, 0);
+  return SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncCustomer"), 1, 0);
 }
 
 GncVendor*
@@ -91,5 +91,5 @@
 				   GncVendor * default_value)
 {
   LOOKUP_OPTION("gnc_option_db_lookup_vendor_option");
-  return SWIG_MustGetPtr(value, SWIG_TypeQuery("_p_GncVendor"), 1, 0);
+  return SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncVendor"), 1, 0);
 }



More information about the gnucash-changes mailing list