Re: [pygccxml-development] argument policies
Brought to you by:
mbaas,
roman_yakovenko
From: Matthias B. <ba...@ir...> - 2006-05-04 15:45:27
|
Roman Yakovenko wrote: >> > For example "return status as exception" arg policies could be >> solved in >> > Python. >> >> But then it would only work on classes instantiated from Python and not >> on classes returned from wrapped C++ functions. So it's not equivalent >> to implementing the above right inside the C++ wrappers. > > It is not true. I will show you an example later. ok, I'll wait... >> > This will never work ( reliably ). py++ assumes that code is 100% >> correct. >> >> I don't understand those two sentences. What exactly are you referring >> to that will never work? And which code is not correct? > > Sorry. I meant that you can not clone a declaration. You can not have > in your code to identical declarations within the same scope. Is that a limitation of the declaration tree in pyplusplus? Of course, in the final C++ source file there cannot be two identical declarations. But in my example, this wouldn't have been the case because the declarations would have received two different arg policies which would have lead to different signatures (and it would also be ok if the name would be different). So I'm afraid I still don't see why it couldn't work... >> > Another way to solve this is to parse files, generate C++ wrapper for >> > the functions, >> > and then to parse again with generated functions wrappers. >> >> But all the information is already there after one parsing step, so why >> is it better to do another pass? > > I thought about another approach, cause the way you proposed will not work. > But right now I think I have better idea. Instead of having 1 > arguments policy, function > will have a list of arguments policies. module_creator.creator_t > will split it out. It will create calldef_t and calldef_wrapper_t for > every arguments policy. One single list wouldn't be enough. In my current implementation there is already a list (remember the getSize() example. This one already had two Output arg policies). So it would require a list containing lists... Yes, this would also be an alternative. This means, a declaration can have several "policy sets" and each set spawns its own wrapper function later on. >> I just would have put the stuff from the experimental directory into >> "contrib/pypp_api" and the array stuff in, say, "contrib/arrayinfo"... > > Please do it. ok, as soon as I have cleaned the code... - Matthias - |