Pyrex Hard Case

Rodrigo Benenson rodrigob at elo.utfsm.cl
Mon Apr 28 07:12:33 CEST 2003


Hi!

I'm a very happy python user.
I had develloped script, web pages and some research software using
python.
When I needed to connect Python to more efficient C code I use only
the best: Pyrex, it's easy, it's pythonic and it's works.

BUT I'm in front of a hard case. I'm finishing the so long imagined
Scilab <-> Python interface (if you do not know what is Scilab, look
at the end of mail).

Some day's ago talking with another Scilab fan I had found the door to
this conection.

After three days of works I had got my first matrix addition !

All the job is done using pyrex and disutils except one step. I'm
mailling this list to ask to you how do you think I could solve this
problem.

Basically there is a Macro function that I can't map to Pyrex, so I
create an equivalent dummy function and hand edit the .c file erasing
the definition. This is sufficient because Pyrex use the dummy
function every time and the next the macro do the correct C
translation.

The problem became rough because the macro itself maps a Fortran call.
And the Fortran code correspond to an virtual structure ised to match
a memory stack.

So, I admit, is a hard case.

I don't want to bore every one with the technical details, if some one
ask for them I can describe the code in more detail.

Basically I thinks that there are many case where some strange macro
call will make hard to map the code into Pyrex.
There should be way to define some "macro functions" or something that
like,

that allow you to define a prototype without including it into the
definitions of the C code,

it should be only used to check the consistency of the code and to
create automatic type translations.


I hope that the Pyrex users/devellopers read this news group (as the
web page said).

I think that this is a True Feature and they are many possible case
where things like this are usefull (specially when Fortran enter in
the scene).

The "tell me the C name" feature has saved the other half of the
difficulties, using things like 'cdef int hello "C2F(hello)" (char
*)'.

I suppose that the Scilab <-> Python interface is beauty example of
software integration.
Using the Blas/Atlas and Lapack Fortran code for low level number
crunching, using Fortran and C to devellop the core of Scilab, using
Tk and Gtk to provide X graphics outputs and using Python to connect
the power of number crushing to the heterogeneous data ambients.


Many thanks for your support.
RodrigoB.

Scilab: it is the best open source matrix computation software
aviable.




More information about the Python-list mailing list