pygccxml-development Mailing List for C++ Python language bindings (Page 57)
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: Roman Y. <rom...@gm...> - 2006-05-30 20:49:56
|
Allen, I tried the patch and there are some errors in unit tests. I will try to fix it tommorrow and commit. I will let you know. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Roman Y. <rom...@gm...> - 2006-05-30 20:46:20
|
On 5/30/06, Allen Bierbaum <al...@vr...> wrote: > Roman Yakovenko wrote: > > > On 5/30/06, Allen Bierbaum <al...@vr...> wrote: > > > >> Roman: > >> > >> Did you ever get a chance to try out your idea? I have other people > >> that want to use pyplusplus on our projects to generate bindings but > >> they can't run my generation scripts until this bug is resolved so they > >> can use gccxml. > > > > > > Allen, I am running against the time. My family is going to grow in > > next few days > > may be week. I will have son! > > Congrats. Now I can see why you are hurrying so much to get things tied > up. :) Thanks :-) > > So I try to fix critical bugs you and other users > > reports. May be you can try latest CVS version of GCC-XML and your bug > > will gone? > > I don't think this will fix it because it is not a bug in gccxml. It is > just that gccxml detects some issues with the code it is processing so > it outputs some warnings. Unfortunately pygccxml seems to interpret any > output from gccxml as an error condition. > > > > > If not my idea was simple: we can find out ( or ask from an user ) the > > version of > > GCC-XML, and then to implement different error check mode. > > If you can change your patch to work like this I will apply it. > > Have you found problems with the idea of assuming gccxml worked > correctly if the output file is created? > > > > > The main reason for such implementation - you are the only one who > > reports > > this bug. I want to disable this special error treatment for other users. > > I think I am the only one that sees this because I have some rather > "nasty" code that causes gccxml to have problems and output warning > messages. It could be nice to have those "nasty" things within regression. I think I will implement next solution: 1. you will send me a patch 2. I will add new variable to config_t class: ignore_gccxml_output By default it will be false. So you will have to turn it on explicitly. 3. The code that actually runs gccxml will be changed, to take into account this variable? Is this good for you? Allen, I am sorry, but it could be nice if you will contribute the code. Thanks -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Roman Y. <rom...@gm...> - 2006-05-30 20:19:38
|
On 5/30/06, Allen Bierbaum <al...@vr...> wrote: > Roman: > > Did you ever get a chance to try out your idea? I have other people > that want to use pyplusplus on our projects to generate bindings but > they can't run my generation scripts until this bug is resolved so they > can use gccxml. Allen, I am running against the time. My family is going to grow in next few days may be week. I will have son! So I try to fix critical bugs you and other users reports. May be you can try latest CVS version of GCC-XML and your bug will gone? If not my idea was simple: we can find out ( or ask from an user ) the version of GCC-XML, and then to implement different error check mode. If you can change your patch to work like this I will apply it. The main reason for such implementation - you are the only one who reports this bug. I want to disable this special error treatment for other users. Thanks -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Roman Y. <rom...@gm...> - 2006-05-30 20:11:20
|
On 5/30/06, Allen Bierbaum <al...@vr...> wrote: > Did this ever get fixed? (I don't think it did) No :-(. May be I wrong with my priorities, but I wanted to create better documentation. If you want/can contribute the patch, I will apply it after all my unit tests pass. Sorry. I do have this on my to do list, but for next release, not this one. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Roman Y. <rom...@gm...> - 2006-05-30 20:00:52
|
On 5/30/06, Allen Bierbaum <al...@vr...> wrote: > Roman Yakovenko wrote: > > > On 5/30/06, Allen Bierbaum <al...@vr...> wrote: > > > >> I think you are talking about this part of the test: > >> > >> mb.global_ns[ *'public_base_t'* ].exclude() > > > > > > Right > > > >> Change it to something like this: > >> > >> mb.global_ns[ *'public_base_t'* ]['myFunction'].exclude() > >> > >> OR > >> > >> mb.global_ns[ *'public_base_t'* > >> ].member_functions('myFunction').exclude() > > > > > > Now, I don't need unit test. I see why this does not work. Thanks. > > > > Now I know that you want redefine call_redirector_t.__call__ method in > > next way: > > > > #now > > def __call__( self, *arguments, **keywords ): > > for d in self.decls: > > callable_ = getattr(d, self.name) > > callable_( *arguments, **keywords ) > > > > #you want: > > def __call__( self, *arguments, **keywords ): > > results = [] > > for d in self.decls: > > callable_ = getattr(d, self.name) > > answer = callable_( *arguments, **keywords ) > > results.append( answer ) > > #I assume that all functions will return same type: > > if not results: > > return > > if isinstance( results[0], declaration_t ): > > return mdecl_wrapper_t( results ) > > elif isinstance( results[0], mdecl_wrapper_t ): > > temp_decls = [] > > for mdecl_wrapper in results: > > temp_decls.extend( mdecl_wrapper.decls ) > > return mdecl_wrapper_t( temp_decls ) > > else: > > return results > > > > Can you test whether this code will work for you or not? > > This is close, but not quite all the code is there. I have attached a > diff where I fixed up the implementation and added code to the > mdecl_wrapper.__getitem__ method to allow calls like I wanted to make. > > See attached... > > > -Allen > > > > > > > Index: pygccxml_dev/pygccxml/declarations/mdecl_wrapper.py > =================================================================== > --- pygccxml_dev/pygccxml/declarations/mdecl_wrapper.py (revision 156) > +++ pygccxml_dev/pygccxml/declarations/mdecl_wrapper.py (working copy) > @@ -2,6 +2,7 @@ > # Distributed under the Boost Software License, Version 1.0. (See > # accompanying file LICENSE_1_0.txt or copy at > # http://www.boost.org/LICENSE_1_0.txt) > +import declaration > > class call_redirector_t( object ): > """Internal class used to call some function of objects""" > @@ -11,9 +12,23 @@ > self.decls = decls > > def __call__( self, *arguments, **keywords ): > - for d in self.decls: > - callable_ = getattr(d, self.name) > - callable_( *arguments, **keywords ) > + results = [] > + for d in self.decls: > + callable_ = getattr(d, self.name) > + answer = callable_( *arguments, **keywords ) > + results.append( answer ) > + #I assume that all functions will return same type: > + if not results: > + return > + if isinstance( results[0], declaration.declaration_t ): > + return mdecl_wrapper_t( results ) > + elif isinstance( results[0], mdecl_wrapper_t ): > + temp_decls = [] > + for mdecl_wrapper in results: > + temp_decls.extend( mdecl_wrapper.decls ) > + return mdecl_wrapper_t( temp_decls ) > + else: > + return results > > class mdecl_wrapper_t( object ): > """Multiple declarations wrapper. > @@ -44,8 +59,14 @@ > return len( self.decls ) > > def __getitem__( self, index ): > - """provides access to declaration""" > - return self.decls[index] > + """provides access to declaration. > + If passed a standard index, then return contained decl. > + Else call the getitem method of contained decls. > + """ > + if isinstance(index, int): > + return self.decls[index] > + else: > + return call_redirector_t( '__getitem__', self.decls)(index) > > def __ensure_attribute( self, name ): > invalid_decls = filter( lambda d: not hasattr( d, name ), self.decls ) > @@ -64,4 +85,4 @@ > def __getattr__( self, name ): > """@param name: name of method > """ > - return call_redirector_t( name, self.decls ) > \ No newline at end of file > + return call_redirector_t( name, self.decls ) > Allen, can you send me the whole file? Thanks -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Allen B. <al...@vr...> - 2006-05-30 19:56:44
|
Roman: Did you ever get a chance to try out your idea? I have other people that want to use pyplusplus on our projects to generate bindings but they can't run my generation scripts until this bug is resolved so they can use gccxml. Thanks, Allen Roman Yakovenko wrote: > On 5/22/06, Allen Bierbaum <al...@vr...> wrote: > >> I have had a patch sitting around in my pygccxml code for a while to >> actually allow gccxml to work on my code base. >> >> You see, some of the code I use and wrap causes gccxml to output warning >> messages during execution. The current pygccxml code makes the >> assumption that if there is any output then there was error compiling >> the code. This prevents it from working for me. >> >> I have attached a patch that fixed the problem for me by judging >> successful completion by wether or not gccxml actually generates an >> output file. This may not be the best way to do this, but it works >> for me. > > > I remember this patch. Also I remember it does not work for me. I will > check it one > more time. If it works I will commit it. If it will not work, I have > another idea how we > can fix it. > >> -Allen > > > |
From: Allen B. <al...@vr...> - 2006-05-30 19:54:13
|
Roman Yakovenko wrote: > On 5/30/06, Allen Bierbaum <al...@vr...> wrote: > >> I think you are talking about this part of the test: >> >> mb.global_ns[ *'public_base_t'* ].exclude() > > > Right > >> Change it to something like this: >> >> mb.global_ns[ *'public_base_t'* ]['myFunction'].exclude() >> >> OR >> >> mb.global_ns[ *'public_base_t'* >> ].member_functions('myFunction').exclude() > > > Now, I don't need unit test. I see why this does not work. Thanks. > > Now I know that you want redefine call_redirector_t.__call__ method in > next way: > > #now > def __call__( self, *arguments, **keywords ): > for d in self.decls: > callable_ = getattr(d, self.name) > callable_( *arguments, **keywords ) > > #you want: > def __call__( self, *arguments, **keywords ): > results = [] > for d in self.decls: > callable_ = getattr(d, self.name) > answer = callable_( *arguments, **keywords ) > results.append( answer ) > #I assume that all functions will return same type: > if not results: > return > if isinstance( results[0], declaration_t ): > return mdecl_wrapper_t( results ) > elif isinstance( results[0], mdecl_wrapper_t ): > temp_decls = [] > for mdecl_wrapper in results: > temp_decls.extend( mdecl_wrapper.decls ) > return mdecl_wrapper_t( temp_decls ) > else: > return results > > Can you test whether this code will work for you or not? This is close, but not quite all the code is there. I have attached a diff where I fixed up the implementation and added code to the mdecl_wrapper.__getitem__ method to allow calls like I wanted to make. See attached... -Allen > |
From: Roman Y. <rom...@gm...> - 2006-05-30 19:35:43
|
On 5/30/06, Lakin Wecker <lak...@gm...> wrote: > With the new SVN it still has this same error. :( I work on this, right now. > At some point in the future, I would like to make a wrapper for the > VectorX classes and the ColourValue class to have them interchangeable > with python tuples/lists. > Example: > entity.setPosition (Ogre.Vector3(500.0, 1000.0, 200.0)) > could (in the future) be written as: > entity.setPosition ([500.0, 1000.0, 200.0]) > > Is this something that I do by writing a cpp wrapper using > Boost.python, and include it when I compile? Or can I specify this in > a nice way using python and py++? This will be pretty easy. We will do it using py++. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Lakin W. <lak...@gm...> - 2006-05-30 19:30:53
|
With the new SVN it still has this same error. :( At some point in the future, I would like to make a wrapper for the VectorX classes and the ColourValue class to have them interchangeable with python tuples/lists. Example: entity.setPosition (Ogre.Vector3(500.0, 1000.0, 200.0)) could (in the future) be written as: entity.setPosition ([500.0, 1000.0, 200.0]) Is this something that I do by writing a cpp wrapper using Boost.python, and include it when I compile? Or can I specify this in a nice way using python and py++? Lakin On 5/30/06, Roman Yakovenko <rom...@gm...> wrote: > On 5/30/06, Lakin Wecker <lak...@gm...> wrote: > > I haven't tried your fix with SVN, I am going to do that right now. > > But I had just written this letter, so I'll send it to the list > > anyways. But stay tuned for an update on this situation as well. > > > > Now, I'm getting this error: > > > > TypeError: No to_python (by-value) converter found for C++ type: Ogre::Vector3 > > > > And in this case, Vector3 is copyable. (IE: there is no non_copyable > > stuff in the pypp generated source). > > > > I'm not sure how to proceed. But it's lunch time anyways, so I'm > > going to go eat. > > Bon appetite :-). I will check this. > > > -- > Roman Yakovenko > C++ Python language binding > http://www.language-binding.net/ > |
From: Roman Y. <rom...@gm...> - 2006-05-30 19:22:30
|
On 5/30/06, Allen Bierbaum <al...@vr...> wrote: > I think you are talking about this part of the test: > > mb.global_ns[ *'public_base_t'* ].exclude() Right > Change it to something like this: > > mb.global_ns[ *'public_base_t'* ]['myFunction'].exclude() > > OR > > mb.global_ns[ *'public_base_t'* ].member_functions('myFunction').exclude() Now, I don't need unit test. I see why this does not work. Thanks. Now I know that you want redefine call_redirector_t.__call__ method in next way: #now def __call__( self, *arguments, **keywords ): for d in self.decls: callable_ = getattr(d, self.name) callable_( *arguments, **keywords ) #you want: def __call__( self, *arguments, **keywords ): results = [] for d in self.decls: callable_ = getattr(d, self.name) answer = callable_( *arguments, **keywords ) results.append( answer ) #I assume that all functions will return same type: if not results: return if isinstance( results[0], declaration_t ): return mdecl_wrapper_t( results ) elif isinstance( results[0], mdecl_wrapper_t ): temp_decls = [] for mdecl_wrapper in results: temp_decls.extend( mdecl_wrapper.decls ) return mdecl_wrapper_t( temp_decls ) else: return results Can you test whether this code will work for you or not? Thanks -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Allen B. <al...@vr...> - 2006-05-30 18:58:34
|
Roman Yakovenko wrote: >> On 5/30/06, Allen Bierbaum <al...@vr...> wrote: >> > Roman Yakovenko wrote: >> > >> my_class = my_namespace["MyClass"] >> > >> my_class["mymethod"].exclude() >> > > >> > > >> > > exclude does not have return value >> > >> > The part that causes the problem is the return from ["mymethod"]. It >> > doesn't return anything, so the code above ends up calling >> exclude() on >> > NoneType. >> >> I will check this and will try to fix. > > > Allan, I am sure I am doing something wrong. > I created new test case to check the code: http://tinyurl.com/nlama . > ( Please take a look on test__getitem__ method. ) > I can not reproduce the bug you are talking about :-) > > May be you have scopedef_t.ALLOW_EMPTY_MDECL_WRAPPER set to True? > In this case, if query returns empty exception is not raised. > > Can you try and reproduce the bug, thanks ? > I think you are talking about this part of the test: mb.global_ns[ *'public_base_t'* ].exclude() Change it to something like this: mb.global_ns[ *'public_base_t'* ]['myFunction'].exclude() OR mb.global_ns[ *'public_base_t'* ].member_functions('myFunction').exclude() There should be a failure when calling exclude on the value returned from the member function lookup because there is nothing returned. When a mdecl_wrapper has a method called upon it, it never returns a value. Your test works because the only place a mdecl_wrapper comes in is the value returned from the ['public_base_t'] call. This will function fine with something like exclude that doesn't return values. But it will not work when you need values returned. -Allen |
From: Roman Y. <rom...@gm...> - 2006-05-30 18:45:19
|
On 5/30/06, Lakin Wecker <lak...@gm...> wrote: > I haven't tried your fix with SVN, I am going to do that right now. > But I had just written this letter, so I'll send it to the list > anyways. But stay tuned for an update on this situation as well. > > Now, I'm getting this error: > > TypeError: No to_python (by-value) converter found for C++ type: Ogre::Vector3 > > And in this case, Vector3 is copyable. (IE: there is no non_copyable > stuff in the pypp generated source). > > I'm not sure how to proceed. But it's lunch time anyways, so I'm > going to go eat. Bon appetite :-). I will check this. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Roman Y. <rom...@gm...> - 2006-05-30 18:41:16
|
> On 5/30/06, Allen Bierbaum <al...@vr...> wrote: > > Roman Yakovenko wrote: > > >> my_class = my_namespace["MyClass"] > > >> my_class["mymethod"].exclude() > > > > > > > > > exclude does not have return value > > > > The part that causes the problem is the return from ["mymethod"]. It > > doesn't return anything, so the code above ends up calling exclude() on > > NoneType. > > I will check this and will try to fix. Allan, I am sure I am doing something wrong. I created new test case to check the code: http://tinyurl.com/nlama . ( Please take a look on test__getitem__ method. ) I can not reproduce the bug you are talking about :-) May be you have scopedef_t.ALLOW_EMPTY_MDECL_WRAPPER set to True? In this case, if query returns empty exception is not raised. Can you try and reproduce the bug, thanks ? -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Lakin W. <lak...@gm...> - 2006-05-30 18:11:31
|
I haven't tried your fix with SVN, I am going to do that right now. But I had just written this letter, so I'll send it to the list anyways. But stay tuned for an update on this situation as well. Now, I'm getting this error: TypeError: No to_python (by-value) converter found for C++ type: Ogre::Vector3 And in this case, Vector3 is copyable. (IE: there is no non_copyable stuff in the pypp generated source). I'm not sure how to proceed. But it's lunch time anyways, so I'm going to go eat. Lakin On 5/30/06, Roman Yakovenko <rom...@gm...> wrote: > > Sorry for the confusion. I meant to say: It doesn't explicitly > > disable the copy constructor. > > > > In the meantime I am going to use something like: > > > > copyable_list = [ 'Vector3', 'Vector4', 'ColourValue', 'Vector2', ] > > for copyable in copyable_list: > > classes = ogre_ns.classes (copyable, allow_empty=True) > > classes.noncopyable = False > > > > To get around it. > > :-), too late I already fixed the bug. Fix in SVN. > But I am glad, that you found work around. > > > I forgot, that "union" is always copyable. My fault. > > > > Lakin > > > > > -- > Roman Yakovenko > C++ Python language binding > http://www.language-binding.net/ > |
From: Roman Y. <rom...@gm...> - 2006-05-30 18:09:29
|
> Sorry for the confusion. I meant to say: It doesn't explicitly > disable the copy constructor. > > In the meantime I am going to use something like: > > copyable_list = [ 'Vector3', 'Vector4', 'ColourValue', 'Vector2', ] > for copyable in copyable_list: > classes = ogre_ns.classes (copyable, allow_empty=True) > classes.noncopyable = False > > To get around it. :-), too late I already fixed the bug. Fix in SVN. But I am glad, that you found work around. I forgot, that "union" is always copyable. My fault. > Lakin > -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Lakin W. <lak...@gm...> - 2006-05-30 17:52:52
|
On 5/30/06, Lakin Wecker <lak...@gm...> wrote: > Well, I've succeeded in compiling the ogre module. But when I try to > import it I get: > > TypeError: No to_python (by-value) converter found for C++ type: > Ogre::ColourValue > > > According to: http://mail.python.org/pipermail/c++-sig/2004-August/007973.html > > This might be due to ColourValue being non-copyable. I checked the > ColourValue Generated code, and sure enough, it's non-copyable. But I > don't know why. It doesn't define a Copy Constructor, but it also > doesn't explicitly define one. Sorry for the confusion. I meant to say: It doesn't explicitly disable the copy constructor. In the meantime I am going to use something like: copyable_list = [ 'Vector3', 'Vector4', 'ColourValue', 'Vector2', ] for copyable in copyable_list: classes = ogre_ns.classes (copyable, allow_empty=True) classes.noncopyable = False To get around it. Lakin |
From: Lakin W. <lak...@gm...> - 2006-05-30 17:22:37
|
Well, I've succeeded in compiling the ogre module. But when I try to import it I get: TypeError: No to_python (by-value) converter found for C++ type: Ogre::ColourValue According to: http://mail.python.org/pipermail/c++-sig/2004-August/007973.html This might be due to ColourValue being non-copyable. I checked the ColourValue Generated code, and sure enough, it's non-copyable. But I don't know why. It doesn't define a Copy Constructor, but it also doesn't explicitly define one. I assume this is a result of Roman's last fix, when I had problems with the Frustum class which shouldn't have been copyable. I'm not sure that current fix is correct. Let me explain: I think that in the case of Frustum, it is Ogre which is at fault. According to the C++ code for Frustum, it should be copyable, and because pyplusplus is looking at the C++ code to generate the wrapper, it was correct in saying that Frustum is Copyable. In the case of ColourValue, it _is_ copyable, and Ogre is fine with leaving out the CopyConstructor for the Compiler to generate. In this case, pyplusplus should wrap ColourValue as copyable, right? I can't upload files to my website from where I am, so I am attaching the relevant ones to the email. Lakin |
From: Roman Y. <rom...@gm...> - 2006-05-30 17:14:27
|
On 5/30/06, Allen Bierbaum <al...@vr...> wrote: > Roman Yakovenko wrote: > > > On 5/30/06, Allen Bierbaum <al...@vr...> wrote: > > > >> I just ran into an interesting limitation on the current API. > >> > >> Namely, when you call methods on mdecl_wrappers and those methods return > >> decls for further processing, the return values are ignored. > >> > >> I ran into in the following case: > >> > >> my_class = my_namespace["MyClass"] > >> my_class["mymethod"].exclude() > > > > > > exclude does not have return value > > The part that causes the problem is the return from ["mymethod"]. It > doesn't return anything, so the code above ends up calling exclude() on > NoneType. I will check this and will try to fix. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Allen B. <al...@vr...> - 2006-05-30 15:01:52
|
Roman Yakovenko wrote: > On 5/30/06, Allen Bierbaum <al...@vr...> wrote: > >> I just ran into an interesting limitation on the current API. >> >> Namely, when you call methods on mdecl_wrappers and those methods return >> decls for further processing, the return values are ignored. >> >> I ran into in the following case: >> >> my_class = my_namespace["MyClass"] >> my_class["mymethod"].exclude() > > > exclude does not have return value The part that causes the problem is the return from ["mymethod"]. It doesn't return anything, so the code above ends up calling exclude() on NoneType. > >> It could also come up in something else like this though: >> >> similar_classes = my_namespace.classes(re_matcher(".*Proxies")) >> similar_classes.member_functions["bad_function"].exclude() >> >> The point is that that the call_redirector_t for mdecl_wrapper doesn't >> return any values from the methods it calls. >> >> I propose that we refactor this method to build up a list of decls >> returned from all the calls it makes and return them wrapped as a >> mdecl_wrapper_t if there are values returned and if they make sense to >> combine (ie. if they are all decl wrappers). This should allow >> functionality like above and would add quite a bit of flexibility to >> finding groups of matches within other groups of matches. (ex: find >> groups of similar methods inside groups of similar classes) > > >> Any comments? > > > Allen, I am sorry but I don't understand you. Do you want to know what > declarations > has been [in|ex]cluded? No. I want to be able to call methods like decls(), member_functions(), classes(), etc on an mdecl_wrapper and have it return another mdecl_wrapper. Right now these would be called but the return values would be silently ignored. > Or you want something more general: to define > return values > for mdecl_wrapper_t for "get" and "call" functionality, as a list of > returned values? I don't know the answer to this one. I am interested in getting feedback on how other people think this code should function. > > Also, can you modify mdec_wrapper.py file and send it? Maybe. I am not sure if I understand everything going on in there so I didn't want to take a stab at it and implement it incorrectly. -Allen > > Thanks > > |
From: Roman Y. <rom...@gm...> - 2006-05-30 05:12:14
|
On 5/30/06, Allen Bierbaum <al...@vr...> wrote: > I just ran into an interesting limitation on the current API. > > Namely, when you call methods on mdecl_wrappers and those methods return > decls for further processing, the return values are ignored. > > I ran into in the following case: > > my_class = my_namespace["MyClass"] > my_class["mymethod"].exclude() exclude does not have return value > It could also come up in something else like this though: > > similar_classes = my_namespace.classes(re_matcher(".*Proxies")) > similar_classes.member_functions["bad_function"].exclude() > > The point is that that the call_redirector_t for mdecl_wrapper doesn't > return any values from the methods it calls. > > I propose that we refactor this method to build up a list of decls > returned from all the calls it makes and return them wrapped as a > mdecl_wrapper_t if there are values returned and if they make sense to > combine (ie. if they are all decl wrappers). This should allow > functionality like above and would add quite a bit of flexibility to > finding groups of matches within other groups of matches. (ex: find > groups of similar methods inside groups of similar classes) > Any comments? Allen, I am sorry but I don't understand you. Do you want to know what declarations has been [in|ex]cluded? Or you want something more general: to define return values for mdecl_wrapper_t for "get" and "call" functionality, as a list of returned values? Also, can you modify mdec_wrapper.py file and send it? Thanks -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Roman Y. <rom...@gm...> - 2006-05-30 04:56:35
|
On 5/30/06, Lakin Wecker <lak...@gm...> wrote: > Well, if I hadn't made a typo, that approach would have worked. > Fortunately for me, the compiler reminded me that all of these members > aren't in the Ogre::Vector3 namespace, but rather in the > Ogre::%(parent_name)s namespace. > The updated code (which actually works and produces code that > compiles) looks like: > > def fix_unnamed_classes (mb): > ogre_ns = mb.namespace ('Ogre') > print len (ogre_ns.classes ('')) / 2 > > for unnamed_cls in ogre_ns.classes( '' ): > named_parent = unnamed_cls.parent > if not named_parent.name: > named_parent = named_parent.parent > > for mvar in unnamed_cls.public_members: > if not mvar.name: > continue > named_parent.add_code( > 'add_property( "%(mvar)s", &Ogre::%(parent)s::%(mvar)s)' \ > % dict( mvar=mvar.name, > parent=named_parent.name ) ) Thank you! -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Allen B. <al...@vr...> - 2006-05-29 23:48:25
|
I just ran into an interesting limitation on the current API. Namely, when you call methods on mdecl_wrappers and those methods return decls for further processing, the return values are ignored. I ran into in the following case: my_class = my_namespace["MyClass"] my_class["mymethod"].exclude() It could also come up in something else like this though: similar_classes = my_namespace.classes(re_matcher(".*Proxies")) similar_classes.member_functions["bad_function"].exclude() The point is that that the call_redirector_t for mdecl_wrapper doesn't return any values from the methods it calls. I propose that we refactor this method to build up a list of decls returned from all the calls it makes and return them wrapped as a mdecl_wrapper_t if there are values returned and if they make sense to combine (ie. if they are all decl wrappers). This should allow functionality like above and would add quite a bit of flexibility to finding groups of matches within other groups of matches. (ex: find groups of similar methods inside groups of similar classes) Any comments? -Allen |
From: Lakin W. <lak...@gm...> - 2006-05-29 21:52:58
|
Well, if I hadn't made a typo, that approach would have worked. Fortunately for me, the compiler reminded me that all of these members aren't in the Ogre::Vector3 namespace, but rather in the Ogre::%(parent_name)s namespace. The updated code (which actually works and produces code that compiles) looks like: def fix_unnamed_classes (mb): ogre_ns =3D mb.namespace ('Ogre') print len (ogre_ns.classes ('')) / 2 for unnamed_cls in ogre_ns.classes( '' ): named_parent =3D unnamed_cls.parent if not named_parent.name: named_parent =3D named_parent.parent for mvar in unnamed_cls.public_members: if not mvar.name: continue named_parent.add_code( 'add_property( "%(mvar)s", &Ogre::%(parent)s::%(mvar)s)' \ % dict( mvar=3Dmvar.name, parent=3Dnamed_parent.name ) ) Lakin On 5/29/06, Lakin Wecker <lak...@gm...> wrote: > Thanks roman, that approach worked. For archival purposes, the final > code that I used is: > > def fix_unnamed_classes (mb): > ogre_ns =3D mb.namespace ('Ogre') > print len (ogre_ns.classes ('')) / 2 > > for unnamed_cls in ogre_ns.classes( '' ): > named_parent =3D unnamed_cls.parent > if not named_parent.name: > named_parent =3D named_parent.parent > > for mvar in unnamed_cls.public_members: > if not mvar.name: > continue > named_parent.add_code( > 'add_property( "%(mvar)s", &Ogre::Vector3::%(mvar)s)' \ > % dict( mvar=3Dmvar.name ) ) > > The only strange part is that some of the names in > unnamed_cls.public_members are blank themselves, so I had to filter > them out as well. > > Lakin > > On 5/29/06, Lakin Wecker <lak...@gm...> wrote: > > On 5/29/06, Roman Yakovenko <rom...@gm...> wrote: > > > > > > I will add this feature, but not in a week or two. > > > > Cool. > > > > > I could be wrong, but there are > > > 4 or 5 places, where ogre uses such constructs. > > > > You're right, and the following approach will be sufficient for the > > time being. > > > > Lakin > > > > > mb =3D module_builder_t(...) > > > ogre =3D mb.namespace( 'ogre' ) > > > print len( ogre.classes( '' ) ) / 2 > > > > > > for unnamed_cls in ogre.classes( '' ): > > > named_parent =3D unnamed.parent > > > if not named_parent.name: > > > named_parent =3D named_parent.parent > > > for mvar in named_paret.member_variables(): > > > named_parent.add_code( > > > 'add_property( "%(mvar)s", &Ogre::Vector3::%(mvar)s)" > > > % dict( mvar=3Dmvar.name ) ) ) > > > > > > May be the previous code needs to be fixed, but I think you've got th= e idea. > > > > > > I work on preparing source code to release. This means: source code i= s open > > > for bug fixes + documentation. I have to do it, otherwise my project = will > > > never have documentation :-(. > > > > > > -- > > > Roman Yakovenko > > > C++ Python language binding > > > http://www.language-binding.net/ > > > > > > |
From: Lakin W. <lak...@gm...> - 2006-05-29 20:08:36
|
Thanks roman, that approach worked. For archival purposes, the final code that I used is: def fix_unnamed_classes (mb): ogre_ns =3D mb.namespace ('Ogre') print len (ogre_ns.classes ('')) / 2 for unnamed_cls in ogre_ns.classes( '' ): named_parent =3D unnamed_cls.parent if not named_parent.name: named_parent =3D named_parent.parent for mvar in unnamed_cls.public_members: if not mvar.name: continue named_parent.add_code( 'add_property( "%(mvar)s", &Ogre::Vector3::%(mvar)s)' \ % dict( mvar=3Dmvar.name ) ) The only strange part is that some of the names in unnamed_cls.public_members are blank themselves, so I had to filter them out as well. Lakin On 5/29/06, Lakin Wecker <lak...@gm...> wrote: > On 5/29/06, Roman Yakovenko <rom...@gm...> wrote: > > > > I will add this feature, but not in a week or two. > > Cool. > > > I could be wrong, but there are > > 4 or 5 places, where ogre uses such constructs. > > You're right, and the following approach will be sufficient for the > time being. > > Lakin > > > mb =3D module_builder_t(...) > > ogre =3D mb.namespace( 'ogre' ) > > print len( ogre.classes( '' ) ) / 2 > > > > for unnamed_cls in ogre.classes( '' ): > > named_parent =3D unnamed.parent > > if not named_parent.name: > > named_parent =3D named_parent.parent > > for mvar in named_paret.member_variables(): > > named_parent.add_code( > > 'add_property( "%(mvar)s", &Ogre::Vector3::%(mvar)s)" > > % dict( mvar=3Dmvar.name ) ) ) > > > > May be the previous code needs to be fixed, but I think you've got the = idea. > > > > I work on preparing source code to release. This means: source code is = open > > for bug fixes + documentation. I have to do it, otherwise my project wi= ll > > never have documentation :-(. > > > > -- > > Roman Yakovenko > > C++ Python language binding > > http://www.language-binding.net/ > > > |
From: Lakin W. <lak...@gm...> - 2006-05-29 19:31:30
|
On 5/29/06, Roman Yakovenko <rom...@gm...> wrote: > > I will add this feature, but not in a week or two. Cool. > I could be wrong, but there are > 4 or 5 places, where ogre uses such constructs. You're right, and the following approach will be sufficient for the time being. Lakin > mb =3D module_builder_t(...) > ogre =3D mb.namespace( 'ogre' ) > print len( ogre.classes( '' ) ) / 2 > > for unnamed_cls in ogre.classes( '' ): > named_parent =3D unnamed.parent > if not named_parent.name: > named_parent =3D named_parent.parent > for mvar in named_paret.member_variables(): > named_parent.add_code( > 'add_property( "%(mvar)s", &Ogre::Vector3::%(mvar)s)" > % dict( mvar=3Dmvar.name ) ) ) > > May be the previous code needs to be fixed, but I think you've got the id= ea. > > I work on preparing source code to release. This means: source code is op= en > for bug fixes + documentation. I have to do it, otherwise my project will > never have documentation :-(. > > -- > Roman Yakovenko > C++ Python language binding > http://www.language-binding.net/ > |