[pygccxml-commit] SF.net SVN: pygccxml:[1748] pyplusplus_dev
Brought to you by:
mbaas,
roman_yakovenko
|
From: <rom...@us...> - 2009-08-08 19:57:53
|
Revision: 1748
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1748&view=rev
Author: roman_yakovenko
Date: 2009-08-08 19:57:28 +0000 (Sat, 08 Aug 2009)
Log Message:
-----------
ctypes code generator cleanup
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/creators_factory/ctypes_creator.py
pyplusplus_dev/unittests/ctypes_tester.py
pyplusplus_dev/unittests/sconstruct
Modified: pyplusplus_dev/pyplusplus/creators_factory/ctypes_creator.py
===================================================================
--- pyplusplus_dev/pyplusplus/creators_factory/ctypes_creator.py 2009-08-08 19:53:41 UTC (rev 1747)
+++ pyplusplus_dev/pyplusplus/creators_factory/ctypes_creator.py 2009-08-08 19:57:28 UTC (rev 1748)
@@ -131,69 +131,15 @@
return self.module
def visit_member_function( self ):
- self.__dependencies_manager.add_exported( self.curr_decl )
- md_cc = self.__class2methods_def[ self.curr_decl.parent ]
- cls_intro_cc = self.__class2introduction[ self.curr_decl.parent ]
- mem_fun_def_cc = code_creators.mem_fun_definition_t( self.curr_decl )
- #TODO: calculate only exported functions
- if 0 == len( self.curr_decl.overloads):
- #this is the first and the last and the only class constructor
- md_cc.adopt_creator( mem_fun_def_cc )
- cls_intro_cc.adopt_creator( code_creators.mem_fun_introduction_t(self.curr_decl) )
- else:
- has_introduction = cls_intro_cc.find_by_creator_class( code_creators.mem_fun_introduction_t, unique=False )
- has_introduction = filter( lambda cc: cc.alias == mem_fun_def_cc.alias, has_introduction )
- if not has_introduction:
- cls_intro_cc.adopt_creator( code_creators.mem_fun_introduction_t(self.curr_decl) )
-
- multi_method_def = md_cc.find_mutli_method( mem_fun_def_cc.alias )
- if not multi_method_def:
- multi_method_def = code_creators.multi_method_definition_t ()
- md_cc.adopt_creator( multi_method_def )
- multi_method_def.adopt_creator( mem_fun_def_cc )
-
- #~ if self.curr_decl.virtuality == VIRTUALITY_TYPES.NOT_VIRTUAL:
- #~ cls_intro_cc.adopt_creator( code_creators.mem_fun_introduction_t( self.curr_decl ) )
- #~ elif self.curr_decl.virtuality == VIRTUALITY_TYPES.VIRTUAL:
- #~ cls_intro_cc.adopt_creator( code_creators.vmem_fun_introduction_t( self.curr_decl ) )
- #~ else:
- #~ pass
-
+ pass #c code doesn't have member functions
def visit_constructor( self ):
- self.__dependencies_manager.add_exported( self.curr_decl )
- md_cc = self.__class2methods_def[ self.curr_decl.parent ]
- cls_intro_cc = self.__class2introduction[ self.curr_decl.parent ]
- init_def_cc = code_creators.init_definition_t( self.curr_decl )
- #TODO: calculate only exported constructors
- if 0 == len( self.curr_decl.overloads):
- #this is the first and the last and the only class constructor
- md_cc.adopt_creator( init_def_cc )
- cls_intro_cc.adopt_creator( code_creators.init_introduction_t(self.curr_decl) )
- else:
- has_constructor = cls_intro_cc.find_by_creator_class( code_creators.init_introduction_t )
- if not has_constructor:
- cls_intro_cc.adopt_creator( code_creators.init_introduction_t(self.curr_decl) )
-
- multi_method_def = md_cc.find_mutli_method( init_def_cc.alias )
- if not multi_method_def:
- multi_method_def = code_creators.multi_method_definition_t ()
- md_cc.adopt_creator( multi_method_def )
- multi_method_def.adopt_creator( init_def_cc )
-
+ pass #c code doesn't have member functions
def visit_destructor( self ):
- self.__dependencies_manager.add_exported( self.curr_decl )
- cls_intro_cc = self.__class2introduction[ self.curr_decl.parent ]
- cls_intro_cc.adopt_creator( code_creators.del_introduction_t( self.curr_decl ) )
-
- md_cc = self.__class2methods_def[ self.curr_decl.parent ]
- md_cc.adopt_creator( code_creators.del_definition_t( self.curr_decl ) )
-
+ pass #c code doesn't have member functions
def visit_member_operator( self ):
- self.__dependencies_manager.add_exported( self.curr_decl )
-
+ pass #c code doesn't have member functions
def visit_casting_operator( self ):
- self.__dependencies_manager.add_exported( self.curr_decl )
-
+ pass #c code doesn't have member functions
def visit_free_function( self ):
self.__dependencies_manager.add_exported( self.curr_decl )
self.curr_code_creator.adopt_creator( code_creators.function_definition_t( self.curr_decl ) )
@@ -208,11 +154,10 @@
def visit_class(self):
self.__dependencies_manager.add_exported( self.curr_decl )
- if not self.curr_decl.opaque:
- if self.curr_decl.calldefs( self.__should_generate_code, recursive=False, allow_empty=True ):
- md_cc = code_creators.methods_definition_t( self.curr_decl )
- self.__class2methods_def[ self.curr_decl ] = md_cc
- self.__class_defs_ccs.adopt_creator( md_cc )
+ if self.curr_decl.opaque:
+ cls_intro_cc = self.__class2introduction[ self.curr_decl ]
+ cls_intro_cc.adopt_creator( code_creators.opaque_init_introduction_t( self.curr_decl ) )
+ else:
class_ = self.curr_decl
for decl in self.curr_decl.decls( recursive=False, allow_empty=True ):
if isinstance( decl, declarations.variable_t ):
@@ -221,9 +166,6 @@
self.curr_decl = decl
declarations.apply_visitor( self, decl )
self.curr_decl = class_
- else:
- cls_intro_cc = self.__class2introduction[ self.curr_decl ]
- cls_intro_cc.adopt_creator( code_creators.opaque_init_introduction_t( self.curr_decl ) )
def visit_enumeration(self):
self.__dependencies_manager.add_exported( self.curr_decl )
Modified: pyplusplus_dev/unittests/ctypes_tester.py
===================================================================
--- pyplusplus_dev/unittests/ctypes_tester.py 2009-08-08 19:53:41 UTC (rev 1747)
+++ pyplusplus_dev/unittests/ctypes_tester.py 2009-08-08 19:57:28 UTC (rev 1748)
@@ -77,43 +77,8 @@
return sys.modules[ self.base_name ]
-class pof_tester_t( ctypes_base_tester_t ):
- def __init__( self, *args, **keywd ):
- ctypes_base_tester_t.__init__( self, 'pof', *args, **keywd )
- def test_constructors(self):
- n0 = self.module_ref.pof.number_t()
- self.failUnless( 0 == n0.get_value() )
- n1 = self.module_ref.pof.number_t( ctypes.c_long(32) )
- self.failUnless( 32 == n1.get_value() )
- n2 = self.module_ref.pof.number_t( ctypes.pointer(n1) )
- self.failUnless( 32 == n2.get_value() )
- def test_free_functions(self):
- #the following code fails - difference in the calling conventions
- #TODO: the following test failes, because of the wrong calling convention used
- self.failUnless( self.module_ref.identity_cpp( int(111) ) == 111 )
-
- def test_get_set_values( self ):
- n0 = self.module_ref.pof.number_t()
- n0.set_value( 1977 )
- self.failUnless( 1977 == n0.get_value() )
-
- #the following functionality is still missing
- #~ def test_operator_assign( self ):
- #~ obj1 = number_t(1)
- #~ obj2 = number_t(2)
- #~ x = obj1.operator_assign( obj2 )
- #~ #there are special cases, where ctypes could introduce "optimized" behaviour and not create new python object
- #~ self.failUnless( x is obj1 )
- #~ self.failUnless( obj1.m_value == obj2.m_value )
-
- #~ def test_clone( self ):
- #~ obj1 = number_t(1)
- #~ obj2 = obj1.clone()
- #~ self.fail( obj1.get_value() == obj2.get_value() )
-
-
class issues_tester_t( ctypes_base_tester_t ):
def __init__( self, *args, **keywd ):
ctypes_base_tester_t.__init__( self, 'issues', *args, **keywd )
@@ -208,16 +173,6 @@
def test(self):
self.failUnless( 21 == self.module_ref.sum_ints( 3, 5,7,9) )
-class templates_tester_t( ctypes_base_tester_t ):
- def __init__( self, *args, **keywd ):
- ctypes_base_tester_t.__init__( self, 'templates', *args, **keywd )
-
- def customize( self, mb ):
- mb.class_( 'value_t<int>' ).alias = 'int_value_t'
-
- def test(self):
- pass
-
class circular_references_tester_t( ctypes_base_tester_t ):
def __init__( self, *args, **keywd ):
ctypes_base_tester_t.__init__( self, 'circular_references', *args, **keywd )
@@ -236,17 +191,12 @@
def create_suite():
#part of this functionality is going to be deprecated
suite = unittest.TestSuite()
- return suite
- #~ if 'win' in sys.platform:
- #~ suite.addTest( unittest.makeSuite(pof_tester_t))
- #~ suite.addTest( unittest.makeSuite(issues_tester_t))
suite.addTest( unittest.makeSuite(enums_tester_t))
suite.addTest( unittest.makeSuite(opaque_tester_t))
suite.addTest( unittest.makeSuite(include_algorithm_tester_t))
suite.addTest( unittest.makeSuite(anonymous_tester_t))
suite.addTest( unittest.makeSuite(variables_tester_t))
suite.addTest( unittest.makeSuite(varargs_tester_t))
- suite.addTest( unittest.makeSuite(templates_tester_t))
suite.addTest( unittest.makeSuite(circular_references_tester_t))
return suite
Modified: pyplusplus_dev/unittests/sconstruct
===================================================================
--- pyplusplus_dev/unittests/sconstruct 2009-08-08 19:53:41 UTC (rev 1747)
+++ pyplusplus_dev/unittests/sconstruct 2009-08-08 19:57:28 UTC (rev 1748)
@@ -25,9 +25,7 @@
env.AppendUnique( CPPPATH=['#data'] )
-scripts = [ 'pof'
- , 'issues'
- , 'enums'
+scripts = [ 'enums'
, 'opaque'
, 'include_algorithm'
, 'anonymous'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|