Author: mvidner Date: Wed Jul 16 13:30:23 2008 New Revision: 49157 URL: http://svn.opensuse.org/viewcvs/yast?rev=49157&view=rev Log: A fix for bnc#398815, accessing struct s { deque<int> d; }; SWIG will use typemaps when told %naturalvar, but also it needs %typemap(out) const Foo & Modified: trunk/perl-bindings/pluglib-bindings/swig/generic/sequence.i Modified: trunk/perl-bindings/pluglib-bindings/swig/generic/sequence.i URL: http://svn.opensuse.org/viewcvs/yast/trunk/perl-bindings/pluglib-bindings/swig/generic/sequence.i?rev=49157&r1=49156&r2=49157&view=diff ============================================================================== --- trunk/perl-bindings/pluglib-bindings/swig/generic/sequence.i (original) +++ trunk/perl-bindings/pluglib-bindings/swig/generic/sequence.i Wed Jul 16 13:30:23 2008 @@ -102,6 +102,29 @@ delete[] svs; argvi++; } + +// FIXME apply this everywhere else in the library +// also check how much is still needed (send upstream?) +// where to put naturalvar? + +// grr, this differs only in s/\./->/ +%typemap(out) L< T >&, L< T >* +{ + /* convert from ref/ptr L< T > to perl SV (TODO only ref tested) */ + + unsigned int k = 0; + int len = $1->size(); + SV **svs = new SV*[len]; + for (L< T >::iterator i=$1->begin(); i!=$1->end(); i++) { + svs[k] = sv_newmortal(); + TO_SV(svs[k++], &(*i), sizeof(T), $descriptor(T)); + } + $result = newRV_noinc((SV*)av_make(len, svs)); + sv_2mortal($result); + delete[] svs; + argvi++; +} + %enddef -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org