pygccxml-development Mailing List for C++ Python language bindings (Page 22)
Brought to you by:
mbaas,
roman_yakovenko
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
(6) |
Mar
(160) |
Apr
(96) |
May
(152) |
Jun
(72) |
Jul
(99) |
Aug
(189) |
Sep
(161) |
Oct
(110) |
Nov
(9) |
Dec
(3) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(13) |
Feb
(48) |
Mar
(35) |
Apr
(7) |
May
(37) |
Jun
(8) |
Jul
(15) |
Aug
(8) |
Sep
(2) |
Oct
(1) |
Nov
(2) |
Dec
(38) |
| 2008 |
Jan
(11) |
Feb
(29) |
Mar
(17) |
Apr
(3) |
May
|
Jun
(64) |
Jul
(49) |
Aug
(51) |
Sep
(18) |
Oct
(22) |
Nov
(9) |
Dec
(9) |
| 2009 |
Jan
(28) |
Feb
(15) |
Mar
(2) |
Apr
(11) |
May
(6) |
Jun
(2) |
Jul
(3) |
Aug
(34) |
Sep
(5) |
Oct
(7) |
Nov
(13) |
Dec
(14) |
| 2010 |
Jan
(39) |
Feb
(3) |
Mar
(3) |
Apr
(14) |
May
(11) |
Jun
(8) |
Jul
(9) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
(7) |
Apr
|
May
|
Jun
(3) |
Jul
(3) |
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
| 2016 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2021 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(1) |
Nov
|
Dec
|
|
From: Allen B. <al...@vr...> - 2008-01-14 23:02:20
|
I am wrapping a method that looks something like this:
class MyClass
{
public:
void init(const unsigned value=0,
const ClassB valueb=ClassB(-10.0, 11.0),
const float other_val=2.0);
};
When py++ wraps this it creates code like this:
{ //::MyClass::init
typedef void ( ::MyClass::*init_function_type )( ::unsigned
const,::ClassB const,::float const ) ;
MyClass_exposer.def( "init"
, init_function_type( &::MyClass::init )
, ( bp::arg("value")=(unsigned char const)(0)
, bp::arg("valueb")=::ClassB( (&-1.0e+1), (&1.1e+1)
, bp::arg("other_val")=2.0e+0 ) );
}
As you can see the "&-1.0e+1" style values are invalid code and the
compiler fails to build the code. Is this a know issue and is there a
simple work around or way to prevent py++ from generating code that
won't compile?
Thanks,
Allen
PS. Sorry that I could not include the "real" sample, the code for it is
internal use only.
|
|
From: Gustavo C. <gjc...@gm...> - 2008-01-13 21:44:52
|
On 13/01/2008, Roman Yakovenko <rom...@gm...> wrote:
>
> On Jan 13, 2008 6:53 PM, Gustavo Carneiro <gjc...@gm...> wrote:
> > I am trying to parse C++ code like:
> >
> > template<typename R,
> > typename T1 = empty, typename T2 = empty,
> > typename T3 = empty, typename T4 = empty,
> > typename T5 = empty, typename T6 = empty>
> > class Callback ...;
> >
> > later:
> >
> > template<typename T1 = empty, typename T2 = empty,
> > typename T3 = empty, typename T4 = empty>
> > class CallbackTraceSource : public CallbackTraceSourceBase {
> > public:
> >
> > typedef Callback<void,TraceContext const &,T1,T2,T3,T4> CallbackType;
> >
> > ...
> > };
> >
> > I am trying to navigate from the CallbackTraceSource class, but no
> matter
> > what I do I cannot make pygccxml give me the class_t corresponding to
> the
> > typedef_t named 'CallbackType'. I can only get a declarated_t or
> > class_declaration_t, but I cannot find any way to get the corresponding
> > class_t. What am I missing?
>
> Template instantiation. If you can modify the source code than use
> 'sizeof' operator:
>
> > typedef Callback<void,TraceContext const &,T1,T2,T3,T4> CallbackType;
> private:
> enum{ CallbackTypeSize = sizeof( CallbackType ) };
Thanks, it really helped!
Best regards,
--
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert
|
|
From: Roman Y. <rom...@gm...> - 2008-01-13 19:05:28
|
On Jan 13, 2008 6:53 PM, Gustavo Carneiro <gjc...@gm...> wrote:
> I am trying to parse C++ code like:
>
> template<typename R,
> typename T1 = empty, typename T2 = empty,
> typename T3 = empty, typename T4 = empty,
> typename T5 = empty, typename T6 = empty>
> class Callback ...;
>
> later:
>
> template<typename T1 = empty, typename T2 = empty,
> typename T3 = empty, typename T4 = empty>
> class CallbackTraceSource : public CallbackTraceSourceBase {
> public:
>
> typedef Callback<void,TraceContext const &,T1,T2,T3,T4> CallbackType;
>
> ...
> };
>
> I am trying to navigate from the CallbackTraceSource class, but no matter
> what I do I cannot make pygccxml give me the class_t corresponding to the
> typedef_t named 'CallbackType'. I can only get a declarated_t or
> class_declaration_t, but I cannot find any way to get the corresponding
> class_t. What am I missing?
Template instantiation. If you can modify the source code than use
'sizeof' operator:
> typedef Callback<void,TraceContext const &,T1,T2,T3,T4> CallbackType;
private:
enum{ CallbackTypeSize = sizeof( CallbackType ) };
HTH
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
|
|
From: Gustavo C. <gjc...@gm...> - 2008-01-13 16:52:59
|
I am trying to parse C++ code like:
template<typename R,
typename T1 = empty, typename T2 = empty,
typename T3 = empty, typename T4 = empty,
typename T5 = empty, typename T6 = empty>
class Callback ...;
later:
template<typename T1 = empty, typename T2 = empty,
typename T3 = empty, typename T4 = empty>
class CallbackTraceSource : public CallbackTraceSourceBase {
public:
typedef Callback<void,TraceContext const &,T1,T2,T3,T4> CallbackType;
...
};
I am trying to navigate from the CallbackTraceSource class, but no matter
what I do I cannot make pygccxml give me the class_t corresponding to the
typedef_t named 'CallbackType'. I can only get a declarated_t or
class_declaration_t, but I cannot find any way to get the corresponding
class_t. What am I missing? I really need to do this, because I have to
work around the "template arguments being treated as strings, not types"
problem I mentioned a while ago.
--
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert
|
|
From: Roman Y. <rom...@gm...> - 2008-01-06 20:26:06
|
On Jan 6, 2008 8:37 PM, Roman Yakovenko <rom...@gm...> wrote: > On Jan 6, 2008 2:00 PM, Gustavo Carneiro <gjc...@gm...> wrote: > > I was wondering if there is any way to get type traits from template > > parameters, as returned by > > pygccxml.declarations.templates.split(decl_string)? I am trying to get by > > with string based matching, but it's very difficult. I also don't > > understand why templates have to be treated differently; shouldn't template > > parameters be type_t instances instead of strings? > > I guess you are right. GCC-XML doesn't dump them as argument and I > never thought to add this ability to it. > > I am going to check whether it could be done or not. The good news it could be done. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
|
From: Roman Y. <rom...@gm...> - 2008-01-06 18:37:07
|
On Jan 6, 2008 2:00 PM, Gustavo Carneiro <gjc...@gm...> wrote: > I was wondering if there is any way to get type traits from template > parameters, as returned by > pygccxml.declarations.templates.split(decl_string)? I am trying to get by > with string based matching, but it's very difficult. I also don't > understand why templates have to be treated differently; shouldn't template > parameters be type_t instances instead of strings? I guess you are right. GCC-XML doesn't dump them as argument and I never thought to add this ability to it. I am going to check whether it could be done or not. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
|
From: Gustavo C. <gjc...@gm...> - 2008-01-06 12:00:13
|
I was wondering if there is any way to get type traits from template parameters, as returned by pygccxml.declarations.templates.split(decl_string)? I am trying to get by with string based matching, but it's very difficult. I also don't understand why templates have to be treated differently; shouldn't template parameters be type_t instances instead of strings? Thanks, -- Gustavo J. A. M. Carneiro INESC Porto, Telecommunications and Multimedia Unit "The universe is always one step beyond logic." -- Frank Herbert |
|
From: Gustavo C. <gjc...@gm...> - 2008-01-01 00:30:17
|
On 31/12/2007, Nindi Singh <ni...@ya...> wrote: > > > ----- Original Message ---- > > From: Roman Yakovenko <rom...@gm...> > > To: Nindi Singh <ni...@ya...> > > Cc: pyg...@li... > > Sent: Monday, 31 December, 2007 7:45:09 PM > > Subject: Re: [pygccxml-development] pygccxml: UserWarning: unableto find > outarray size from expression > > > > On Dec 31, 2007 9:22 PM, Nindi Singh wrote: > > > I have a build of gccxml from cvs which I have checked out > > on > > > 29/12/2007. > > > I am using python2.5 > > > pygccxml 0.9.0 > > > > > > When I run my pygccxml script I continue to get the the > > following > > > warninngs > > > > I don't recommend you to mix gccxml cvs and pygccxml 0.9. It is not a > > good idea. I remember I fixed the code in few places. > > > > I suggest you to use SVN version of pygccxml. The SVN is in a good > > shape and I mean to release it soon. I have to update the > > documentation first. > > > > -- > > Roman Yakovenko > > C++ Python language binding > > http://www.language-binding.net/ > > > > It actually seems to work, but on the other hand I cannot say that I > have really stressed it. I will however checkout the SVN tree. > N > I'm actually seeing this with pygccxml svn version: /usr/local/lib/python2.5/site-packages/pygccxml/parser/scanner.py:335: UserWarning: unable to find out array size from expression "" It is triggered by something as simple as: class Something{ [...] static void Parse (int argc, char *argv[]); }; The relevant source code is: def __read_array_type( self, attrs ): type_ = attrs[ XML_AN_TYPE ] size = self.__guess_int_value( attrs.get(XML_AN_MAX, '' ) ) if size is None: size = array_t.SIZE_UNKNOWN msg = 'unable to find out array size from expression "%s"' % attrs[ XML_AN_MAX ] warnings.warn( msg ) return array_t( type_, size + 1 ) In this case attrs is: {'max': '', 'align': '64', 'type': '_1769', 'id': '_2010', 'min': '0'} I don't know how to fix, but I hope this helps. Cheers, and Happy New Year! :-) -- Gustavo J. A. M. Carneiro INESC Porto, Telecommunications and Multimedia Unit "The universe is always one step beyond logic." -- Frank Herbert |
|
From: Nindi S. <ni...@ya...> - 2007-12-31 22:16:50
|
=0A----- Original Message ----=0A> From: Roman Yakovenko <roman.yakovenko@g= mail.com>=0A> To: Nindi Singh <ni...@ya...>=0A> Cc: pygccxml-develo= pm...@li...=0A> Sent: Monday, 31 December, 2007 7:45:09 PM= =0A> Subject: Re: [pygccxml-development] pygccxml: UserWarning: unableto fi= nd outarray size from expression=0A> =0A> On Dec 31, 2007 9:22 PM, Nindi Si= ngh wrote:=0A> > I have a build of gccxml from cvs which I have checked ou= t=0A> on=0A> =0A 29/12/2007.=0A> > I am using python2.5=0A> > pygccxml 0.9.= 0=0A> >=0A> > When I run my pygccxml script I continue to get the the=0A> f= ollowing=0A> =0A warninngs=0A> =0A> I don't recommend you to mix gccxml cvs= and pygccxml 0.9. It is not a=0A> good idea. I remember I fixed the code i= n few places.=0A> =0A> I suggest you to use SVN version of pygccxml. The SV= N is in a good=0A> shape and I mean to release it soon. I have to update th= e=0A> documentation first.=0A> =0A> -- =0A> Roman Yakovenko=0A> C++ Python = language binding=0A> http://www.language-binding.net/=0A> =0A=0AIt actually= seems to work, but on the other hand I cannot say that I=0Ahave really str= essed it. I will however checkout the SVN tree.=0AN=0A=0A=0A=0A ______= _____________________________________________________=0ASupport the World A= ids Awareness campaign this month with Yahoo! For Good http://uk.promotions= .yahoo.com/forgood/ |
|
From: Roman Y. <rom...@gm...> - 2007-12-31 19:45:04
|
On Dec 31, 2007 9:22 PM, Nindi Singh <ni...@ya...> wrote: > I have a build of gccxml from cvs which I have checked out on 29/12/2007. > I am using python2.5 > pygccxml 0.9.0 > > When I run my pygccxml script I continue to get the the following warninngs I don't recommend you to mix gccxml cvs and pygccxml 0.9. It is not a good idea. I remember I fixed the code in few places. I suggest you to use SVN version of pygccxml. The SVN is in a good shape and I mean to release it soon. I have to update the documentation first. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
|
From: Nindi S. <ni...@ya...> - 2007-12-31 19:23:10
|
I have a build of gccxml from cvs which I have checked out on 29/12/2007.= =0AI am using python2.5=0Apygccxml 0.9.0=0A=0AWhen I run my pygccxml script= I continue to get the the following warninngs =0A_________________________= _____________________________________________________=0A=0A/usr/lib/python2= .5/site-packages/pygccxml/parser/scanner.py:292: UserWarning: unable to fin= d out array size from expression "0u"=0A warnings.warn( 'unable to find ou= t array size from expression "%s"' % attrs[ XML_AN_MAX ] )=0A/usr/lib/pytho= n2.5/site-packages/pygccxml/parser/scanner.py:292: UserWarning: unable to f= ind out array size from expression "7u"=0A warnings.warn( 'unable to find = out array size from expression "%s"' % attrs[ XML_AN_MAX ] )=0A/usr/lib/pyt= hon2.5/site-packages/pygccxml/parser/scanner.py:292: UserWarning: unable to= find out array size from expression "1u"=0A warnings.warn( 'unable to fin= d out array size from expression "%s"' % attrs[ XML_AN_MAX ] )=0A/usr/lib/p= ython2.5/site-packages/pygccxml/parser/scanner.py:292: UserWarning: unable = to find out array size from expression "3u"=0A warnings.warn( 'unable to f= ind out array size from expression "%s"' % attrs[ XML_AN_MAX ] )=0A/usr/lib= /python2.5/site-packages/pygccxml/parser/scanner.py:292: UserWarning: unabl= e to find out array size from expression "15u"=0A warnings.warn( 'unable t= o find out array size from expression "%s"' % attrs[ XML_AN_MAX ] )=0A/usr/= lib/python2.5/site-packages/pygccxml/parser/scanner.py:292: UserWarning: un= able to find out array size from expression "19u"=0A warnings.warn( 'unabl= e to find out array size from expression "%s"' % attrs[ XML_AN_MAX ] )=0A/u= sr/lib/python2.5/site-packages/pygccxml/parser/scanner.py:292: UserWarning:= unable to find out array size from expression "0xfffffffffffffffffffffffff= fffffffu"=0A warnings.warn( 'unable to find out array size from expression= "%s"' % attrs[ XML_AN_MAX ] )=0A/usr/lib/python2.5/site-packages/pygccxml/= parser/scanner.py:292: UserWarning: unable to find out array size from expr= ession "12u"=0A warnings.warn( 'unable to find out array size from express= ion "%s"' % attrs[ XML_AN_MAX ] )=0A/usr/lib/python2.5/site-packages/pygccx= ml/parser/scanner.py:292: UserWarning: unable to find out array size from e= xpression "47u"=0A warnings.warn( 'unable to find out array size from expr= ession "%s"' % attrs[ XML_AN_MAX ] )=0A/usr/lib/python2.5/site-packages/pyg= ccxml/parser/scanner.py:292: UserWarning: unable to find out array size fro= m expression "31u"=0A warnings.warn( 'unable to find out array size from e= xpression "%s"' % attrs[ XML_AN_MAX ] )=0A/usr/lib/python2.5/site-packages/= pygccxml/parser/scanner.py:292: UserWarning: unable to find out array size = from expression "39u"=0A warnings.warn( 'unable to find out array size fro= m expression "%s"' % attrs[ XML_AN_MAX ] )=0A/usr/lib/python2.5/site-packag= es/pygccxml/parser/scanner.py:292: UserWarning: unable to find out array si= ze from expression "55u"=0A warnings.warn( 'unable to find out array size = from expression "%s"' % attrs[ XML_AN_MAX ] )=0A/usr/lib/python2.5/site-pac= kages/pygccxml/parser/scanner.py:292: UserWarning: unable to find out array= size from expression "2u"=0A warnings.warn( 'unable to find out array siz= e from expression "%s"' % attrs[ XML_AN_MAX ] )=0A/usr/lib/python2.5/site-p= ackages/pygccxml/parser/scanner.py:292: UserWarning: unable to find out arr= ay size from expression "127u"=0A warnings.warn( 'unable to find out array= size from expression "%s"' % attrs[ XML_AN_MAX ] )=0A/usr/lib/python2.5/si= te-packages/pygccxml/parser/scanner.py:292: UserWarning: unable to find out= array size from expression "255u"=0A warnings.warn( 'unable to find out a= rray size from expression "%s"' % attrs[ XML_AN_MAX ] )=0A/usr/lib/python2.= 5/site-packages/pygccxml/parser/scanner.py:292: UserWarning: unable to find= out array size from expression "13u"=0A warnings.warn( 'unable to find ou= t array size from expression "%s"' % attrs[ XML_AN_MAX ] )=0A______________= ___________________________________________________________________________= _________________________________________=0A=0AEverything in my script is w= orking. I am not using C arrays.=0AThese warnings have appeared since I sta= rting the cvs build, after Brad King checked in a bug fix =0Aon 29/12/2007= to do with default values in in member functions of templated classes. The= se warnings to not affect my=0Ause of the utility ( yet ) but someone shoul= d look into anyway I suppose.=0A=0AN=0A =0A=0A=0A =0A=0A=0A=0A=0A ____= ______________________________________________________=0ASent from Yahoo! M= ail - a smarter inbox http://uk.mail.yahoo.com=0A |
|
From: Gustavo C. <gjc...@gm...> - 2007-12-30 14:29:32
|
On 30/12/2007, Gustavo Carneiro <gjc...@gm...> wrote: > > On 30/12/2007, Gustavo Carneiro <gjc...@gm...> wrote: > > > > I don't find any obvious way to filter out non-public enumerations > > returned from a class, with class_t.enums(). Is it not supported, or have I > > missed it? > > > hm.. same problem I am having with nested classes... > > When I have a class_t and call classes() on it, to get the classes defined > inside that class, how do I know which of the inner classes are public and > which are private? > OK; nevermind, I found<http://www.language-binding.net/pygccxml/apidocs/pygccxml.declarations.class_declaration.class_t-class.html#find_out_member_access_type>it. ( class_t.find_out_member_access_type). Sorry for the noise. -- Gustavo J. A. M. Carneiro INESC Porto, Telecommunications and Multimedia Unit "The universe is always one step beyond logic." -- Frank Herbert |
|
From: Gustavo C. <gjc...@gm...> - 2007-12-30 13:52:29
|
On 30/12/2007, Gustavo Carneiro <gjc...@gm...> wrote: > > I don't find any obvious way to filter out non-public enumerations > returned from a class, with class_t.enums(). Is it not supported, or have I > missed it? hm.. same problem I am having with nested classes... When I have a class_t and call classes() on it, to get the classes defined inside that class, how do I know which of the inner classes are public and which are private? -- Gustavo J. A. M. Carneiro INESC Porto, Telecommunications and Multimedia Unit "The universe is always one step beyond logic." -- Frank Herbert |
|
From: Gustavo C. <gjc...@gm...> - 2007-12-30 13:44:09
|
I don't find any obvious way to filter out non-public enumerations returned from a class, with class_t.enums(). Is it not supported, or have I missed it? Thanks, -- Gustavo J. A. M. Carneiro INESC Porto, Telecommunications and Multimedia Unit "The universe is always one step beyond logic." -- Frank Herbert |
|
From: Roman Y. <rom...@gm...> - 2007-12-21 21:50:03
|
On Dec 21, 2007 9:42 PM, Gustavo Carneiro <gjc...@gm...> wrote:
> I am scanning a header file that contains something like:
>
> namespace ns3 {
> class InterfaceId
> {
> [...]
> private:
> friend InterfaceId MakeObjectInterfaceId (void);
> [...]
> };
> }
>
> The function "InterfaceId MakeObjectInterfaceId (void)" is defined in the
> .cc file only, but not really declared anywhere in the .h file, only that
> one time with 'friend'.
>
> (py)gccxml is reporting this function to me, as if it was a normal
> declaration. Then I generate a wrapper for it, but the code does not
> compile:
>
> debug/bindings/python/ns3module.cc: In function 'PyObject*
> _wrap_ns3MakeObjectInterfaceId()':
> debug/bindings/python/ns3module.cc:2840: error: 'MakeObjectInterfaceId' is
> not a member of 'ns3'
>
> Any tips on how I could avoid this issue are most welcome.
Right now I have no idea. I can suggest one very expensive work around
- to parse the line that contains the declaration.
May be you should introduce ignore tag for such cases?
Another idea could be to check GCC declarations tree, may be it
contains some information GCCXML doesn't dump.
> Thanks in advance, and merry christmas! :-)
You are welcome and thank you.
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
|
|
From: Gustavo C. <gjc...@gm...> - 2007-12-21 19:42:04
|
I am scanning a header file that contains something like:
namespace ns3 {
class InterfaceId
{
[...]
private:
friend InterfaceId MakeObjectInterfaceId (void);
[...]
};
}
The function "InterfaceId MakeObjectInterfaceId (void)" is defined in the
.cc file only, but not really declared anywhere in the .h file, only that
one time with 'friend'.
(py)gccxml is reporting this function to me, as if it was a normal
declaration. Then I generate a wrapper for it, but the code does not
compile:
debug/bindings/python/ns3module.cc: In function 'PyObject*
_wrap_ns3MakeObjectInterfaceId()':
debug/bindings/python/ns3module.cc:2840: error: 'MakeObjectInterfaceId' is
not a member of 'ns3'
Any tips on how I could avoid this issue are most welcome.
Thanks in advance, and merry christmas! :-)
--
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert
|
|
From: Roman Y. <rom...@gm...> - 2007-12-20 15:29:39
|
On Dec 20, 2007 5:08 PM, Gustavo Carneiro <gjc...@gm...> wrote: > Most properties in: > > http://www.language-binding.net/pygccxml/apidocs/pygccxml.parser.config.config_t-class.html#include_paths > > are read-only. And in addition there is not even a setter method. This > leads me to support a bad coding pattern: everything must be set in the > constructor, and is frozen afterwards. > > Thoughts? Why do you want to change it after construction? What is your use case? P.S. I don't mind to add setters to the class -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
|
From: Gustavo C. <gjc...@gm...> - 2007-12-20 15:08:06
|
Most properties in: http://www.language-binding.net/pygccxml/apidocs/pygccxml.parser.config.config_t-class.html#include_paths are read-only. And in addition there is not even a setter method. This leads me to support a bad coding pattern: everything must be set in the constructor, and is frozen afterwards. Thoughts? -- Gustavo J. A. M. Carneiro INESC Porto, Telecommunications and Multimedia Unit "The universe is always one step beyond logic." -- Frank Herbert |
|
From: Roman Y. <rom...@gm...> - 2007-12-20 11:41:14
|
On Dec 20, 2007 1:13 PM, Gustavo Carneiro <gjc...@gm...> wrote:
> Hi,
>
> This is a pure gccxml issue, but maybe someone here can confirm it.
>
> Since gccxml 0.9 (CVS), when I scan these classes:
>
> class Foo
> {
> std::string m_datum;
> public:
> static int instance_count;
>
> Foo () : m_datum ("")
> { Foo::instance_count++; }
> [...]
> };
>
> class Bar : public Foo
> {
> public:
> static std::string Hooray () {
> return std::string ("Hooray!");
> }
> virtual ~Bar() {}
> };
>
> Now there is no constructor declared for class Bar, even though this class
> in C++ inherits the default constructor Foo::Foo(). With gccxml 0.7 it
> used to report that implicity constructor. Is this known?
Yes
>Is there any easy workaround?
No.
Now the long answer. I did some research work on new GCCXML and found
next things: http://pygccxml.svn.sourceforge.net/viewvc/pygccxml/pygccxml_dev/gccxml-0.9-upgrade/
I already discussed them with Brad, the author of GCCXML, this is not
going to change.
Now about work around. I guess you need this for your code generator,
right? If so pygccxml contains "type traits" classes, that help you to
deal with this situation. In many cases this functionality provides
the correct answer:
http://pygccxml.svn.sourceforge.net/viewvc/pygccxml/pygccxml_dev/pygccxml/declarations/type_traits.py?revision=1169&view=markup
( search for has_* functions )
pygccxml has pretty good tests for this functionality:
http://pygccxml.svn.sourceforge.net/viewvc/pygccxml/pygccxml_dev/unittests/data/type_traits.hpp?revision=1174&view=markup
If your needs is code generation, than my advise to use this functionality.
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
|
|
From: Gustavo C. <gjc...@gm...> - 2007-12-20 11:13:37
|
Hi,
This is a pure gccxml issue, but maybe someone here can confirm it.
Since gccxml 0.9 (CVS), when I scan these classes:
class Foo
{
std::string m_datum;
public:
static int instance_count;
Foo () : m_datum ("")
{ Foo::instance_count++; }
[...]
};
class Bar : public Foo
{
public:
static std::string Hooray () {
return std::string ("Hooray!");
}
virtual ~Bar() {}
};
Now there is no constructor declared for class Bar, even though this class
in C++ inherits the default constructor Foo::Foo(). With gccxml 0.7 it
used to report that implicity constructor. Is this known? Is there any
easy workaround?
Thanks in advance.
--
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert
|
|
From: Patrick H. <pat...@pr...> - 2007-12-18 17:04:50
|
On Dec 18, 2007, at 1:24 AM, Roman Yakovenko wrote:
> On Dec 17, 2007 10:35 PM, Ben Schleimer <bsc...@lu...>
> wrote:
>> Since gccxml first preprocesses the C++ code before building the AST
>> tree, the short answer is probably no.
>
> You right, this is exactly what happens.
>
>> However, I imagine if you did something clever like:
>> union myUint64 {
>> #if defined(WIN32)
>> UINT64 val;
>> #else
>> Uint64_t val;
>> #endif
>> };
>>
>> You might be able to save your typing info.
>
> No, this will not work, because Py++ doesn't support unions. Also
> newer version of pygccxml and Py++ will not help in this specific
> situation. The latest SVN version contains few improvements in this
> area. For example instead of vector< X, std::allocator< X > > Py++ in
> many cases will generate vector< X >. I found out, that the definition
> of some STL containers is different between GCC and MSVC.
>
> How big is your project? Do you use myUint64 in all your code without
> exceptions?
This is the first time that this has cropped up as far as I know. The
actual type is OSG::UInt64 which comes from OpenSG, a large software
package upon which ours depends. It is possible that OSG::UInt64 could
start being used more in the future because our code is using 64-bit
values as unique identifiers for data objects.
> If so, I guess it will be safe to run "search and replace"
> algorithm on generated code. You can achieve this by "replacing"
> code_creator_t.create method (
> http://language-binding.net/pyplusplus/documentation/apidocs/pyplusplus.code_creators.code_creator-pysrc.html#code_creator_t.create
> )
Thanks for the pointer. I will look into this.
-Patrick
--
Patrick L. Hartling
Senior Software Engineer, Priority 5
http://www.priority5.com/
|
|
From: Roman Y. <rom...@gm...> - 2007-12-18 07:24:16
|
On Dec 17, 2007 10:35 PM, Ben Schleimer <bsc...@lu...> wrote:
> Since gccxml first preprocesses the C++ code before building the AST
> tree, the short answer is probably no.
You right, this is exactly what happens.
> However, I imagine if you did something clever like:
> union myUint64 {
> #if defined(WIN32)
> UINT64 val;
> #else
> Uint64_t val;
> #endif
> };
>
> You might be able to save your typing info.
No, this will not work, because Py++ doesn't support unions. Also
newer version of pygccxml and Py++ will not help in this specific
situation. The latest SVN version contains few improvements in this
area. For example instead of vector< X, std::allocator< X > > Py++ in
many cases will generate vector< X >. I found out, that the definition
of some STL containers is different between GCC and MSVC.
How big is your project? Do you use myUint64 in all your code without
exceptions? If so, I guess it will be safe to run "search and replace"
algorithm on generated code. You can achieve this by "replacing"
code_creator_t.create method (
http://language-binding.net/pyplusplus/documentation/apidocs/pyplusplus.code_creators.code_creator-pysrc.html#code_creator_t.create
)
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
|
|
From: Ben S. <bsc...@lu...> - 2007-12-17 20:35:47
|
Since gccxml first preprocesses the C++ code before building the AST
tree, the short answer is probably no.
However, I imagine if you did something clever like:
union myUint64 {
#if defined(WIN32)
UINT64 val;
#else
Uint64_t val;
#endif
};
You might be able to save your typing info.
Just a guess
Ben
> -----Original Message-----
> From: pyg...@li...=20
> [mailto:pyg...@li...]=20
> On Behalf Of Patrick Hartling
> Sent: Monday, December 17, 2007 8:21 AM
> To: pyg...@li...
> Subject: [pygccxml-development] Loss of typedef in generated code
>=20
> Using GCC-XML 0.9 and Py++ r1117, I have run into a problem=20
> with typedefs and portability of generated code with Py++.=20
> The basic problem is that typedefs used to mask=20
> platform-specific type details are being discarded in the=20
> generated code, and the result is that the code is only=20
> compiling on the platform where Py++ is run.
>=20
> A very simple example of the code I am exposing to Python is the
> following:
>=20
> #if defined(WIN32)
> typedef UINT64 myUint64;
> #else
> typedef uint64_t myUint64;
> #endif
>=20
> class SomeClass
> {
> public:
> typedef myUint64 id_type;
> typedef std::vector<id_type> id_list_type;
>=20
> virtual void f(id_list_type);
> };
>=20
> On a 64-bit Linux installation, Py++ generates code that uses=20
> the "raw" type std::vector<unsigned long,=20
> std::allocator<unsigned long> > instead of using either=20
> std::vector<myUint64, std::allocator<myUint64> > or, better=20
> yet, SomeClass::id_list_type. unsigned long is not the same=20
> as UINT64 for Windows, nor is it the same as uint64_t on Mac=20
> OS X (which uses unsigned long long).
>=20
> I have been tracing through the declarations of the class,=20
> member function, method arguments, etc., but I cannot find a=20
> way to expose
> SomeClass::f() in a way that retains the typedef information.=20
> I tried inserting replacement registration code, but that=20
> does not account for the generated SomeClass_wrapper::f() and
> SomeClass_wrapper::default_f() methods having the wrong signature. =20
> Matters may be complicated further if the method signature=20
> were changed to be void f(const id_list_type&), but that is=20
> not the case at the moment.
>=20
> If nothing else, would updating to a newer version of=20
> pygccxml and Py+=20
> + help?
>=20
> -Patrick
>=20
>=20
> --
> Patrick L. Hartling
> Senior Software Engineer, Priority 5
> http://www.priority5.com/
>=20
>=20
|
|
From: Patrick H. <pat...@pr...> - 2007-12-17 16:22:01
|
Using GCC-XML 0.9 and Py++ r1117, I have run into a problem with
typedefs and portability of generated code with Py++. The basic
problem is that typedefs used to mask platform-specific type details
are being discarded in the generated code, and the result is that the
code is only compiling on the platform where Py++ is run.
A very simple example of the code I am exposing to Python is the
following:
#if defined(WIN32)
typedef UINT64 myUint64;
#else
typedef uint64_t myUint64;
#endif
class SomeClass
{
public:
typedef myUint64 id_type;
typedef std::vector<id_type> id_list_type;
virtual void f(id_list_type);
};
On a 64-bit Linux installation, Py++ generates code that uses the
"raw" type std::vector<unsigned long, std::allocator<unsigned long> >
instead of using either std::vector<myUint64, std::allocator<myUint64>
> or, better yet, SomeClass::id_list_type. unsigned long is not the
same as UINT64 for Windows, nor is it the same as uint64_t on Mac OS X
(which uses unsigned long long).
I have been tracing through the declarations of the class, member
function, method arguments, etc., but I cannot find a way to expose
SomeClass::f() in a way that retains the typedef information. I tried
inserting replacement registration code, but that does not account for
the generated SomeClass_wrapper::f() and
SomeClass_wrapper::default_f() methods having the wrong signature.
Matters may be complicated further if the method signature were
changed to be void f(const id_list_type&), but that is not the case at
the moment.
If nothing else, would updating to a newer version of pygccxml and Py+
+ help?
-Patrick
--
Patrick L. Hartling
Senior Software Engineer, Priority 5
http://www.priority5.com/
|
|
From: Roman Y. <rom...@gm...> - 2007-12-10 18:52:35
|
On Dec 10, 2007 8:09 PM, Ben Schleimer <bsc...@lu...> wrote: > > > > > I almost agree with you. I could improve the interface, > > meanwhile you can use decl_visitor_t ( > > http://language-binding.net/pygccxml/apidocs/pygccxml.declarat > > ions.decl_visitor.decl_visitor_t-class.html > > ) > > class and apply_visitor function ( > > http://language-binding.net/pygccxml/apidocs/pygccxml.declarat > > ions.algorithm-module.html#apply_visitor > > ) > > Oh, I didn't know about that functionality. Well, I'll definitely try > using it next time... Where would you look for such thing? > > > > > I know this would be useful because I had to search for > > decls based on > > > their attributes which wasn't a param in > > scopedef.member_functions(..) > > > so I had to manually test the attributes anyway. > > > > So why do you need visitor? You already know that you need > > member functions, the only thing left is to specialized the > > query. This is easily done by passing a callable to the > > member_functions function: > > > > ns.mem_funs( lambda x: len( x.arguments ) > 19 ) > > > > Argg, again, I didn't know about it because its not mentioned anywhere > in the documentation. > Maybe again a paragraph about decl_visitor_t and callable would make > them more clear to the > End users. It is described here: http://language-binding.net/pygccxml/query_interface.html#usage-examples -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |