I have used g-wrap to wrap a function which returns an enumerate type. I
wanted to test the return value like so:
(let ((status (cairo-status cr)))
(if (not (eqv? status 'success))
(print-cairo-error status)
(display "OK\n")))
This does not work correctly, because cairo-status is returning the
integer value (i.e. 0), rather than the symbol (i.e. 'success).
Is this a bug?
>From looking at the C code generated by g-wrap, I discovered that there
is a generated function which will convert from the integer
value to the enumeration symbol, which allows a simple workaround:
(let ((status (enum-cairo-status-val->sym (cairo-status cr) #f)))
(if (not (eqv? status 'success))
(print-cairo-error status)
(display "OK\n")))
So that's doable, but it means I need to add an extra layer of wrapping to
cairo-status to get the effect I want.
By the way, what is the second argument to enum-*-val->sym for? I first
assumed that it was for decoding bitset enums, but after some basic
experimentation, this doesn't seem to be the case.
cheers,
John
_______________________________________________
g-wrap-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/g-wrap-dev