logo       

Re: Next SWIG release: msg#00168

programming.swig

Subject: Re: Next SWIG release


Hi,
another way to reduce code size (which, I think, is also documented in the manual) is to replace:

%typemap(in) Foo {
// read $input (a PyObject*) and use the info in
// order to build $1 (a Foo). Typically, the code
// spans quite a few lines which are reinserted in
// the wrappers every time a Foo is passed.
}

with:

%{
void convertFoo(PyObject* input, Foo& f) {
// put the conversion code here so that
// it is only written once
}
%}

%typemap(in) Foo {
convertFoo($input,&$1); // just one repeated line now
}

I don't think it would be easy to have SWIG produce the above automatically (right, Dave?) but it can be done manually.

Bye,
Luigi

_______________________________________________
Swig maillist - Swig@xxxxxxxxxxxxxxx
http://mailman.cs.uchicago.edu/mailman/listinfo/swig



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise