|
typemaps for python lists (double,int) as function arguments: msg#00180programming.swig
Hi, I need some C-extensions for Python that do some calculations with a large amout of data. The data shall be sent to the c-functions as list arguments (of variable length) after spending some time with the docs i know how to work with a function like: int calc( double [5]){ ....} the helper function and the app. typemap is taken form the doc.: static int convert_darray(PyObject *input, double *ptr, int size) { if (!PySequence_Check(input)) { .....}} %typemap(in) double [ANY](double temp[$1_dim0]) { if (!convert_darray($input,temp,$1_dim0))) { return NULL; } $1 = &temp[0]; } Now what do I have to do, if I want to pass an array of variable lenght to a function? int calc( double *){ ....} As I can't use the $1_dim0, maybe I have to get the size of the list using PyList_Size ? However, I can't believe that there are no perfect typemaps available for dealing with python lists as in and out arguments of functions. But I can't find them. Please help. Thanks, marcus _______________________________________________ Swig maillist - Swig@xxxxxxxxxxxxxxx http://mailman.cs.uchicago.edu/mailman/listinfo/swig |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | naive question about passing in a NULL via Python: 00180, Scott Koranda |
|---|---|
| Next by Date: | [Newbie]:swig wrappers for bootstrapped classes: 00180, Sharma K M |
| Previous by Thread: | naive question about passing in a NULL via Pythoni: 00180, Scott Koranda |
| Next by Thread: | Re: typemaps for python lists (double,int) as function arguments: 00180, Luigi Ballabio |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |