Re: [pygccxml-development] Status of code inserters
Brought to you by:
mbaas,
roman_yakovenko
From: Matthias B. <ba...@ir...> - 2006-08-29 15:48:21
|
Allen Bierbaum wrote: > Matthias: > > What is the status of the code inserter's? Do you have any py++ addons > that I can try out yet? I was just about to post a message on this subject.... Well, I don't have a readily available addon yet, but I think the general way to proceed is more or less clear. Right now, it's like I have all the individual pieces spread out before me but I'm not sure how to assemble them... The result from my earlier wiki entry was that there are up to two functions involved: 1) the wrapper function that gets called from Python and that makes a call "down to" C++ where the actual work is done 2) the virtual function that gets called from C++ and that may make a call to Python So for the general case, an arg policy must be prepared to deal with both functions and there must be an API that allows it to do so. This led to some updates which I have already entered into the wiki here: https://realityforge.vrsource.org/view/PyppApi/CodeInserter#Arg_policy_interface Basically, there are now two sets of methods to create pre-call and post-call code, one for the wrapper function and one for the virtual function. In the previous version I have proposed a class WrapperManager (or wrapper_manager_t) that represents the code creator for the wrapper function, i.e. that created the complete C++ source code. I have changed this and made this class only a helper class for creating C++ functions. Now it basically provides text substitution services which could be used by the existing Py++ code creators. Those code creators still create the rough layout of the code and insert special variables at appropriate places that will get substituted by the wrapper manager. These variables represent individual parts of the C++ function. I have documented the class in the wiki over here: https://realityforge.vrsource.org/view/PyppApi/Wrapper_manager This wrapper manager object is also the object that the individual methods of the arg policies (sometimes I also call them "code blocks" in the wiki) receive as input ("wm") and which they have to use to modify either the wrapper function or the virtual function. I have already implemented most parts of the mentioned classes (wrapper manager, code manager, policy base class). Now I could add it to pypp_api but it could only make use of the "wrapper function" part and not the virtual functions. So if everyone (in particular Roman) agrees with this approach, I would rather try to update the Py++ code creators so that they use the text substitution service from above. But that's where I'm a bit lost because I'm not familiar with the implementation and all the dependencies involved. So before I continue with this I'd rather like to know if Roman agrees to the general approach. The things that I'd like to do next are: - Add the "wrapper manager" class to Py++. It's more or less a stand-alone module that I would stick into its own directory inside "pyplusplus". - Add a new decoration attribute to the decl_wrappers that stores the "arg policy" objects. - Update the Py++ calldef code creators so that they use the arg policies via the above text substitution mechanism. Additionally, I'd like to introduce the "thread_safe" decoration attribute. This involves the same code as above so I think it safes time if it is done at the same time. This option should be implemented right in the Py++ code creators and not via the "arg policy" mechanism because it affects code on a lower level than what the arg policies are doing. - Matthias - |