r16554 - gnucash/trunk/src - #483796, Fancy Invoice: Convert the elements of an AccountValueList when wrapping.

Andreas Köhler andi5 at cvs.gnucash.org
Sat Oct 6 19:05:17 EDT 2007


Author: andi5
Date: 2007-10-06 19:05:16 -0400 (Sat, 06 Oct 2007)
New Revision: 16554
Trac: http://svn.gnucash.org/trac/changeset/16554

Modified:
   gnucash/trunk/src/base-typemaps.i
   gnucash/trunk/src/business/business-core/business-core.i
Log:
#483796, Fancy Invoice: Convert the elements of an AccountValueList when wrapping.

GLIST_HELPER_INOUT does not touch the single elements and
GncAccountValue typemaps do not work here.


Modified: gnucash/trunk/src/base-typemaps.i
===================================================================
--- gnucash/trunk/src/base-typemaps.i	2007-10-06 08:58:09 UTC (rev 16553)
+++ gnucash/trunk/src/base-typemaps.i	2007-10-06 23:05:16 UTC (rev 16554)
@@ -41,7 +41,7 @@
   GList *c_list = NULL;
 
   while (!SCM_NULLP(list)) {
-        Account *p;
+        void *p;
 
         SCM p_scm = SCM_CAR(list);
         if (SCM_FALSEP(p_scm) || SCM_NULLP(p_scm))

Modified: gnucash/trunk/src/business/business-core/business-core.i
===================================================================
--- gnucash/trunk/src/business/business-core/business-core.i	2007-10-06 08:58:09 UTC (rev 16553)
+++ gnucash/trunk/src/business/business-core/business-core.i	2007-10-06 23:05:16 UTC (rev 16554)
@@ -64,12 +64,40 @@
 %}
 
 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);"
+%typemap(in) AccountValueList * {
+  SCM list = $input;
+  GList *c_list = NULL;
 
+  while (!SCM_NULLP(list)) {
+        GncAccountValue *p;
 
+        SCM p_scm = SCM_CAR(list);
+        if (SCM_FALSEP(p_scm) || SCM_NULLP(p_scm))
+           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);
+}
+
+
+
 /* Parse the header files to generate wrappers */
 %include <gncAddress.h>
 %include <gncBillTerm.h>



More information about the gnucash-changes mailing list