On Tue, May 12, 2009 at 1:04 PM, Dag Sverre Seljebotn
<[email protected]> wrote:
> A)
>
> Ticket #303 manifests itself like this:
>
> cdef extern:
> ctypedef float footype # really double!
>
> cdef class A:
> cdef public footype myproperty
>
> My suggestion for a fix here is to replace all T_INT, T_UINT etc. with
> simply three types: __Pyx_T_SIGNED, __Pyx_T_UNSIGNED, __Pyx_T_FLOAT.
> These would use sizeof to determine the right type to flag the extension
> type property as (like Lisandro did with T_SIZET already does).
>
I'm -1 on this...
For (A), we need to enhance Cython to generate a couple of converter
functions to_py/from_py for externally defined integral or floating
types. For the integral ones, the only requisite is to specify sign
part. I've already have some preliminary work on this, but I'm not
sure how to go on because of the delegation-based implementation in
CTypedefNode.
For (B), I believe that if the type is an external typedef, a
transform should change the "cdef publid footype value" to this:
cdef class A:
property value:
def __get__(self): return self.value
def __set__(self, footype x) : self.value = x
In short, I already have implemented the utility code for (A), but I'm
in doubt about how to reimplement CTypedefNode. Additionally, I
believe my appoach for (B) could be easily implemented (likely Dag can
implement this part far better than me).
--
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev