Revision: 687
http://svn.sourceforge.net/pygccxml/?rev=687&view=rev
Author: roman_yakovenko
Date: 2006-10-25 01:35:41 -0700 (Wed, 25 Oct 2006)
Log Message:
-----------
adding missing function_transformation.py file
small cosmetic change in sm
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/function_transformers/substitution_manager.py
Added Paths:
-----------
pyplusplus_dev/pyplusplus/function_transformers/function_transformation.py
Added: pyplusplus_dev/pyplusplus/function_transformers/function_transformation.py
===================================================================
--- pyplusplus_dev/pyplusplus/function_transformers/function_transformation.py (rev 0)
+++ pyplusplus_dev/pyplusplus/function_transformers/function_transformation.py 2006-10-25 08:35:41 UTC (rev 687)
@@ -0,0 +1,19 @@
+# Copyright 2006 Roman Yakovenko.
+# 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)
+
+
+"""This module contains the class L{function_transformation_t}.
+"""
+
+
+class function_transformation_t:
+ def __init__(self, transformers):
+ """Constructor.
+ """
+ self.__transformers = list(transformers)
+
+ @property
+ def transformers( self ):
+ return self.__transformers
Modified: pyplusplus_dev/pyplusplus/function_transformers/substitution_manager.py
===================================================================
--- pyplusplus_dev/pyplusplus/function_transformers/substitution_manager.py 2006-10-24 21:13:48 UTC (rev 686)
+++ pyplusplus_dev/pyplusplus/function_transformers/substitution_manager.py 2006-10-25 08:35:41 UTC (rev 687)
@@ -8,6 +8,7 @@
"""This module contains the L{substitution_manager_t} class.
"""
+import os
from pygccxml import declarations
from code_manager import code_manager_t, wrapper_code_manager_t
from transformer import transformer_t
@@ -290,48 +291,31 @@
self._funcs_initialized = True
- # The default method which is used when a particular method from
- # the code_base_t interface is not implemented
- defmeth = lambda x: None
+ block_sep = os.linesep * 2
# Create the wrapper function pre-call block...
- src = map(lambda cb: getattr(cb, "wrapper_pre_call", defmeth)(self), transformers)
- src = filter(lambda x: x!=None, src)
- precall = "\n\n".join(src)
- self.wrapper_func.PRE_CALL = precall
+ tmp = filter(None, map(lambda cb: cb.wrapper_pre_call(self), transformers) )
+ self.wrapper_func.PRE_CALL = block_sep.join( tmp )
# Create the wrapper function post-call block...
- src = map(lambda cb: getattr(cb, "wrapper_post_call", defmeth)(self), transformers)
- src = filter(lambda x: x!=None, src)
- src.reverse()
- postcall = "\n\n".join(src)
- self.wrapper_func.POST_CALL = postcall
+ tmp = filter(None, map(lambda cb: cb.wrapper_post_call(self), transformers) )
+ self.wrapper_func.POST_CALL = block_sep.join( tmp )
# Create the wrapper function cleanup block...
- src = map(lambda cb: getattr(cb, "wrapper_cleanup", defmeth)(self), transformers)
- src = filter(lambda x: x!=None, src)
- cleanup = "\n\n".join(src)
- self.wrapper_func.CLEANUP = cleanup
+ tmp = filter(None, map(lambda cb: cb.wrapper_cleanup(self), transformers) )
+ self.wrapper_func.CLEANUP = block_sep.join( tmp )
# Create the virtual function pre-call block...
- src = map(lambda cb: getattr(cb, "virtual_pre_call", defmeth)(self), transformers)
- src = filter(lambda x: x!=None, src)
- precall = "\n\n".join(src)
- self.virtual_func.PRE_CALL = precall
+ tmp = filter(None, map(lambda cb: cb.virtual_pre_call(self), transformers) )
+ self.virtual_func.PRE_CALL = block_sep.join( tmp )
# Create the virtual function post-call block...
- src = map(lambda cb: getattr(cb, "virtual_post_call", defmeth)(self), transformers)
- src = filter(lambda x: x!=None, src)
- src.reverse()
- postcall = "\n\n".join(src)
- self.virtual_func.POST_CALL = postcall
-
+ tmp = filter(None, map(lambda cb: cb.virtual_post_call(self), transformers) )
+ self.virtual_func.POST_CALL = block_sep.join( tmp )
+
# Create the virtual function cleanup block...
- src = map(lambda cb: getattr(cb, "virtual_cleanup", defmeth)(self), transformers)
- src = filter(lambda x: x!=None, src)
- cleanup = "\n\n".join(src)
- self.virtual_func.CLEANUP = cleanup
+ tmp = filter(None, map(lambda cb: cb.virtual_cleanup(self), transformers) )
+ self.virtual_func.CLEANUP = block_sep.join( tmp )
-
# remove_arg
def remove_arg(self, idx):
"""Remove an argument from the wrapper function.
@@ -625,4 +609,4 @@
print wm.subst_wrapper(template)
print wm.get_includes()
print wm.get_includes("virtual")
- print wm.get_includes("wrapper")
\ No newline at end of file
+ print wm.get_includes("wrapper")
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|