[pygccxml-commit] SF.net SVN: pygccxml: [1201] pygccxml_dev
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2007-12-10 21:29:16
|
Revision: 1201 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1201&view=rev Author: roman_yakovenko Date: 2007-12-10 13:29:19 -0800 (Mon, 10 Dec 2007) Log Message: ----------- improving partial name implementation Modified Paths: -------------- pygccxml_dev/docs/pygccxml.rest pygccxml_dev/pygccxml/declarations/class_declaration.py pygccxml_dev/pygccxml/declarations/container_traits.py pygccxml_dev/pygccxml/declarations/enumeration.py pygccxml_dev/pygccxml/parser/scanner.py pygccxml_dev/unittests/core_tester.py pygccxml_dev/unittests/data/core_cache.hpp pygccxml_dev/unittests/data/remove_template_defaults.hpp pygccxml_dev/unittests/find_container_traits_tester.py Modified: pygccxml_dev/docs/pygccxml.rest =================================================================== --- pygccxml_dev/docs/pygccxml.rest 2007-12-10 17:06:45 UTC (rev 1200) +++ pygccxml_dev/docs/pygccxml.rest 2007-12-10 21:29:19 UTC (rev 1201) @@ -128,7 +128,7 @@ `pygccxml`_ comes with comprehensive unit tests. It is running on Windows XP and `Ubuntu`_. I am using `Python`_ 2.4\\2.5 and `GCC-XML`_ CVS. `pygccxml`_ has -more then 170 tests. They test almost every piece of code. It also has performance +more then 215 tests. They test almost every piece of code. It also has performance tests. Most of the time I am using "white box" testing strategy. .. _`WSDL`: http://www.w3.org/TR/wsdl Modified: pygccxml_dev/pygccxml/declarations/class_declaration.py =================================================================== --- pygccxml_dev/pygccxml/declarations/class_declaration.py 2007-12-10 17:06:45 UTC (rev 1200) +++ pygccxml_dev/pygccxml/declarations/class_declaration.py 2007-12-10 21:29:19 UTC (rev 1201) @@ -40,8 +40,6 @@ elif templates.is_instantiation( name ): tmpl_name, args = templates.split( name ) for i, arg_name in enumerate( args ): - print i, ' : ', get_partial_name( arg_name.strip() ) - print args[i] = get_partial_name( arg_name.strip() ) return templates.join( tmpl_name, args ) else: @@ -125,10 +123,7 @@ return self._container_traits def _get_partial_name_impl( self ): - #~ return get_partial_name( self.name ) - if not self.container_traits: - return self.name - return self.container_traits.remove_defaults( self ) + return get_partial_name( self.name ) class class_t( scopedef.scopedef_t ): """describes class definition""" @@ -447,9 +442,6 @@ return None def _get_partial_name_impl( self ): - #~ return get_partial_name( self.name ) - if not self.container_traits: - return self.name - return self.container_traits.remove_defaults( self ) + return get_partial_name( self.name ) class_types = ( class_t, class_declaration_t ) Modified: pygccxml_dev/pygccxml/declarations/container_traits.py =================================================================== --- pygccxml_dev/pygccxml/declarations/container_traits.py 2007-12-10 17:06:45 UTC (rev 1200) +++ pygccxml_dev/pygccxml/declarations/container_traits.py 2007-12-10 21:29:19 UTC (rev 1201) @@ -406,6 +406,8 @@ if not templates.is_instantiation( cls_or_string ): return None name = templates.name( cls_or_string ) + if name.startswith( 'std::' ): + name = name[ len( 'std::' ): ] for cls_traits in container_traits: if cls_traits.name() == name: return cls_traits Modified: pygccxml_dev/pygccxml/declarations/enumeration.py =================================================================== --- pygccxml_dev/pygccxml/declarations/enumeration.py 2007-12-10 17:06:45 UTC (rev 1200) +++ pygccxml_dev/pygccxml/declarations/enumeration.py 2007-12-10 21:29:19 UTC (rev 1201) @@ -36,6 +36,8 @@ # Initialize values via property access self.values = values + self._byte_size = 0 + self._byte_align = 0 def __eq__(self, other): if not declaration.declaration_t.__eq__( self, other ): @@ -116,3 +118,18 @@ def i_depend_on_them( self, recursive=True ): return [] + + def _get_byte_size(self): + return self._byte_size + def _set_byte_size( self, new_byte_size ): + self._byte_size = new_byte_size + byte_size = property( _get_byte_size, _set_byte_size + , doc="Size of this class in bytes @type: int") + + def _get_byte_align(self): + return self._byte_align + def _set_byte_align( self, new_byte_align ): + self._byte_align = new_byte_align + byte_align = property( _get_byte_align, _set_byte_align + , doc="Alignment of this class in bytes @type: int") + Modified: pygccxml_dev/pygccxml/parser/scanner.py =================================================================== --- pygccxml_dev/pygccxml/parser/scanner.py 2007-12-10 17:06:45 UTC (rev 1200) +++ pygccxml_dev/pygccxml/parser/scanner.py 2007-12-10 21:29:19 UTC (rev 1201) @@ -302,6 +302,8 @@ #it means that this is unnamed enum. in c++ enum{ x }; enum_name = '' decl = self.__decl_factory.create_enumeration( name=enum_name ) + self.__read_byte_size(decl, attrs) + self.__read_byte_align(decl, attrs) self.__enums.append( decl ) return decl Modified: pygccxml_dev/unittests/core_tester.py =================================================================== --- pygccxml_dev/unittests/core_tester.py 2007-12-10 17:06:45 UTC (rev 1200) +++ pygccxml_dev/unittests/core_tester.py 2007-12-10 21:29:19 UTC (rev 1201) @@ -282,8 +282,16 @@ % ( 4, len(do_nothings) ) ) for index, do_nothing in enumerate(do_nothings): others = do_nothings[:index] + do_nothings[index+1:] + if set( do_nothing.overloads ) != set( others ): + print '\nexisting: ' + for x in do_nothing.overloads: + print str(x) + print '\nexpected: ' + for x in others: + print str(x) + self.failUnless( set( do_nothing.overloads ) == set( others ) - , "there is a difference between expected function overloads and existing ones." ) + , "there is a difference between expected function overloads and existing ones." ) def test_abstract_classes(self): ns = self.global_ns.namespace( 'abstract_classes' ) Modified: pygccxml_dev/unittests/data/core_cache.hpp =================================================================== --- pygccxml_dev/unittests/data/core_cache.hpp 2007-12-10 17:06:45 UTC (rev 1200) +++ pygccxml_dev/unittests/data/core_cache.hpp 2007-12-10 21:29:19 UTC (rev 1201) @@ -22,4 +22,4 @@ #endif//__core_cache_hpp__ -//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch \ No newline at end of file +//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch \ No newline at end of file Modified: pygccxml_dev/unittests/data/remove_template_defaults.hpp =================================================================== --- pygccxml_dev/unittests/data/remove_template_defaults.hpp 2007-12-10 17:06:45 UTC (rev 1200) +++ pygccxml_dev/unittests/data/remove_template_defaults.hpp 2007-12-10 21:29:19 UTC (rev 1201) @@ -102,7 +102,7 @@ typedef HASH_XXX_NS::hash_multimap< std::vector< int > const, hmm_wstr2d const > hmm_v_i2mm_wstr2d; } -inline void do_nothing1( type< sets::s_v_int > ){ +inline void f1( type< sets::s_v_int > ){ } } Modified: pygccxml_dev/unittests/find_container_traits_tester.py =================================================================== --- pygccxml_dev/unittests/find_container_traits_tester.py 2007-12-10 17:06:45 UTC (rev 1200) +++ pygccxml_dev/unittests/find_container_traits_tester.py 2007-12-10 21:29:19 UTC (rev 1201) @@ -57,10 +57,9 @@ print m.partial_name def test_recursive_partial_name( self ): - f = self.global_ns.free_fun( 'do_nothing1' ) - t1 = declarations.class_traits.get_declaration( f.arguments[0].type ) - print t1.name - print t1.partial_name + f1 = self.global_ns.free_fun( 'f1' ) + t1 = declarations.class_traits.get_declaration( f1.arguments[0].type ) + self.failUnless( 'type< std::set< std::vector< int > > >' == t1.partial_name ) def create_suite(): suite = unittest.TestSuite() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |