Potential g-wrap bug?
Derek Atkins
warlord@MIT.EDU
04 Jun 2002 10:30:55 -0400
Rob,
Either I've found a bug in g-wrap when handling list-types, or I'm
using it wrong. Basically, I've got a function that takes a Query*
and then three GLists (any of which may be NULL).
This is the g-wrap code (I'm using guile 1.4 and g-wrap 1.3.2):
(gw:wrap-as-wct ws '<gnc:id-type> "GNCIdType" "GNCIdTypeConst")
(gw:wrap-value ws 'gnc:query-default-sort '<gnc:id-type> "QUERY_DEFAULT_SORT")
...
(gw:wrap-function
ws
'gnc:query-set-sort-order
'<gw:void>
"xaccQuerySetSortOrder"
'((<gnc:Query*> q)
((gw:glist-of <gnc:id-type> callee-owned) primary)
((gw:glist-of <gnc:id-type> callee-owned) secondary)
((gw:glist-of <gnc:id-type> callee-owned) tertiary))
"set sort order.")
If I call this with:
(gnc:query-set-sort-order query '(gnc:query-default-sort) #f #f)
I get an error:
/opt/gnucash-cvs/share/guile-modules/gnucash/report/transaction.scm:1099:11: In procedure gnc:query-set-sort-order in expression (gnc:query-set-sort-order query (quote #) ...):
/opt/gnucash-cvs/share/guile-modules/gnucash/report/transaction.scm:1099:11: Wrong type argument in position 3: gnc:query-default-sort
I don't understand why I'm getting this error, unless I've wrapped
QUERY_DEFAULT_SORT incorrectly. Looking at the code I thought the
function was (gw:wrap-value ws name type c-type), but maybe I have
stuff wrong?
Worse, there is a problem in the generated wrapper function. If I
call this function as follows:
(gnc:query-set-sort-order query #f #f #f)
I get a SEGV in the g-wrap wrapper helper function:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 18182)]
gw__tmp404_xaccQuerySetSortOrder_wrapper (gw__scm_arg0=1088900432,
gw__scm_arg1=8564, gw__scm_arg2=8564, gw__scm_arg3=8564)
at gw-engine.c:14254
14254 SCM gw__tmp565_scm_item = SCM_CAR(gw__tmp563_scm_rest);
(gdb) where
#0 gw__tmp404_xaccQuerySetSortOrder_wrapper (gw__scm_arg0=1088900432,
gw__scm_arg1=8564, gw__scm_arg2=8564, gw__scm_arg3=8564)
at gw-engine.c:14254
#1 0x40046537 in scm_gsubr_apply (args=1088887552) at gsubr.c:169
If you want to see the generated code, I can send that, too. So, is
this a bug in g-wrap or am have I configured this wrong or both?
Thanks,
-derek
--
Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
Member, MIT Student Information Processing Board (SIPB)
URL: http://web.mit.edu/warlord/ PP-ASEL-IA N1NWH
warlord@MIT.EDU PGP key available