Dag Sverre Seljebotn | 9 Mar 17:38 2010
Picon
Picon

Re: expected identifier before numeric constant

Lisandro Dalcin wrote:
> On 9 March 2010 13:23, Dag Sverre Seljebotn <dagss <at> student.matnat.uio.no> wrote:
>   
>> Lisandro Dalcin wrote:
>>     
>>> On 9 March 2010 11:21, Wkerzendorf <wkerzendorf <at> googlemail.com> wrote:
>>>
>>>       
>>>> The line that seems to upset the code fitscat.h:70:
>>>>
>>>> typedef enum            {T_BYTE, T_SHORT, T_LONG, T_FLOAT, T_DOUBLE,
>>>> T_STRING}
>>>>                               t_type;         /* Type of data */
>>>>
>>>>
>>>>         
>>> Do this enumeration comes from your own code? In such case, these
>>> names conflict with Python's structmember.h stuff ... You know,
>>> namespaces are one honking great idea, but not for Python's C-API ;-)
>>> Unfortunately, you will have to change the names of the enumeration
>>> items to avoid the conflict.
>>>
>>>       
>> Or perhaps, if this is a library, create a wrapper firstcat_cython.h like
>> this:
>>
>> #undef T_BYTE
>> #define T_BYTE CYTHON_T_BYTE
>> /* repeat for other types */
>> #include "fitscat.h"
(Continue reading)

Lisandro Dalcin | 9 Mar 17:46 2010
Picon

Re: expected identifier before numeric constant

On 9 March 2010 13:38, Dag Sverre Seljebotn <dagss <at> student.matnat.uio.no> wrote:
> Lisandro Dalcin wrote:
>>
>> On 9 March 2010 13:23, Dag Sverre Seljebotn <dagss <at> student.matnat.uio.no>
>> wrote:
>>
>>>
>>> Lisandro Dalcin wrote:
>>>
>>>>
>>>> On 9 March 2010 11:21, Wkerzendorf <wkerzendorf <at> googlemail.com> wrote:
>>>>
>>>>
>>>>>
>>>>> The line that seems to upset the code fitscat.h:70:
>>>>>
>>>>> typedef enum            {T_BYTE, T_SHORT, T_LONG, T_FLOAT, T_DOUBLE,
>>>>> T_STRING}
>>>>>                              t_type;         /* Type of data */
>>>>>
>>>>>
>>>>>
>>>>
>>>> Do this enumeration comes from your own code? In such case, these
>>>> names conflict with Python's structmember.h stuff ... You know,
>>>> namespaces are one honking great idea, but not for Python's C-API ;-)
>>>> Unfortunately, you will have to change the names of the enumeration
>>>> items to avoid the conflict.
>>>>
>>>>
(Continue reading)

Dag Sverre Seljebotn | 9 Mar 17:57 2010
Picon
Picon

Re: expected identifier before numeric constant

Lisandro Dalcin wrote:
> On 9 March 2010 13:38, Dag Sverre Seljebotn <dagss <at> student.matnat.uio.no> wrote:
>   
>> Lisandro Dalcin wrote:
>>     
>>> On 9 March 2010 13:23, Dag Sverre Seljebotn <dagss <at> student.matnat.uio.no>
>>> wrote:
>>>
>>>       
>>>> Lisandro Dalcin wrote:
>>>>
>>>>         
>>>>> On 9 March 2010 11:21, Wkerzendorf <wkerzendorf <at> googlemail.com> wrote:
>>>>>
>>>>>
>>>>>           
>>>>>> The line that seems to upset the code fitscat.h:70:
>>>>>>
>>>>>> typedef enum            {T_BYTE, T_SHORT, T_LONG, T_FLOAT, T_DOUBLE,
>>>>>> T_STRING}
>>>>>>                              t_type;         /* Type of data */
>>>>>>
>>>>>>
>>>>>>
>>>>>>             
>>>>> Do this enumeration comes from your own code? In such case, these
>>>>> names conflict with Python's structmember.h stuff ... You know,
>>>>> namespaces are one honking great idea, but not for Python's C-API ;-)
>>>>> Unfortunately, you will have to change the names of the enumeration
>>>>> items to avoid the conflict.
(Continue reading)

Dag Sverre Seljebotn | 9 Mar 18:01 2010
Picon
Picon

Re: expected identifier before numeric constant

Dag Sverre Seljebotn wrote:
> Lisandro Dalcin wrote:
>> On 9 March 2010 13:38, Dag Sverre Seljebotn 
>> <dagss <at> student.matnat.uio.no> wrote:
>>  
>>> Lisandro Dalcin wrote:
>>>    
>>>> On 9 March 2010 13:23, Dag Sverre Seljebotn 
>>>> <dagss <at> student.matnat.uio.no>
>>>> wrote:
>>>>
>>>>      
>>>>> Lisandro Dalcin wrote:
>>>>>
>>>>>        
>>>>>> On 9 March 2010 11:21, Wkerzendorf <wkerzendorf <at> googlemail.com> 
>>>>>> wrote:
>>>>>>
>>>>>>
>>>>>>          
>>>>>>> The line that seems to upset the code fitscat.h:70:
>>>>>>>
>>>>>>> typedef enum            {T_BYTE, T_SHORT, T_LONG, T_FLOAT, 
>>>>>>> T_DOUBLE,
>>>>>>> T_STRING}
>>>>>>>                              t_type;         /* Type of data */
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>             
(Continue reading)

Robert Bradshaw | 9 Mar 18:43 2010

Re: expected identifier before numeric constant

On Mar 9, 2010, at 9:01 AM, Dag Sverre Seljebotn wrote:

> Dag Sverre Seljebotn wrote:
>> Lisandro Dalcin wrote:
>>> On 9 March 2010 13:38, Dag Sverre Seljebotn <dagss <at> student.matnat.uio.no 
>>> > wrote:
>>>
>>>> Lisandro Dalcin wrote:
>>>>
>>>>> On 9 March 2010 13:23, Dag Sverre Seljebotn <dagss <at> student.matnat.uio.no 
>>>>> >
>>>>> wrote:
>>>>>
>>>>>
>>>>>> Lisandro Dalcin wrote:
>>>>>>
>>>>>>
>>>>>>> On 9 March 2010 11:21, Wkerzendorf  
>>>>>>> <wkerzendorf <at> googlemail.com> wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> The line that seems to upset the code fitscat.h:70:
>>>>>>>>
>>>>>>>> typedef enum            {T_BYTE, T_SHORT, T_LONG, T_FLOAT,  
>>>>>>>> T_DOUBLE,
>>>>>>>> T_STRING}
>>>>>>>>                             t_type;         /* Type of data */
>>>>>>>>
>>>>>>>>
(Continue reading)

Wkerzendorf | 10 Mar 12:26 2010

Re: expected identifier before numeric constant

Dear all,

So what do I need to do? I'm wrapping a c code which I don't really
want to change as it is not mine. And I thought when doing typedef
enum. I'm basically creating a "drop down menu", where a variable can
have any of the above values T_BYTE, T_SHORT, T_LONG, T_FLOAT,
T_DOUBLE, T_STRING which are defined through the enum type. There
doesnt seem to be a consensus by you guys what to do?
Anyway thanks for the help
    Wolfgang

On Mar 10, 4:43 am, Robert Bradshaw <rober... <at> math.washington.edu>
wrote:
> On Mar 9, 2010, at 9:01 AM, Dag Sverre Seljebotn wrote:
>
>
>
>
>
> > Dag Sverre Seljebotn wrote:
> >> Lisandro Dalcin wrote:
> >>> On 9 March 2010 13:38, Dag Sverre Seljebotn <da... <at> student.matnat.uio.no
> >>> > wrote:
>
> >>>> Lisandro Dalcin wrote:
>
> >>>>> On 9 March 2010 13:23, Dag Sverre Seljebotn <da... <at> student.matnat.uio.no
>
> >>>>> wrote:
>
(Continue reading)

Stefan Behnel | 10 Mar 12:35 2010
Picon

Re: Re: expected identifier before numeric constant

Wkerzendorf, 10.03.2010 12:26:
> So what do I need to do? I'm wrapping a c code which I don't really
> want to change as it is not mine. And I thought when doing typedef
> enum. I'm basically creating a "drop down menu", where a variable can
> have any of the above values T_BYTE, T_SHORT, T_LONG, T_FLOAT,
> T_DOUBLE, T_STRING which are defined through the enum type. There
> doesnt seem to be a consensus by you guys what to do?

The discussion has moved on to the cython-dev mailing list (where it 
belongs) and (soon) the bug tracker. A proposed fix has been implemented 
and will be considered for Cython 0.13.

The problem for now is that there is a naming collision between the CPython 
structmember.h header file (which Cython includes automatically), and the 
header file that you use in your source. Dag provided a work-around for 
this, which is not beautiful, but which should solve this issue for the 
time being.

Stefan

Lisandro Dalcin | 10 Mar 15:52 2010
Picon

Re: Re: expected identifier before numeric constant

On 10 March 2010 08:35, Stefan Behnel <stefan_ml <at> behnel.de> wrote:
> Wkerzendorf, 10.03.2010 12:26:
>>
> The discussion has moved on to the cython-dev mailing list (where it
> belongs) and (soon) the bug tracker. A proposed fix has been implemented and
> will be considered for Cython 0.13.
>

http://trac.cython.org/cython_trac/ticket/517

--

-- 
Lisandro Dalcin
---------------
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

Lisandro Dalcin | 11 Mar 21:24 2010
Picon

Re: Re: expected identifier before numeric constant

On 10 March 2010 11:52, Lisandro Dalcin <dalcinl <at> gmail.com> wrote:
> On 10 March 2010 08:35, Stefan Behnel <stefan_ml <at> behnel.de> wrote:
>> Wkerzendorf, 10.03.2010 12:26:
>>>
>> The discussion has moved on to the cython-dev mailing list (where it
>> belongs) and (soon) the bug tracker. A proposed fix has been implemented and
>> will be considered for Cython 0.13.
>>
>
> http://trac.cython.org/cython_trac/ticket/517
>

http://hg.cython.org/cython-devel/rev/1a2e04bc1395

--

-- 
Lisandro Dalcin
---------------
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

Wkerzendorf | 18 Mar 15:12 2010

Re: expected identifier before numeric constant

Dear all,

I am trying to wrap some c functions of a c program. I wrote a c file
that has a function that I want to wrap with python. this c function
in turn accesses the program I want to wrap and has all the necessary
includes. One of these includes is a file that has the above mentioned
CTYPES. But this is an include from the c file not from the cython
file. I dont know if that makes sense: I would like to keep the cython
completely separate from the rest of the c libraries and just want to
wrap my own c function that includes the c library.

I hope that is kind of understandable.

Thanks again for the help

     Wolfgang

On Mar 12, 7:24 am, Lisandro Dalcin <dalc... <at> gmail.com> wrote:
> On 10 March 2010 11:52, Lisandro Dalcin <dalc... <at> gmail.com> wrote:
>
> > On 10 March 2010 08:35, Stefan Behnel <stefan... <at> behnel.de> wrote:
> >>Wkerzendorf, 10.03.2010 12:26:
>
> >> The discussion has moved on to the cython-dev mailing list (where it
> >> belongs) and (soon) the bug tracker. A proposed fix has been implemented and
> >> will be considered for Cython 0.13.
>
> >http://trac.cython.org/cython_trac/ticket/517
>
> http://hg.cython.org/cython-devel/rev/1a2e04bc1395
(Continue reading)

Lisandro Dalcin | 18 Mar 17:58 2010
Picon

Re: Re: expected identifier before numeric constant

On 18 March 2010 11:12, Wkerzendorf <wkerzendorf <at> googlemail.com> wrote:
>
> I hope that is kind of understandable.
>

Sorry, this is still related to the issue you posted (i.e. the
name-clashing of T_BYTE, T_SHORT, T_LONG, etc. from your
"src/fits/fitscat.h" include file??)

--

-- 
Lisandro Dalcin
---------------
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

Wkerzendorf | 19 Mar 00:31 2010

Re: expected identifier before numeric constant

Yes that is still related; I only want my c code to do the includes
(which contains the T_BYTE,T_SHORT) and I dont want cython to see any
of that.

Cheers
   Wolfgang

On Mar 19, 3:58 am, Lisandro Dalcin <dalc... <at> gmail.com> wrote:
> On 18 March 2010 11:12, Wkerzendorf <wkerzend... <at> googlemail.com> wrote:
>
>
>
> > I hope that is kind of understandable.
>
> Sorry, this is still related to the issue you posted (i.e. the
> name-clashing of T_BYTE, T_SHORT, T_LONG, etc. from your
> "src/fits/fitscat.h" include file??)
>
> --
> Lisandro Dalcin
> ---------------
> 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

To unsubscribe from this group, send email to cython-users+unsubscribegooglegroups.com or reply to
this email with the words "REMOVE ME" as the subject.

(Continue reading)

Dag Sverre Seljebotn | 19 Mar 07:56 2010
Picon
Picon

Re: Re: expected identifier before numeric constant

Please don't top-post, we keep loosing track of the discussion...

Wkerzendorf wrote:
> Yes that is still related; I only want my c code to do the includes
> (which contains the T_BYTE,T_SHORT) and I dont want cython to see any
> of that.

If I understand correctly, you should make a new header file (.h file) 
for your C code which do NOT include "fitscat.h", which Cython then uses.

Only your C file needs to use fitscat.h.

That way, the Cython-generated C source never sees fitscat.h.

Dag Sverre

To unsubscribe from this group, send email to cython-users+unsubscribegooglegroups.com or reply to
this email with the words "REMOVE ME" as the subject.


Gmane