r14654 - gnucash/branches/swigify/src/business/business-gnome - Further conversion of the business-gnome module to SWIG.

Chris Shoemaker chris at cvs.gnucash.org
Sat Aug 12 22:30:57 EDT 2006


Author: chris
Date: 2006-08-12 22:30:56 -0400 (Sat, 12 Aug 2006)
New Revision: 14654
Trac: http://svn.gnucash.org/trac/changeset/14654

Modified:
   gnucash/branches/swigify/src/business/business-gnome/business-options-gnome.c
   gnucash/branches/swigify/src/business/business-gnome/dialog-invoice.c
Log:
   Further conversion of the business-gnome module to SWIG.
   Now use the SWIG runtime to wrap and unwrap types for passing to guile.


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 02:28:21 UTC (rev 14653)
+++ gnucash/branches/swigify/src/business/business-gnome/business-options-gnome.c	2006-08-13 02:30:56 UTC (rev 14654)
@@ -26,7 +26,8 @@
 
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
-#include <g-wrap-wct.h>
+//#include <g-wrap-wct.h>
+#include "swig-runtime.h"
 #include <libguile.h>
 
 #include "gnc-ui-util.h"
@@ -39,6 +40,8 @@
 #include "business-gnome-utils.h"
 #include "dialog-invoice.h"
 
+#define FUNC_NAME __FUNCTION__
+
 static GtkWidget *
 create_owner_widget (GNCOption *option, GncOwnerType type, GtkWidget *hbox)
 {
@@ -94,12 +97,15 @@
 get_owner_type_from_option (GNCOption *option)
 {
   SCM odata = gnc_option_get_option_data (option);
-  SCM conv_func;
-
+  //SCM conv_func;
+  /* CHECKME */
+  return (GncOwnerType) scm_num2int(odata, SCM_ARG1, __FUNCTION__);
+  /*
   conv_func = scm_c_eval_string ("gw:enum-<gnc:GncOwnerType>-val->int");
   odata = scm_call_1 (conv_func, odata);
 
   return scm_num2long (odata, SCM_ARG1, __FUNCTION__);
+  */
 }
 
 
@@ -135,11 +141,12 @@
   GncOwner owner_def;
   GncOwner *owner;
 
-  if (!gw_wcp_p (value))
+  if (!SWIG_IsPointer (value))
     scm_misc_error("business_options:owner_set_value",
 		   "Item is not a gw:wcp.", value);
 
-  owner = gw_wcp_get_ptr (value);
+  //owner = gw_wcp_get_ptr (value);
+  owner = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p_GncOwner"), 1, 0);
 
   /* XXX: should we verify that the owner type is correct? */
   if (!owner) {
@@ -164,7 +171,8 @@
   owner.type = type;
   gnc_owner_get_owner (widget, &owner);
 
-  return gw_wcp_assimilate_ptr (&owner, scm_c_eval_string("<gnc:GncOwner*>"));
+  return SWIG_NewPointerObj(&owner, SWIG_TypeQuery("_p_GncOwner"), 0);
+  //return gw_wcp_assimilate_ptr (&owner, scm_c_eval_string("<gnc:GncOwner*>"));
 }
 
 
@@ -203,11 +211,12 @@
   GncOwner owner;
   GncCustomer *customer;
 
-  if (!gw_wcp_p (value))
+  if (!SWIG_IsPointer (value))
     scm_misc_error("business_options:customer_set_value",
 		   "Item is not a gw:wcp.", value);
 
-  customer = gw_wcp_get_ptr (value);
+  //customer = gw_wcp_get_ptr (value);
+  customer = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p_GncCustomer"), 1, 0);
   gncOwnerInitCustomer (&owner, customer);
 
   widget = gnc_option_get_widget (option);
@@ -223,8 +232,10 @@
 
   gnc_owner_get_owner (widget, &owner);
 
-  return gw_wcp_assimilate_ptr (owner.owner.undefined,
-				scm_c_eval_string("<gnc:GncCustomer*>"));
+  return SWIG_NewPointerObj(owner.owner.undefined, 
+                            SWIG_TypeQuery("_p_GncCustomer"), 0);
+  //return gw_wcp_assimilate_ptr (owner.owner.undefined,
+  //				scm_c_eval_string("<gnc:GncCustomer*>"));
 }
 
 
@@ -263,11 +274,12 @@
   GncOwner owner;
   GncVendor *vendor;
 
-  if (!gw_wcp_p (value))
+  if (!SWIG_IsPointer (value))
     scm_misc_error("business_options:vendor_set_value",
 		   "Item is not a gw:wcp.", value);
 
-  vendor = gw_wcp_get_ptr (value);
+  //vendor = gw_wcp_get_ptr (value);
+  vendor = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p_GncVendor"), 1, 0);
   gncOwnerInitVendor (&owner, vendor);
 
   widget = gnc_option_get_widget (option);
@@ -283,8 +295,10 @@
 
   gnc_owner_get_owner (widget, &owner);
 
-  return gw_wcp_assimilate_ptr (owner.owner.undefined,
-				scm_c_eval_string("<gnc:GncVendor*>"));
+  return SWIG_NewPointerObj(owner.owner.undefined, 
+                            SWIG_TypeQuery("_p_GncVendor"), 0);
+  //return gw_wcp_assimilate_ptr (owner.owner.undefined,
+  //			scm_c_eval_string("<gnc:GncVendor*>"));
 }
 
 /********************************************************************/
@@ -322,11 +336,12 @@
   GncOwner owner;
   GncEmployee *employee;
 
-  if (!gw_wcp_p (value))
+  if (!SWIG_IsPointer (value))
     scm_misc_error("business_options:employee_set_value",
 		   "Item is not a gw:wcp.", value);
 
-  employee = gw_wcp_get_ptr (value);
+  //employee = gw_wcp_get_ptr (value);
+  employee = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p_GncEmployee"), 1, 0);
   gncOwnerInitEmployee (&owner, employee);
 
   widget = gnc_option_get_widget (option);
@@ -342,8 +357,10 @@
 
   gnc_owner_get_owner (widget, &owner);
 
-  return gw_wcp_assimilate_ptr (owner.owner.undefined,
-				scm_c_eval_string("<gnc:GncEmployee*>"));
+  return SWIG_NewPointerObj(owner.owner.undefined, 
+                            SWIG_TypeQuery("_p_GncEmployee"), 0);
+  //return gw_wcp_assimilate_ptr (owner.owner.undefined,
+  //			scm_c_eval_string("<gnc:GncEmployee*>"));
 }
 
 /********************************************************************/
@@ -396,11 +413,12 @@
 {
   GncInvoice *invoice;
 
-  if (!gw_wcp_p (value))
+  if (!SWIG_IsPointer (value))
     scm_misc_error("business_options:invoice_set_value",
 		   "Item is not a gw:wcp.", value);
 
-  invoice = gw_wcp_get_ptr (value);
+  //invoice = gw_wcp_get_ptr (value);
+  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);
@@ -474,11 +492,12 @@
 {
   GncTaxTable *taxtable;
 
-  if (!gw_wcp_p (value))
+  if (!SWIG_IsPointer (value))
     scm_misc_error("business_options:taxtable_set_value",
 		   "Item is not a gw:wcp.", value);
 
-  taxtable = gw_wcp_get_ptr (value);
+  //taxtable = gw_wcp_get_ptr (value);
+  taxtable= SWIG_MustGetPtr(value, SWIG_TypeQuery("_p_GncTaxTable"), 1, 0);
 
   widget = gnc_option_get_widget (option);
   gnc_ui_optionmenu_set_value (widget, taxtable);
@@ -492,7 +511,8 @@
   GncTaxTable *taxtable;
 
   taxtable = gnc_ui_optionmenu_get_value (widget);
-  return gw_wcp_assimilate_ptr (taxtable, scm_c_eval_string("<gnc:GncTaxTable*>"));
+  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 02:28:21 UTC (rev 14653)
+++ gnucash/branches/swigify/src/business/business-gnome/dialog-invoice.c	2006-08-13 02:30:56 UTC (rev 14654)
@@ -760,10 +760,11 @@
     args = scm_cons (SCM_BOOL_F, args);
   }
 
-  qtype = scm_c_eval_string("<gnc:GncOwner*>");
-  g_return_if_fail (qtype != SCM_UNDEFINED);
+  //qtype = scm_c_eval_string("<gnc:GncOwner*>");
+  //g_return_if_fail (qtype != SCM_UNDEFINED);
 
-  arg = gw_wcp_assimilate_ptr (owner, qtype);
+  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);
 



More information about the gnucash-changes mailing list