pygccxml-commit Mailing List for C++ Python language bindings (Page 55)
Brought to you by:
mbaas,
roman_yakovenko
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(190) |
Apr
(166) |
May
(170) |
Jun
(75) |
Jul
(105) |
Aug
(131) |
Sep
(99) |
Oct
(84) |
Nov
(67) |
Dec
(54) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(66) |
Feb
(49) |
Mar
(25) |
Apr
(62) |
May
(21) |
Jun
(34) |
Jul
(9) |
Aug
(21) |
Sep
(5) |
Oct
|
Nov
(63) |
Dec
(34) |
2008 |
Jan
(10) |
Feb
(42) |
Mar
(26) |
Apr
(25) |
May
(6) |
Jun
(40) |
Jul
(18) |
Aug
(29) |
Sep
(6) |
Oct
(32) |
Nov
(14) |
Dec
(56) |
2009 |
Jan
(127) |
Feb
(52) |
Mar
(2) |
Apr
(10) |
May
(29) |
Jun
(3) |
Jul
|
Aug
(16) |
Sep
(4) |
Oct
(11) |
Nov
(8) |
Dec
(14) |
2010 |
Jan
(31) |
Feb
(1) |
Mar
(7) |
Apr
(9) |
May
(1) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
(8) |
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <al...@us...> - 2006-08-29 14:07:46
|
Revision: 491 Author: allenb Date: 2006-08-29 07:07:44 -0700 (Tue, 29 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=491&view=rev Log Message: ----------- Add support for passing list of dependent header files to builder. This list of files is used to compute the cache signature (in addition to using the normal list of header files passed in to parse). This change gives the user the ability to make the caches safer in the presence of changes if they want to. Modified Paths: -------------- pyplusplus_dev/contrib/goodies/goodie_perf_overrides.py Modified: pyplusplus_dev/contrib/goodies/goodie_perf_overrides.py =================================================================== --- pyplusplus_dev/contrib/goodies/goodie_perf_overrides.py 2006-08-29 13:27:12 UTC (rev 490) +++ pyplusplus_dev/contrib/goodies/goodie_perf_overrides.py 2006-08-29 14:07:44 UTC (rev 491) @@ -79,8 +79,12 @@ , optimize_queries=True , ignore_gccxml_output=False , indexing_suite_version=1 - , cflags=""): - """ See standard method. """ + , cflags="" + , dependent_headers=[]): + """ See standard method. + dependent_headers: A list of header files (full paths) that this module depends + upon and should be made part of the cache signature. + """ object.__init__( self ) self.logger = _logging_.loggers.module_builder gccxml_config = parser.config_t( @@ -110,8 +114,10 @@ if cache: sig = md5.new() sig.update(configuration_signature(gccxml_config)) - for f in files: + for f in self._module_builder_t__parsed_files: # files: sig.update(file_signature(f)) + for f in dependent_headers: + sig.update(file_signature(f)) cur_digest = sig.hexdigest() if os.path.exists(cache): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-29 13:27:24
|
Revision: 490 Author: roman_yakovenko Date: 2006-08-29 06:27:12 -0700 (Tue, 29 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=490&view=rev Log Message: ----------- updating custom smart ptr testers Modified Paths: -------------- pyplusplus_dev/unittests/custom_smart_ptr_classes_tester.py pyplusplus_dev/unittests/data/custom_smart_ptr.h Modified: pyplusplus_dev/unittests/custom_smart_ptr_classes_tester.py =================================================================== --- pyplusplus_dev/unittests/custom_smart_ptr_classes_tester.py 2006-08-29 11:28:51 UTC (rev 489) +++ pyplusplus_dev/unittests/custom_smart_ptr_classes_tester.py 2006-08-29 13:27:12 UTC (rev 490) @@ -8,6 +8,46 @@ import unittest import fundamental_tester_base + +MODULE_SPTR_DECL_CODE = \ +""" +namespace boost{ namespace python{ + + using namespace controllers; + + controller_i* get_pointer( my_smart_ptr_t< controller_i > const& p ){ + return p.get(); + } + + template <> + struct pointee< my_smart_ptr_t< controller_i > >{ + typedef controller_i type; + }; + + + add_x_t* get_pointer( my_smart_ptr_t< add_x_t > const& p ){ + return p.get(); + } + + template <> + struct pointee< my_smart_ptr_t< add_x_t > >{ + typedef add_x_t type; + }; + + +}}// namespace boost::python converter +""" + +MODULE_SPTR_REG_CODE = \ +""" + bp::register_ptr_to_python< my_smart_ptr_t< controllers::controller_i > >(); + + bp::register_ptr_to_python< my_smart_ptr_t< controllers::add_x_t > >(); + + bp::implicitly_convertible< my_smart_ptr_t< controllers::add_x_t >, my_smart_ptr_t< controllers::controller_i > >(); + +""" + class tester_t(fundamental_tester_base.fundamental_tester_base_t): EXTENSION_NAME = 'custom_smart_ptr_classes' @@ -19,9 +59,8 @@ def customize( self, mb ): mb.classes( lambda cls: 'ptr' in cls.name).exclude() - return - cls = mb.class_( 'value_plus_x_t' ) - cls.add_registration_code( 'bp::register_ptr_to_python< boost::shared_ptr< no_init_ns::value_plus_x_t > >();', False ) + mb.add_declaration_code( MODULE_SPTR_DECL_CODE ) + mb.add_registration_code( MODULE_SPTR_REG_CODE ) def create_identity_value( self, module, v ): class identity_value_t( module.value_i ): Modified: pyplusplus_dev/unittests/data/custom_smart_ptr.h =================================================================== --- pyplusplus_dev/unittests/data/custom_smart_ptr.h 2006-08-29 11:28:51 UTC (rev 489) +++ pyplusplus_dev/unittests/data/custom_smart_ptr.h 2006-08-29 13:27:12 UTC (rev 490) @@ -18,25 +18,27 @@ : pRep(rep), pUseCount( new unsigned int(1) ) {} - my_smart_ptr_t(const my_smart_ptr_t<T>& r) + template<class Y> + my_smart_ptr_t(const my_smart_ptr_t<Y>& r) : pRep(0), pUseCount(0) { - pRep = r.pRep; - pUseCount = r.pUseCount; + pRep = r.get(); + pUseCount = r.useCountPointer(); if(pUseCount){ ++(*pUseCount); } } - my_smart_ptr_t& operator=(const my_smart_ptr_t<T>& r){ + template< class Y> + my_smart_ptr_t& operator=(const my_smart_ptr_t<Y>& r){ if( pRep == r.pRep ){ return *this; } release(); - pRep = r.pRep; - pUseCount = r.pUseCount; + pRep = r.get(); + pUseCount = r.useCountPointer(); if(pUseCount){ ++(*pUseCount); } @@ -59,16 +61,6 @@ return pRep; } - inline bool unique() const { - assert(pUseCount); - return *pUseCount == 1; - } - - inline unsigned int useCount() const { - assert(pUseCount); - return *pUseCount; - } - inline unsigned int* useCountPointer() const { return pUseCount; } @@ -77,18 +69,6 @@ return pRep; } - inline bool isNull(void) const { - return pRep == 0; - } - - inline void setNull(void) { - if (pRep){ - release(); - pRep = 0; - pUseCount = 0; - } - } - protected: inline void release(void){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-29 11:29:05
|
Revision: 489 Author: roman_yakovenko Date: 2006-08-29 04:28:51 -0700 (Tue, 29 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=489&view=rev Log Message: ----------- adding custom smart pointers tester Added Paths: ----------- pyplusplus_dev/unittests/custom_smart_ptr_classes_tester.py pyplusplus_dev/unittests/data/custom_smart_ptr.h pyplusplus_dev/unittests/data/custom_smart_ptr_classes_to_be_exported.hpp Added: pyplusplus_dev/unittests/custom_smart_ptr_classes_tester.py =================================================================== --- pyplusplus_dev/unittests/custom_smart_ptr_classes_tester.py (rev 0) +++ pyplusplus_dev/unittests/custom_smart_ptr_classes_tester.py 2006-08-29 11:28:51 UTC (rev 489) @@ -0,0 +1,64 @@ +# Copyright 2004 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) + +import os +import sys +import unittest +import fundamental_tester_base + +class tester_t(fundamental_tester_base.fundamental_tester_base_t): + EXTENSION_NAME = 'custom_smart_ptr_classes' + + def __init__( self, *args ): + fundamental_tester_base.fundamental_tester_base_t.__init__( + self + , tester_t.EXTENSION_NAME + , *args ) + + def customize( self, mb ): + mb.classes( lambda cls: 'ptr' in cls.name).exclude() + return + cls = mb.class_( 'value_plus_x_t' ) + cls.add_registration_code( 'bp::register_ptr_to_python< boost::shared_ptr< no_init_ns::value_plus_x_t > >();', False ) + + def create_identity_value( self, module, v ): + class identity_value_t( module.value_i ): + def __init__( self, v ): + module.value_i.__init__( self ) + self.value = v + + def get_value(self): + return self.value + + return identity_value_t(v) + + def create_add_5_value( self, module, v ): + class add_5_value_t( module.value_plus_x_t ): + def __init__( self, v ): + module.value_plus_x_t.__init__( self, v ) + + def get_plus_value(self): + print "I am here" + return 5 + return add_5_value_t( v ) + + def run_tests(self, module): + add_0 = module.add_x_t( 23 ) + self.failUnless( 23 == add_0.get_value() ) + self.failUnless( 23 == module.ref_get_value( add_0 ) ) + self.failUnless( 23 == module.val_get_value( add_0 ) ) + self.failUnless( 23 == module.const_ref_get_value( add_0 ) ) + + +def create_suite(): + suite = unittest.TestSuite() + suite.addTest( unittest.makeSuite(tester_t)) + return suite + +def run_suite(): + unittest.TextTestRunner(verbosity=2).run( create_suite() ) + +if __name__ == "__main__": + run_suite() Added: pyplusplus_dev/unittests/data/custom_smart_ptr.h =================================================================== --- pyplusplus_dev/unittests/data/custom_smart_ptr.h (rev 0) +++ pyplusplus_dev/unittests/data/custom_smart_ptr.h 2006-08-29 11:28:51 UTC (rev 489) @@ -0,0 +1,125 @@ +#ifndef __my_smart_ptr_t__ +#define __my_smart_ptr_t__ + +#include <assert.h> + +template<class T> class my_smart_ptr_t { +protected: + T* pRep; + unsigned int* pUseCount; +public: + + my_smart_ptr_t() + : pRep(0), pUseCount(0) + {} + + //What will happen if rep is NULL? -> bug + explicit my_smart_ptr_t(T* rep) + : pRep(rep), pUseCount( new unsigned int(1) ) + {} + + my_smart_ptr_t(const my_smart_ptr_t<T>& r) + : pRep(0), pUseCount(0) + { + pRep = r.pRep; + pUseCount = r.pUseCount; + if(pUseCount){ + ++(*pUseCount); + } + } + + my_smart_ptr_t& operator=(const my_smart_ptr_t<T>& r){ + if( pRep == r.pRep ){ + return *this; + } + + release(); + + pRep = r.pRep; + pUseCount = r.pUseCount; + if(pUseCount){ + ++(*pUseCount); + } + return *this; + } + + virtual ~my_smart_ptr_t() { + release(); + } + + inline T& operator*() const { + assert(pRep); return *pRep; + } + + inline T* operator->() const { + assert(pRep); return pRep; + } + + inline T* get() const { + return pRep; + } + + inline bool unique() const { + assert(pUseCount); + return *pUseCount == 1; + } + + inline unsigned int useCount() const { + assert(pUseCount); + return *pUseCount; + } + + inline unsigned int* useCountPointer() const { + return pUseCount; + } + + inline T* getPointer() const { + return pRep; + } + + inline bool isNull(void) const { + return pRep == 0; + } + + inline void setNull(void) { + if (pRep){ + release(); + pRep = 0; + pUseCount = 0; + } + } + +protected: + + inline void release(void){ + bool destroyThis = false; + + if( pUseCount ){ + if( --(*pUseCount) == 0){ + destroyThis = true; + } + } + if (destroyThis){ + destroy(); + } + } + + virtual void destroy(void){ + delete pRep; + delete pUseCount; + } +}; + +template<class T, class U> inline bool operator==(my_smart_ptr_t<T> const& a, my_smart_ptr_t<U> const& b) +{ + return a.get() == b.get(); +} + +template<class T, class U> inline bool operator!=(my_smart_ptr_t<T> const& a, my_smart_ptr_t<U> const& b) +{ + return a.get() != b.get(); +} + + +#endif //__my_smart_ptr_t__ + Added: pyplusplus_dev/unittests/data/custom_smart_ptr_classes_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/custom_smart_ptr_classes_to_be_exported.hpp (rev 0) +++ pyplusplus_dev/unittests/data/custom_smart_ptr_classes_to_be_exported.hpp 2006-08-29 11:28:51 UTC (rev 489) @@ -0,0 +1,113 @@ +#include "custom_smart_ptr.h" + +namespace controllers{ + +struct controller_i{ +public: + virtual ~controller_i() { } + virtual int get_value(void) const = 0; +}; + +typedef my_smart_ptr_t<controller_i> controller_ptr_i; + +struct multiply_x_t : controller_i{ + multiply_x_t( int value ) + : m_value( value ) + {} + + virtual int get_value(void) const{ + return m_value * get_multiply_value(); + } + + virtual int get_multiply_value() const{ + return 1; + } + +private: + int m_value; +}; + +typedef my_smart_ptr_t<multiply_x_t> multiply_x_ptr_t; + +struct add_x_t : controller_i{ + add_x_t( int value ) + : m_value( value ) + {} + + virtual int get_value(void) const{ + return m_value + get_add_value(); + } + + virtual int get_add_value() const{ + return 0; + } + +private: + int m_value; +}; + + +struct add_x_ptr_t : public my_smart_ptr_t< add_x_t >{ + + explicit add_x_ptr_t(add_x_t* rep) + : my_smart_ptr_t<add_x_t>(rep) + {} + + add_x_ptr_t(const add_x_ptr_t& r) + : my_smart_ptr_t<add_x_t>(r) + {} + + //added by me( Roman ), to allow implicit conversion between add_x_ptr_t and add_x_ptr_t + //operator my_smart_ptr_t<resource_t>() const { + // return my_smart_ptr_t<resource_t>( *this ); + //} + + /// Operator used to convert a add_x_ptr_t to a add_x_ptr_t + add_x_ptr_t& operator=(const add_x_ptr_t& r){ + + if( pRep == static_cast<add_x_t*>(r.getPointer()) ){ + return *this; + } + + release(); + + pRep = static_cast<add_x_t*>(r.getPointer()); + pUseCount = r.useCountPointer(); + + if (pUseCount){ + ++(*pUseCount); + } + + return *this; + } +}; + +add_x_ptr_t create_sptr_add_x(){ + return add_x_ptr_t( new add_x_t(12) ); +} + +} + + + +//not supported +//add_x_ptr_t create_shared_resource(){ +// return add_x_ptr_t( new add_x_t() ); +//} + +inline int +ref_get_value( controllers::controller_ptr_i& a ){ + return a->get_value(); +} + +inline int +val_get_value( controllers::controller_ptr_i a ){ + return a->get_value(); +} + +inline int +const_ref_get_value( const controllers::controller_ptr_i& a ){ + return a->get_value(); +} + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2006-08-28 23:35:26
|
Revision: 488 Author: allenb Date: 2006-08-28 16:35:22 -0700 (Mon, 28 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=488&view=rev Log Message: ----------- Fix mdecls wrappers. Modified Paths: -------------- pyplusplus_dev/contrib/goodies/goodie_overrides.py Modified: pyplusplus_dev/contrib/goodies/goodie_overrides.py =================================================================== --- pyplusplus_dev/contrib/goodies/goodie_overrides.py 2006-08-28 21:43:28 UTC (rev 487) +++ pyplusplus_dev/contrib/goodies/goodie_overrides.py 2006-08-28 23:35:22 UTC (rev 488) @@ -35,13 +35,13 @@ if not False in [isinstance(x,(pd.declaration_t,pd.mdecl_wrapper_t)) for x in results]: all_decls = [] for x in results: - if isinstance( x, declaration.declaration_t ): + if isinstance( x, pd.declaration_t ): all_decls.append(x) - elif isinstance( x, mdecl_wrapper_t ): - all_decls.extend(x.decls) + elif isinstance( x, pd.mdecl_wrapper_t ): + all_decls.extend(x.declarations) else: assert False, "Should not get here" - return mdecl_wrapper_t( all_decls ) + return pd.mdecl_wrapper_t( all_decls ) # Otherwise, just return the list else: return results @@ -49,7 +49,8 @@ mdecl_wrapper.call_redirector_t.__call__ = new_call_redirector_t__call__ # Override the mdecl_wrapper_t.__getitem__ method - +# - Adds support for calling getitem ( []'s ) on sub decls +# ie. ns["Class"]["method"].exclude() def new_mdecl_wrapper_t__getitem__(self,index): """Provide access to declaration. If passed a standard index, then return contained decl. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2006-08-28 21:43:31
|
Revision: 487 Author: allenb Date: 2006-08-28 14:43:28 -0700 (Mon, 28 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=487&view=rev Log Message: ----------- Fix a bug that would allow the compiler to create an enum_<:: template. Modified Paths: -------------- pyplusplus_dev/pyplusplus/code_creators/enum.py Modified: pyplusplus_dev/pyplusplus/code_creators/enum.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/enum.py 2006-08-28 21:36:21 UTC (rev 486) +++ pyplusplus_dev/pyplusplus/code_creators/enum.py 2006-08-28 21:43:28 UTC (rev 487) @@ -35,7 +35,7 @@ , 'name' : algorithm.create_identifier( self, full_name + '::' + value_name ) } def _create_impl(self): - bpl_enum = '%(bpl::enum_)s<%(name)s>("%(alias)s")' \ + bpl_enum = '%(bpl::enum_)s< %(name)s>("%(alias)s")' \ % { 'bpl::enum_' : algorithm.create_identifier( self, '::boost::python::enum_' ) , 'name' : algorithm.create_identifier( self, self.declaration.decl_string ) , 'alias' : self.alias } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2006-08-28 21:36:24
|
Revision: 486 Author: allenb Date: 2006-08-28 14:36:21 -0700 (Mon, 28 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=486&view=rev Log Message: ----------- - Add performance overrides - Included overrides - create_identifier: Just turn this into an identity function - module_builder_t.__init__: Override this method to cache the full module results Both of these changes have significant benefits. To use them just import goodies.goodie_perf_overrides Modified Paths: -------------- pyplusplus_dev/contrib/goodies/__init__.py pyplusplus_dev/contrib/goodies/goodie_utils.py Added Paths: ----------- pyplusplus_dev/contrib/goodies/goodie_perf_overrides.py Modified: pyplusplus_dev/contrib/goodies/__init__.py =================================================================== --- pyplusplus_dev/contrib/goodies/__init__.py 2006-08-28 21:34:04 UTC (rev 485) +++ pyplusplus_dev/contrib/goodies/__init__.py 2006-08-28 21:36:21 UTC (rev 486) @@ -7,7 +7,8 @@ # Allen Bierbaum # -#import goodie_overrides +import goodie_perf_overrides +import goodie_overrides from goodie_utils import (set_recursive_default, set_allow_empty_mdecl_default, finalize, add_member_function, wrap_method, add_method, Added: pyplusplus_dev/contrib/goodies/goodie_perf_overrides.py =================================================================== --- pyplusplus_dev/contrib/goodies/goodie_perf_overrides.py (rev 0) +++ pyplusplus_dev/contrib/goodies/goodie_perf_overrides.py 2006-08-28 21:36:21 UTC (rev 486) @@ -0,0 +1,162 @@ +# Copyright 2004 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) +# +# Authors: +# Allen Bierbaum +# +# This file defines overrides to the standard pyplusplus behavior +# +import time + +print "Using Goodie perf overrides:" + +# --- Override the behavior of mdecl_wrapper ---- # +import pygccxml.declarations.type_traits + +# +# Increased performance by 20% +# +def override_tt_remove_alias(tp): + """returns type without typedefs""" + if not tp: + return tp + ret_val = getattr(tp,"_cache_ra", None) + if not ret_val: + ret_val = pygccxml.declarations.type_traits.__remove_alias( tp, False ) + setattr(tp,"_cache_ra",ret_val) + return ret_val + +#pygccxml.declarations.type_traits.remove_alias = override_tt_remove_alias +#print " overriding type_traits.remove_alias" + +# --------------- create_identifier --------------- # +import pyplusplus.code_creators.algorithm +import pyplusplus.decl_wrappers.algorithm +import pyplusplus.code_creators +import pyplusplus.code_creators.class_declaration + +def override_create_identifier(creator, full_name ): + """ + This function will find all relevant namespace aliases and will return new + full name that takes into account namespace aliases. + Override: Temporary. Hack that is not portable. + """ + return full_name + +pyplusplus.decl_wrappers.algorithm.create_identifier = override_create_identifier +pyplusplus.code_creators.algorithm.create_identifier = override_create_identifier + +print " overriding decl_wrapper.algorithm.create_identifier." + +# -------------- MB Cache --------------- # +import pyplusplus.module_builder + +from pygccxml import parser +from pygccxml import declarations as decls_package + +from pyplusplus import _logging_ +from pyplusplus import decl_wrappers +from pyplusplus import file_writers +from pyplusplus import code_creators +from pyplusplus import module_creator as mcreator_package + +import cPickle, md5, os.path, gzip +from pygccxml.parser.declarations_cache import file_signature, configuration_signature + + +def mb_override__init__( self + , files + , gccxml_path='' + , working_directory='.' + , include_paths=None + , define_symbols=None + , undefine_symbols=None + , start_with_declarations=None + , compilation_mode=None + , cache=None + , optimize_queries=True + , ignore_gccxml_output=False + , indexing_suite_version=1 + , cflags=""): + """ See standard method. """ + object.__init__( self ) + self.logger = _logging_.loggers.module_builder + gccxml_config = parser.config_t( + gccxml_path=gccxml_path + , working_directory=working_directory + , include_paths=include_paths + , define_symbols=define_symbols + , undefine_symbols=undefine_symbols + , start_with_declarations=start_with_declarations + , ignore_gccxml_output=ignore_gccxml_output + , cflags=cflags) + + #may be in future I will add those directories to user_defined_directories + #to self.__code_creator. + self._module_builder_t__working_dir = os.path.abspath( working_directory ) + + self._module_builder_t__parsed_files = map( decls_package.filtering.normalize_path + , parser.project_reader_t.get_os_file_names( files ) ) + tmp = map( lambda file_: os.path.split( file_ )[0], self._module_builder_t__parsed_files ) + self._module_builder_t__parsed_dirs = filter( None, tmp ) + + self._module_builder_t__global_ns = None + + # If we have a cache filename + # - Compute signature and check it against file + # - If matches, load it + if cache: + sig = md5.new() + sig.update(configuration_signature(gccxml_config)) + for f in files: + sig.update(file_signature(f)) + cur_digest = sig.hexdigest() + + if os.path.exists(cache): + self.logger.info("Attempting to loading module cache file: %s"%cache) + cache_file = file(cache,'rb') + cache_digest = cPickle.load(cache_file) + if (cur_digest == cache_digest): + load_start_time = time.time() + self.logger.info(" Signatures matched, loading data.") + self._module_builder_t__global_ns = cPickle.load(cache_file) + self._module_builder_t__code_creator = None + self.logger.info(" Loading complete. %ss"%(time.time()-load_start_time)) + else: + self.logger.info(" Signatures did not match. Ignoring cache.") + cache_file.close() + + # If didn't load global_ns from cache + # - Parse and optimize it + # - Then save to cache if requested + if not self._module_builder_t__global_ns: + self.logger.info("Parsing declarations.") + self._module_builder_t__global_ns = self._module_builder_t__parse_declarations( files + , gccxml_config + , compilation_mode + , None + , indexing_suite_version) + self._module_builder_t__code_creator = None + if optimize_queries: + self.logger.info("Running optimizer.") + self.run_query_optimizer() + + if cache: + self.logger.info("Writing module cache... ") + cache_file = file(cache,'wb') + cPickle.dump(cur_digest, cache_file, cPickle.HIGHEST_PROTOCOL) + cPickle.dump(self._module_builder_t__global_ns, cache_file, cPickle.HIGHEST_PROTOCOL) + cache_file.close() + self.logger.info("Complete.") + + self._module_builder_t__declarations_code_head = [] + self._module_builder_t__declarations_code_tail = [] + + self._module_builder_t__registrations_code_head = [] + self._module_builder_t__registrations_code_tail = [] + +pyplusplus.module_builder.module_builder_t.__init__ = mb_override__init__ +print " overriding module_builder.__init__ with cache." + Modified: pyplusplus_dev/contrib/goodies/goodie_utils.py =================================================================== --- pyplusplus_dev/contrib/goodies/goodie_utils.py 2006-08-28 21:34:04 UTC (rev 485) +++ pyplusplus_dev/contrib/goodies/goodie_utils.py 2006-08-28 21:36:21 UTC (rev 486) @@ -8,6 +8,7 @@ # import pygccxml.declarations as pd from pyplusplus.module_builder.call_policies import * +import pyplusplus.module_builder import pygccxml.declarations.type_traits as tt import pygccxml.declarations.cpptypes as cpptypes import pyplusplus.code_creators as code_creators @@ -21,6 +22,7 @@ def set_allow_empty_mdecl_default(val): pd.scopedef_t.ALLOW_EMPTY_MDECL_WRAPPER = val + def finalize(cls): """ Attempt to finalize a class by not exposing virtual methods. Still exposes in the case of pure virtuals otherwise the class This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2006-08-28 21:34:07
|
Revision: 485 Author: allenb Date: 2006-08-28 14:34:04 -0700 (Mon, 28 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=485&view=rev Log Message: ----------- Removed module caching as per Roman's request. Modified Paths: -------------- pyplusplus_dev/pyplusplus/module_builder/builder.py Modified: pyplusplus_dev/pyplusplus/module_builder/builder.py =================================================================== --- pyplusplus_dev/pyplusplus/module_builder/builder.py 2006-08-28 19:45:50 UTC (rev 484) +++ pyplusplus_dev/pyplusplus/module_builder/builder.py 2006-08-28 21:34:04 UTC (rev 485) @@ -16,9 +16,6 @@ from pyplusplus import code_creators from pyplusplus import module_creator as mcreator_package -import cPickle, md5, os.path, gzip -from pygccxml.parser.declarations_cache import file_signature, configuration_signature - class module_builder_t(object): """ This class provides users with simple and intuitive interface to Py++ @@ -39,8 +36,7 @@ , optimize_queries=True , ignore_gccxml_output=False , indexing_suite_version=1 - , cflags="" - , module_cache=None): + , cflags=""): """ @param files: list of files, declarations from them you want to export @type files: list of strings or L{file_configuration_t} instances @@ -60,9 +56,6 @@ @param undefine_symbols: list of strings @param cflags: Raw string to be added to gccxml command line. - - @param module_cache: Name of a file to use as a module cache. This will cache - the processing done in __init__. """ object.__init__( self ) self.logger = _logging_.loggers.module_builder @@ -84,55 +77,15 @@ , parser.project_reader_t.get_os_file_names( files ) ) tmp = map( lambda file_: os.path.split( file_ )[0], self.__parsed_files ) self.__parsed_dirs = filter( None, tmp ) - - self.__global_ns = None - - # If we have a module_cache filename - # - Compute signature and check it against file - # - If matches, load it - if module_cache: - sig = md5.new() - sig.update(configuration_signature(gccxml_config)) - for f in files: - sig.update(file_signature(f)) - cur_digest = sig.hexdigest() - if os.path.exists(module_cache): - self.logger.info("Attempting to loading module cache file: %s"%module_cache) - cache_file = file(module_cache,'rb') - cache_digest = cPickle.load(cache_file) - if (cur_digest == cache_digest): - load_start_time = time.time() - self.logger.info(" Signatures matched, loading data.") - self.__global_ns = cPickle.load(cache_file) - self.__code_creator = None - self.logger.info(" Loading complete. %ss"%(time.time()-load_start_time)) - else: - self.logger.info(" Signatures did not match. Ignoring cache.") - cache_file.close() - - # If didn't load global_ns from cache - # - Parse and optimize it - # - Then save to cache if requested - if not self.__global_ns: - print "Parsing data" - self.__global_ns = self.__parse_declarations( files - , gccxml_config - , compilation_mode - , cache - , indexing_suite_version) - self.__code_creator = None - if optimize_queries: - print "Running optimizer" - self.run_query_optimizer() - - if module_cache: - print "Writing module cache... ", - cache_file = file(module_cache,'wb') - cPickle.dump(cur_digest, cache_file, cPickle.HIGHEST_PROTOCOL) - cPickle.dump(self.__global_ns, cache_file, cPickle.HIGHEST_PROTOCOL) - cache_file.close() - print " done." + self.__global_ns = self.__parse_declarations( files + , gccxml_config + , compilation_mode + , cache + , indexing_suite_version) + self.__code_creator = None + if optimize_queries: + self.run_query_optimizer() self.__declarations_code_head = [] self.__declarations_code_tail = [] @@ -140,7 +93,6 @@ self.__registrations_code_head = [] self.__registrations_code_tail = [] - def _get_global_ns( self ): return self.__global_ns global_ns = property( _get_global_ns, doc="reference to global namespace" ) @@ -198,7 +150,7 @@ if not found: decl.exclude() - def __apply_decls_defaults(self, decls): + def __apply_decls_defaults(self, decls): flatten_decls = decls_package.make_flatten( decls ) self.__filter_by_location( flatten_decls ) call_policies_resolver = mcreator_package.built_in_resolver_t() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2006-08-28 19:45:58
|
Revision: 484 Author: allenb Date: 2006-08-28 12:45:50 -0700 (Mon, 28 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=484&view=rev Log Message: ----------- Expose make_flatten_generator and use it. Modified Paths: -------------- pyplusplus_dev/pyplusplus/code_creators/__init__.py pyplusplus_dev/pyplusplus/code_creators/algorithm.py pyplusplus_dev/pyplusplus/code_creators/class_declaration.py pyplusplus_dev/pyplusplus/module_creator/creator.py pyplusplus_dev/pyplusplus/utils/__init__.py Modified: pyplusplus_dev/pyplusplus/code_creators/__init__.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/__init__.py 2006-08-28 19:41:30 UTC (rev 483) +++ pyplusplus_dev/pyplusplus/code_creators/__init__.py 2006-08-28 19:45:50 UTC (rev 484) @@ -17,7 +17,7 @@ from code_creator import code_creator_t from compound import compound_t -from algorithm import make_flatten +from algorithm import (make_flatten, make_flatten_list, make_flatten_generator) from algorithm import creator_finder from algorithm import create_identifier from algorithm import creators_affect_on_me Modified: pyplusplus_dev/pyplusplus/code_creators/algorithm.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/algorithm.py 2006-08-28 19:41:30 UTC (rev 483) +++ pyplusplus_dev/pyplusplus/code_creators/algorithm.py 2006-08-28 19:45:50 UTC (rev 484) @@ -37,7 +37,7 @@ answer.extend( proceed_single( creator ) ) return answer -def _make_flatten_generator( creator_or_creators ): +def make_flatten_generator( creator_or_creators ): import compound def proceed_single( creator ): yield creator @@ -61,6 +61,7 @@ """ make_flatten - function that will create flat representation of code creators tree. """ +make_flatten_list = _make_flatten_list make_flatten = _make_flatten_list class creator_finder: @@ -80,7 +81,7 @@ import declaration_based #prevent cyclic import search_area = where if recursive: - search_area = make_flatten( where ) + search_area = make_flatten_generator( where ) return filter( lambda inst: isinstance( inst, declaration_based.declaration_based_t ) \ and declaration_matcher( inst.declaration ) , search_area ) @@ -96,5 +97,5 @@ def find_by_class_instance( what, where, recursive=True ): search_area = where if recursive: - search_area = make_flatten( where ) - return filter( lambda inst: isinstance( inst, what ), search_area ) \ No newline at end of file + search_area = make_flatten_generator( where ) + return filter( lambda inst: isinstance( inst, what ), search_area ) Modified: pyplusplus_dev/pyplusplus/code_creators/class_declaration.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/class_declaration.py 2006-08-28 19:41:30 UTC (rev 483) +++ pyplusplus_dev/pyplusplus/code_creators/class_declaration.py 2006-08-28 19:45:50 UTC (rev 484) @@ -120,7 +120,7 @@ base_classes[ id( hierarchy_info.related_class ) ] = hierarchy_info base_classes_size = len( base_classes ) creators = {} - for creator in algorithm.make_flatten( self.top_parent.body.creators ): + for creator in algorithm.make_flatten_generator( self.top_parent.body.creators ): if not isinstance( creator, class_t ): continue if id(creator.declaration) in base_classes: Modified: pyplusplus_dev/pyplusplus/module_creator/creator.py =================================================================== --- pyplusplus_dev/pyplusplus/module_creator/creator.py 2006-08-28 19:41:30 UTC (rev 483) +++ pyplusplus_dev/pyplusplus/module_creator/creator.py 2006-08-28 19:45:50 UTC (rev 484) @@ -544,7 +544,7 @@ self._treat_smart_pointers() if self.__enable_indexing_suite: self._treat_indexing_suite() - for creator in code_creators.make_flatten( self.__extmodule ): + for creator in code_creators.make_flatten_generator( self.__extmodule ): creator.target_configuration = self.__target_configuration #last action. self._append_user_code() Modified: pyplusplus_dev/pyplusplus/utils/__init__.py =================================================================== --- pyplusplus_dev/pyplusplus/utils/__init__.py 2006-08-28 19:41:30 UTC (rev 483) +++ pyplusplus_dev/pyplusplus/utils/__init__.py 2006-08-28 19:45:50 UTC (rev 484) @@ -27,7 +27,7 @@ @staticmethod def print_( extmodule ): creators = filter( missing_call_policies._selector - , code_creators.make_flatten( extmodule.creators ) ) + , code_creators.make_flatten_generator( extmodule.creators ) ) for creator in creators: print creator.declaration.__class__.__name__, ': ', declarations.full_name( creator.declaration ) print ' *** MISSING CALL POLICY', creator.declaration.function_type().decl_string @@ -36,7 +36,7 @@ @staticmethod def exclude( extmodule ): creators = filter( missing_call_policies._selector - , code_creators.make_flatten( extmodule.creators ) ) + , code_creators.make_flatten_generator( extmodule.creators ) ) for creator in creators: creator.parent.remove_creator( creator ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2006-08-28 19:41:32
|
Revision: 483 Author: allenb Date: 2006-08-28 12:41:30 -0700 (Mon, 28 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=483&view=rev Log Message: ----------- Cache the results of optimization and processing in module builder. Modified Paths: -------------- pyplusplus_dev/pyplusplus/module_builder/builder.py Modified: pyplusplus_dev/pyplusplus/module_builder/builder.py =================================================================== --- pyplusplus_dev/pyplusplus/module_builder/builder.py 2006-08-28 13:51:01 UTC (rev 482) +++ pyplusplus_dev/pyplusplus/module_builder/builder.py 2006-08-28 19:41:30 UTC (rev 483) @@ -16,6 +16,9 @@ from pyplusplus import code_creators from pyplusplus import module_creator as mcreator_package +import cPickle, md5, os.path, gzip +from pygccxml.parser.declarations_cache import file_signature, configuration_signature + class module_builder_t(object): """ This class provides users with simple and intuitive interface to Py++ @@ -36,7 +39,8 @@ , optimize_queries=True , ignore_gccxml_output=False , indexing_suite_version=1 - , cflags=""): + , cflags="" + , module_cache=None): """ @param files: list of files, declarations from them you want to export @type files: list of strings or L{file_configuration_t} instances @@ -56,6 +60,9 @@ @param undefine_symbols: list of strings @param cflags: Raw string to be added to gccxml command line. + + @param module_cache: Name of a file to use as a module cache. This will cache + the processing done in __init__. """ object.__init__( self ) self.logger = _logging_.loggers.module_builder @@ -77,15 +84,55 @@ , parser.project_reader_t.get_os_file_names( files ) ) tmp = map( lambda file_: os.path.split( file_ )[0], self.__parsed_files ) self.__parsed_dirs = filter( None, tmp ) + + self.__global_ns = None + + # If we have a module_cache filename + # - Compute signature and check it against file + # - If matches, load it + if module_cache: + sig = md5.new() + sig.update(configuration_signature(gccxml_config)) + for f in files: + sig.update(file_signature(f)) + cur_digest = sig.hexdigest() - self.__global_ns = self.__parse_declarations( files - , gccxml_config - , compilation_mode - , cache - , indexing_suite_version) - self.__code_creator = None - if optimize_queries: - self.run_query_optimizer() + if os.path.exists(module_cache): + self.logger.info("Attempting to loading module cache file: %s"%module_cache) + cache_file = file(module_cache,'rb') + cache_digest = cPickle.load(cache_file) + if (cur_digest == cache_digest): + load_start_time = time.time() + self.logger.info(" Signatures matched, loading data.") + self.__global_ns = cPickle.load(cache_file) + self.__code_creator = None + self.logger.info(" Loading complete. %ss"%(time.time()-load_start_time)) + else: + self.logger.info(" Signatures did not match. Ignoring cache.") + cache_file.close() + + # If didn't load global_ns from cache + # - Parse and optimize it + # - Then save to cache if requested + if not self.__global_ns: + print "Parsing data" + self.__global_ns = self.__parse_declarations( files + , gccxml_config + , compilation_mode + , cache + , indexing_suite_version) + self.__code_creator = None + if optimize_queries: + print "Running optimizer" + self.run_query_optimizer() + + if module_cache: + print "Writing module cache... ", + cache_file = file(module_cache,'wb') + cPickle.dump(cur_digest, cache_file, cPickle.HIGHEST_PROTOCOL) + cPickle.dump(self.__global_ns, cache_file, cPickle.HIGHEST_PROTOCOL) + cache_file.close() + print " done." self.__declarations_code_head = [] self.__declarations_code_tail = [] @@ -93,6 +140,7 @@ self.__registrations_code_head = [] self.__registrations_code_tail = [] + def _get_global_ns( self ): return self.__global_ns global_ns = property( _get_global_ns, doc="reference to global namespace" ) @@ -150,7 +198,7 @@ if not found: decl.exclude() - def __apply_decls_defaults(self, decls): + def __apply_decls_defaults(self, decls): flatten_decls = decls_package.make_flatten( decls ) self.__filter_by_location( flatten_decls ) call_policies_resolver = mcreator_package.built_in_resolver_t() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-28 13:51:11
|
Revision: 482 Author: roman_yakovenko Date: 2006-08-28 06:51:01 -0700 (Mon, 28 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=482&view=rev Log Message: ----------- adding unit tests that better describes the problem Modified Paths: -------------- pyplusplus_dev/unittests/data/no_init_to_be_exported.hpp pyplusplus_dev/unittests/no_init_tester.py Modified: pyplusplus_dev/unittests/data/no_init_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/no_init_to_be_exported.hpp 2006-08-28 13:46:26 UTC (rev 481) +++ pyplusplus_dev/unittests/data/no_init_to_be_exported.hpp 2006-08-28 13:51:01 UTC (rev 482) @@ -10,17 +10,33 @@ namespace no_init_ns{ -class controller_i{ +struct value_i{ public: - virtual ~controller_i() { } - virtual bool get_value(void) const = 0; - virtual void set_value(bool value) = 0; + virtual ~value_i() { } + virtual int get_value(void) const = 0; }; +struct value_plus_x_t : value_i{ + value_plus_x_t( int value ) + : m_value( value ) + {} + + virtual int get_value(void) const{ + return m_value + get_plus_value(); + } + + virtual int get_plus_value() const{ + return 0; + } + +private: + int m_value; +}; + inline int -get_value( const boost::shared_ptr< controller_i >& controller ){ - if( controller ){ - return controller->get_value() ? 1 : 0; +get_value( const boost::shared_ptr< value_i >& v ){ + if( v ){ + return v->get_value(); } else{ return -1; Modified: pyplusplus_dev/unittests/no_init_tester.py =================================================================== --- pyplusplus_dev/unittests/no_init_tester.py 2006-08-28 13:46:26 UTC (rev 481) +++ pyplusplus_dev/unittests/no_init_tester.py 2006-08-28 13:51:01 UTC (rev 482) @@ -17,26 +17,42 @@ , tester_t.EXTENSION_NAME , *args ) - def create_py_controller( self, module ): - class py_controller_t( module.controller_i ): - def __init__( self ): - module.controller_i.__init__( self ) - self.value = True + def customize( self, mb ): + cls = mb.class_( 'value_plus_x_t' ) + cls.add_registration_code( 'bp::register_ptr_to_python< boost::shared_ptr< no_init_ns::value_plus_x_t > >();', False ) + def create_identity_value( self, module, v ): + class identity_value_t( module.value_i ): + def __init__( self, v ): + module.value_i.__init__( self ) + self.value = v + def get_value(self): return self.value - def set_value( self, v ): - self.value = v - return py_controller_t() + return identity_value_t(v) + def create_plus_5_value( self, module, v ): + class plus_5_value_t( module.value_plus_x_t ): + def __init__( self, v ): + module.value_plus_x_t.__init__( self, v ) + + def get_plus_value(self): + print "I am here" + return 5 + return plus_5_value_t( v ) + def run_tests(self, module): - controller = self.create_py_controller( module ) - self.failUnless( 1 == module.get_value( controller ) ) - controller.set_value( False ) - self.failUnless( 0 == module.get_value( controller ) ) + identity_value = self.create_identity_value( module, 23 ) + self.failUnless( 23 == module.get_value( identity_value ) ) self.failUnless( -1 == module.get_value( None ) ) + plus_5_value = self.create_plus_5_value( module, 23 ) + print plus_5_value.get_value() + print module.get_value( plus_5_value ) + self.failUnless( 28 == module.get_value( plus_5_value ) ) + + def create_suite(): suite = unittest.TestSuite() suite.addTest( unittest.makeSuite(tester_t)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mb...@us...> - 2006-08-28 13:46:31
|
Revision: 481 Author: mbaas Date: 2006-08-28 06:46:26 -0700 (Mon, 28 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=481&view=rev Log Message: ----------- Small fix so that the environment file on Windows may contain native backslashes as path separator. Modified Paths: -------------- pyplusplus_dev/unittests/autoconfig.py Modified: pyplusplus_dev/unittests/autoconfig.py =================================================================== --- pyplusplus_dev/unittests/autoconfig.py 2006-08-28 09:16:02 UTC (rev 480) +++ pyplusplus_dev/unittests/autoconfig.py 2006-08-28 13:46:26 UTC (rev 481) @@ -29,10 +29,10 @@ code = [ "SharedLibrary( target=r'%(target)s'" , " , source=[ %(sources)s ]" - , " , LIBS=[ %s ]" % ','.join( [ '"%s"' % lib for lib in scons_config.libs ] ) - , " , LIBPATH=[ %s ]" % ','.join( [ '"%s"' % path for path in scons_config.libpath ] ) - , " , CPPPATH=[ %s ]" % ','.join( [ '"%s"' % path for path in scons_config.include_dirs] ) - , " , CCFLAGS=[ %s ]" % ','.join( [ '"%s"' % flag for flag in scons.ccflags ] ) + , " , LIBS=[ %s ]" % ','.join( [ 'r"%s"' % lib for lib in scons_config.libs ] ) + , " , LIBPATH=[ %s ]" % ','.join( [ 'r"%s"' % path for path in scons_config.libpath ] ) + , " , CPPPATH=[ %s ]" % ','.join( [ 'r"%s"' % path for path in scons_config.include_dirs] ) + , " , CCFLAGS=[ %s ]" % ','.join( [ 'r"%s"' % flag for flag in scons.ccflags ] ) , " , SHLIBPREFIX=''" , " , SHLIBSUFFIX='%s'" % scons.suffix #explicit better then implicit , ")" ] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-28 09:16:12
|
Revision: 480 Author: roman_yakovenko Date: 2006-08-28 02:16:02 -0700 (Mon, 28 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=480&view=rev Log Message: ----------- adding new unit tests Modified Paths: -------------- pyplusplus_dev/unittests/test_all.py Added Paths: ----------- pyplusplus_dev/unittests/data/no_init_to_be_exported.hpp pyplusplus_dev/unittests/no_init_tester.py Added: pyplusplus_dev/unittests/data/no_init_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/no_init_to_be_exported.hpp (rev 0) +++ pyplusplus_dev/unittests/data/no_init_to_be_exported.hpp 2006-08-28 09:16:02 UTC (rev 480) @@ -0,0 +1,32 @@ +// Copyright 2004 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) + +#ifndef __no_init_to_be_exported_hpp__ +#define __no_init_to_be_exported_hpp__ + +#include "boost/shared_ptr.hpp" + +namespace no_init_ns{ + +class controller_i{ +public: + virtual ~controller_i() { } + virtual bool get_value(void) const = 0; + virtual void set_value(bool value) = 0; +}; + +inline int +get_value( const boost::shared_ptr< controller_i >& controller ){ + if( controller ){ + return controller->get_value() ? 1 : 0; + } + else{ + return -1; + } +} + +} + +#endif//__no_init_to_be_exported_hpp__ Added: pyplusplus_dev/unittests/no_init_tester.py =================================================================== --- pyplusplus_dev/unittests/no_init_tester.py (rev 0) +++ pyplusplus_dev/unittests/no_init_tester.py 2006-08-28 09:16:02 UTC (rev 480) @@ -0,0 +1,49 @@ +# Copyright 2004 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) + +import os +import sys +import unittest +import fundamental_tester_base + +class tester_t(fundamental_tester_base.fundamental_tester_base_t): + EXTENSION_NAME = 'no_init' + + def __init__( self, *args ): + fundamental_tester_base.fundamental_tester_base_t.__init__( + self + , tester_t.EXTENSION_NAME + , *args ) + + def create_py_controller( self, module ): + class py_controller_t( module.controller_i ): + def __init__( self ): + module.controller_i.__init__( self ) + self.value = True + + def get_value(self): + return self.value + + def set_value( self, v ): + self.value = v + return py_controller_t() + + def run_tests(self, module): + controller = self.create_py_controller( module ) + self.failUnless( 1 == module.get_value( controller ) ) + controller.set_value( False ) + self.failUnless( 0 == module.get_value( controller ) ) + self.failUnless( -1 == module.get_value( None ) ) + +def create_suite(): + suite = unittest.TestSuite() + suite.addTest( unittest.makeSuite(tester_t)) + return suite + +def run_suite(): + unittest.TextTestRunner(verbosity=2).run( create_suite() ) + +if __name__ == "__main__": + run_suite() Modified: pyplusplus_dev/unittests/test_all.py =================================================================== --- pyplusplus_dev/unittests/test_all.py 2006-08-27 20:45:41 UTC (rev 479) +++ pyplusplus_dev/unittests/test_all.py 2006-08-28 09:16:02 UTC (rev 480) @@ -21,7 +21,7 @@ import call_policies_tester import pointer_to_function_as_argument import operators_tester -import abstract_tester +import abstract_tester import statics_tester import regression1_tester import casting_tester @@ -59,9 +59,10 @@ import default_args_tester import unnamed_classes_tester import cppexceptions_tester +import no_init_tester -def create_suite(times): - testers = [ +def create_suite(times): + testers = [ algorithms_tester , module_body_tester , enums_tester @@ -114,9 +115,10 @@ , indexing_suites2_tester , unnamed_classes_tester , cppexceptions_tester + , no_init_tester ] - - main_suite = unittest.TestSuite() + + main_suite = unittest.TestSuite() for i in range( times ): for tester in testers: main_suite.addTest( tester.create_suite() ) @@ -134,5 +136,5 @@ except Exception, error: print str( error ) print 'first argument should be integer, it says how many times to run tests.' - - run_suite(times) \ No newline at end of file + + run_suite(times) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2006-08-27 20:45:49
|
Revision: 479 Author: allenb Date: 2006-08-27 13:45:41 -0700 (Sun, 27 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=479&view=rev Log Message: ----------- Fix mdecl override. Modified Paths: -------------- pyplusplus_dev/contrib/goodies/goodie_overrides.py Modified: pyplusplus_dev/contrib/goodies/goodie_overrides.py =================================================================== --- pyplusplus_dev/contrib/goodies/goodie_overrides.py 2006-08-27 18:49:18 UTC (rev 478) +++ pyplusplus_dev/contrib/goodies/goodie_overrides.py 2006-08-27 20:45:41 UTC (rev 479) @@ -10,8 +10,9 @@ # # --- Over ride the behavior of mdecl_wrapper ---- # -import pygccxml.declarations.mdecl_wrapper as mdecl_wrapper +import pygccxml.declarations pd = pygccxml.declarations +mdecl_wrapper = pd.mdecl_wrapper # Define the call redirector so it can return arguments # This method will now return multiple arguments by @@ -55,7 +56,7 @@ Else call the getitem method of the contained decls. """ if isinstance(index, (int, slice)): - return self.decls[index] + return self.declarations[index] else: return self.__getattr__("__getitem__")(index) mdecl_wrapper.mdecl_wrapper_t.__getitem__ = new_mdecl_wrapper_t__getitem__ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-27 18:49:43
|
Revision: 478 Author: roman_yakovenko Date: 2006-08-27 11:49:18 -0700 (Sun, 27 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=478&view=rev Log Message: ----------- adding type_alg_cache_t class and remove_aliase optimization Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/algorithms_cache.py pygccxml_dev/pygccxml/declarations/class_declaration.py pygccxml_dev/pygccxml/declarations/cpptypes.py pygccxml_dev/pygccxml/declarations/namespace.py pygccxml_dev/pygccxml/declarations/type_traits.py pygccxml_dev/pygccxml/parser/project_reader.py pygccxml_dev/pygccxml/parser/source_reader.py pygccxml_dev/unittests/data/typedefs1.hpp pygccxml_dev/unittests/data/typedefs2.hpp pygccxml_dev/unittests/data/typedefs_base.hpp Modified: pygccxml_dev/pygccxml/declarations/algorithms_cache.py =================================================================== --- pygccxml_dev/pygccxml/declarations/algorithms_cache.py 2006-08-27 06:52:22 UTC (rev 477) +++ pygccxml_dev/pygccxml/declarations/algorithms_cache.py 2006-08-27 18:49:18 UTC (rev 478) @@ -7,10 +7,15 @@ defines class that will keep results of different calculations. """ -class algorithms_cache_t( object ): + +class declaration_algs_cache_t( object ): def __init__( self ): object.__init__( self ) self._enabled = True + self._full_name = None + self._access_type = None + self._demangled_name = None + self._declaration_path = None def disable( self ): self._enabled = False @@ -22,44 +27,44 @@ def enabled( self ): return self._enabled -class declaration_algs_cache_t( algorithms_cache_t ): - def __init__( self ): - algorithms_cache_t.__init__( self ) - self._full_name = None - self._access_type = None - self._demangled_name = None - self._declaration_path = None + def _get_full_name( self ): + return self._full_name - def _get_full_name( self ): - if self.enabled: - return self._full_name - return None def _set_full_name( self, fname ): + if not self.enabled: + fname = None self._full_name = fname + full_name = property( _get_full_name, _set_full_name ) def _get_access_type( self ): - if self.enabled: - return self._access_type - return None + return self._access_type + def _set_access_type( self, access_type ): + if not self.enabled: + access_type = None self._access_type = access_type + access_type = property( _get_access_type, _set_access_type ) def _get_demangled_name( self ): - if self.enabled: - return self._demangled_name - return None + return self._demangled_name + def _set_demangled_name( self, demangled_name ): + if not self.enabled: + demangled_name = None self._demangled_name = demangled_name + demangled_name = property( _get_demangled_name, _set_demangled_name ) def _get_declaration_path( self ): - if self.enabled: - return self._declaration_path - return None + return self._declaration_path + def _set_declaration_path( self, declaration_path ): + if not self.enabled: + declaration_path = None self._declaration_path = declaration_path + declaration_path = property( _get_declaration_path, _set_declaration_path ) def reset( self ): @@ -76,17 +81,31 @@ def reset_access_type( self ): self.access_type = None -#Introducing next cache to the type broke unit test. I should find out why. -#~ class type_algs_cache_t( algorithms_cache_t ): - #~ def __init__( self ): - #~ algorithms_cache_t.__init__( self ) - #~ self._remove_alias = None +class type_algs_cache_t( object ): + enabled = True + + @staticmethod + def disable(): + type_algs_cache_t.enabled = False - #~ def _get_remove_alias( self ): - #~ if self.enabled: - #~ return self._remove_alias - #~ return None - #~ def _set_remove_alias( self, remove_alias ): - #~ self._remove_alias = remove_alias - #~ remove_alias = property( _get_remove_alias, _set_remove_alias ) + @staticmethod + def enable( self ): + type_algs_cache_t.enabled = True + def __init__( self ): + object.__init__( self ) + self._remove_alias = None + + def _get_remove_alias( self ): + return self._remove_alias + + def _set_remove_alias( self, remove_alias ): + if not type_algs_cache_t.enabled: + remove_alias = None + self._remove_alias = remove_alias + + remove_alias = property( _get_remove_alias, _set_remove_alias ) + + def reset(self): + self.remove_alias = None + \ No newline at end of file Modified: pygccxml_dev/pygccxml/declarations/class_declaration.py =================================================================== --- pygccxml_dev/pygccxml/declarations/class_declaration.py 2006-08-27 06:52:22 UTC (rev 477) +++ pygccxml_dev/pygccxml/declarations/class_declaration.py 2006-08-27 18:49:18 UTC (rev 478) @@ -284,6 +284,7 @@ else: raise RuntimeError( "Invalid access type: %s." % access ) decl.parent = self + decl.cache.reset() decl.cache.access_type = access def remove_declaration( self, decl ): @@ -302,7 +303,7 @@ else: #decl.cache.access_type == ACCESS_TYPES.PRVATE container = self.private_members del container[ container.index( decl ) ] - decl.cache.reset_access_type() + decl.cache.reset() def find_out_member_access_type( self, member ): """ Modified: pygccxml_dev/pygccxml/declarations/cpptypes.py =================================================================== --- pygccxml_dev/pygccxml/declarations/cpptypes.py 2006-08-27 06:52:22 UTC (rev 477) +++ pygccxml_dev/pygccxml/declarations/cpptypes.py 2006-08-27 18:49:18 UTC (rev 478) @@ -7,11 +7,14 @@ defines classes, that describe C++ types """ +import algorithms_cache + class type_t(object): """base class for all types""" def __init__(self): object.__init__( self ) - + self.cache = algorithms_cache.type_algs_cache_t() + def __str__(self): res = self.decl_string if res[:2]=="::": @@ -44,7 +47,6 @@ def clone( self ): "returns new instance of the type" answer = self._clone_impl() - assert answer return answer #There are cases when GCC-XML reports something like this @@ -578,7 +580,7 @@ return self._declaration.decl_string def _clone_impl( self ): - return declarated_t( self.declaration ) + return declarated_t( self._declaration ) class type_qualifiers_t( object ): """contains additional information about type: mutable, static, extern""" Modified: pygccxml_dev/pygccxml/declarations/namespace.py =================================================================== --- pygccxml_dev/pygccxml/declarations/namespace.py 2006-08-27 06:52:22 UTC (rev 477) +++ pygccxml_dev/pygccxml/declarations/namespace.py 2006-08-27 18:49:18 UTC (rev 478) @@ -51,6 +51,7 @@ def adopt_declaration( self, decl ): self.declarations.append( decl ) decl.parent = self + decl.cache.reset() def remove_declaration( self, decl ): """ @@ -60,6 +61,7 @@ @type decl: L{declaration_t} """ del self.declarations[ self.declarations.index( decl ) ] + decl.cache.reset() #add more comment about this. #if not keep_parent: # decl.parent=None Modified: pygccxml_dev/pygccxml/declarations/type_traits.py =================================================================== --- pygccxml_dev/pygccxml/declarations/type_traits.py 2006-08-27 06:52:22 UTC (rev 477) +++ pygccxml_dev/pygccxml/declarations/type_traits.py 2006-08-27 18:49:18 UTC (rev 478) @@ -41,12 +41,20 @@ def remove_alias(type_): """returns type without typedefs""" + type_ref = None if isinstance( type_, cpptypes.type_t ): - return __remove_alias( type_.clone() ) + type_ref = type_ elif isinstance( type_, typedef.typedef_t ): - return __remove_alias( type_.type.clone() ) + type_ref = type_.type else: + pass #not a valid input, just return it + if not type_ref: return type_ + if type_ref.cache.remove_alias: + return type_ref.cache.remove_alias + no_alias = __remove_alias( type_ref.clone() ) + type_ref.cache.remove_alias = no_alias + return no_alias def create_cv_types( base ): """implementation details""" Modified: pygccxml_dev/pygccxml/parser/project_reader.py =================================================================== --- pygccxml_dev/pygccxml/parser/project_reader.py 2006-08-27 06:52:22 UTC (rev 477) +++ pygccxml_dev/pygccxml/parser/project_reader.py 2006-08-27 18:49:18 UTC (rev 478) @@ -425,6 +425,9 @@ create_key = lambda decl:( decl.location.as_tuple() , tuple( pygccxml.declarations.declaration_path( decl ) ) ) for decl_wrapper_type in declarated_types: + #it is possible, that cache contains reference to dropped class + #We need to clear it + decl_wrapper_type.cache.reset() if isinstance( decl_wrapper_type.declaration, pygccxml.declarations.class_t ): key = create_key(decl_wrapper_type.declaration) if leaved_classes.has_key( key ): Modified: pygccxml_dev/pygccxml/parser/source_reader.py =================================================================== --- pygccxml_dev/pygccxml/parser/source_reader.py 2006-08-27 06:52:22 UTC (rev 477) +++ pygccxml_dev/pygccxml/parser/source_reader.py 2006-08-27 18:49:18 UTC (rev 478) @@ -29,9 +29,8 @@ @return: None """ visited = set() - for decl in decls: - if not isinstance( decl, typedef_t ): - continue + typedefs = filter( lambda decl: isinstance( decl, typedef_t ), decls ) + for decl in typedefs: type_ = remove_alias( decl.type ) if not isinstance( type_, declarated_t ): continue Modified: pygccxml_dev/unittests/data/typedefs1.hpp =================================================================== --- pygccxml_dev/unittests/data/typedefs1.hpp 2006-08-27 06:52:22 UTC (rev 477) +++ pygccxml_dev/unittests/data/typedefs1.hpp 2006-08-27 18:49:18 UTC (rev 478) @@ -1,17 +1,17 @@ -// Copyright 2004 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) - -#ifndef __typedefs1_hpp__ -#define __typedefs1_hpp__ - -#include "typedefs_base.hpp" - -namespace typedefs{ - -typedef item_t Item1; - -} - +// Copyright 2004 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) + +#ifndef __typedefs1_hpp__ +#define __typedefs1_hpp__ + +#include "typedefs_base.hpp" + +namespace typedefs{ + +typedef item_t Item1; + +} + #endif//__typedefs1_hpp__ \ No newline at end of file Modified: pygccxml_dev/unittests/data/typedefs2.hpp =================================================================== --- pygccxml_dev/unittests/data/typedefs2.hpp 2006-08-27 06:52:22 UTC (rev 477) +++ pygccxml_dev/unittests/data/typedefs2.hpp 2006-08-27 18:49:18 UTC (rev 478) @@ -1,17 +1,17 @@ -// Copyright 2004 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) - -#ifndef __typedefs2_hpp__ -#define __typedefs2_hpp__ - -#include "typedefs_base.hpp" - -namespace typedefs{ - -typedef item_t Item2; - -} - +// Copyright 2004 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) + +#ifndef __typedefs2_hpp__ +#define __typedefs2_hpp__ + +#include "typedefs_base.hpp" + +namespace typedefs{ + +typedef item_t Item2; + +} + #endif//__typedefs2_hpp__ \ No newline at end of file Modified: pygccxml_dev/unittests/data/typedefs_base.hpp =================================================================== --- pygccxml_dev/unittests/data/typedefs_base.hpp 2006-08-27 06:52:22 UTC (rev 477) +++ pygccxml_dev/unittests/data/typedefs_base.hpp 2006-08-27 18:49:18 UTC (rev 478) @@ -1,18 +1,17 @@ -// Copyright 2004 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) - -#ifndef __typedefs_hpp__ -#define __typedefs_hpp__ - -namespace typedefs{ - -struct item_t{}; - -typedef item_t Item; - -} - -#endif//__typedefs_hpp__ - +// Copyright 2004 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) + +#ifndef __typedefs_hpp__ +#define __typedefs_hpp__ + +namespace typedefs{ + +struct item_t{}; + +typedef item_t Item; + +} + +#endif//__typedefs_hpp__ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-27 06:52:42
|
Revision: 477 Author: roman_yakovenko Date: 2006-08-26 23:52:22 -0700 (Sat, 26 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=477&view=rev Log Message: ----------- adding unit tests for algorithms cache Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/algorithm.py pygccxml_dev/pygccxml/declarations/algorithms_cache.py pygccxml_dev/pygccxml/declarations/class_declaration.py pygccxml_dev/pygccxml/declarations/declaration.py pygccxml_dev/pygccxml/utils/__init__.py pygccxml_dev/unittests/test_all.py Added Paths: ----------- pygccxml_dev/unittests/algorithms_cache_tester.py Modified: pygccxml_dev/pygccxml/declarations/algorithm.py =================================================================== --- pygccxml_dev/pygccxml/declarations/algorithm.py 2006-08-26 18:27:22 UTC (rev 476) +++ pygccxml_dev/pygccxml/declarations/algorithm.py 2006-08-27 06:52:22 UTC (rev 477) @@ -10,16 +10,19 @@ def declaration_path( decl ): """ returns a list of parent declarations names - + @param decl: declaration for which declaration path should be calculated @type decl: L{declaration_t} - - @return: [names], where first item contains top parent name and last item + + @return: [names], where first item contains top parent name and last item contains decl name """ + #TODO: + #If parent declaration cache already has declaration_path, reuse it for + #calculation. if not decl: return [] - if not decl.cache.declaration_path: + if not decl.cache.declaration_path: result = [ decl.name ] parent = decl.parent while parent: @@ -27,27 +30,32 @@ parent = parent.parent result.reverse() decl.cache.declaration_path = result - return decl.cache.declaration_path + return result + else: + return decl.cache.declaration_path def full_name( decl ): """ returns full name of the declaration - @param decl: declaration for which full name should be calculated. If decl + @param decl: declaration for which full name should be calculated. If decl belongs to unnamed namespace, then L{full_name} is not valid C++ full name. - + @type decl: L{declaration_t} - @return: full name of declarations. + @return: full name of declarations. """ if None is decl: raise RuntimeError( "Unable to generate full name for None object!" ) if not decl.cache.full_name: decl_path = declaration_path( decl ) - ##Here I have lack of knowledge: + ##Here I have lack of knowledge: ##TODO: "What is the full name of declaration declared in unnamed namespace?" result = filter( None, decl_path ) - decl.cache.full_name = result[0] + '::'.join( result[1:] ) - return decl.cache.full_name + result = result[0] + '::'.join( result[1:] ) + decl.cache.full_name = result + return result + else: + return decl.cache.full_name def make_flatten( decl_or_decls ): @@ -56,7 +64,7 @@ @param decl_or_decls: reference to list of declaration's or single declaration @type decl_or_decls: L{declaration_t} or [ L{declaration_t} ] - + @return: [ all internal declarations ] """ import pygccxml.declarations #prevent cyclic import @@ -78,7 +86,7 @@ decls.append( decl_or_decls ) answer = [] for decl in decls: - answer.extend( proceed_single( decl ) ) + answer.extend( proceed_single( decl ) ) return answer def __make_flatten_generator( decl_or_decls ): @@ -87,10 +95,10 @@ @param decl_or_decls: reference to list of declaration's or single declaration @type decl_or_decls: L{declaration_t} or [ L{declaration_t} ] - + @return: [ all internal declarations ] """ - + import pygccxml.declarations def proceed_single( decl ): yield decl @@ -113,24 +121,24 @@ def get_global_namespace(decls): import pygccxml.declarations - found = filter( lambda decl: decl.name == '::' + found = filter( lambda decl: decl.name == '::' and isinstance( decl, pygccxml.declarations.namespace_t ) , make_flatten( decls ) ) if len( found ) == 1: return found[0] raise RuntimeError( "Unable to find global namespace." ) - + class match_declaration_t: """ - helper class for different search algorithms. - + helper class for different search algorithms. + This class will help developer to match declaration by: - declaration type, for example L{class_t} or L{operator_t}. - declaration name - declaration full name - reference to parent declaration """ - + def __init__( self, type=None, name=None, fullname=None, parent=None ): self.type = type self.name = name @@ -140,10 +148,10 @@ def does_match_exist(self, inst): """ returns True if inst do match one of specified criteria - + @param inst: declaration instance @type inst: L{declaration_t} - + @return: bool """ answer = True @@ -169,12 +177,12 @@ , name=None , parent=None , recursive=True - , fullname=None ): + , fullname=None ): """ returns a list of all declarations that match criteria, defined by developer - + For more information about arguments see L{match_declaration_t} class. - + @return: [ matched declarations ] """ decls = [] @@ -192,13 +200,13 @@ , recursive=True , fullname=None ): """ - returns single declaration that match criteria, defined by developer. + returns single declaration that match criteria, defined by developer. If more the one declaration was found None will be returned. - + For more information about arguments see L{match_declaration_t} class. - + @return: matched declaration L{declaration_t} or None - """ + """ decl = find_all_declarations( declarations, type=type, name=name, parent=parent, recursive=recursive, fullname=fullname ) if len( decl ) == 1: return decl[0] @@ -206,31 +214,31 @@ def find_first_declaration( declarations, type=None, name=None, parent=None, recursive=True, fullname=None ): """ returns first declaration that match criteria, defined by developer - + For more information about arguments see L{match_declaration_t} class. - + @return: matched declaration L{declaration_t} or None """ matcher = match_declaration_t(type, name, fullname, parent) if recursive: decls = make_flatten( declarations ) else: - decls = declarations + decls = declarations for decl in decls: if matcher( decl ): return decl return None - + def declaration_files(decl_or_decls): """ returns set of files - + Every declaration is declared in some file. This function returns set, that contains all file names of declarations. - + @param decl_or_decls: reference to list of declaration's or single declaration @type decl_or_decls: L{declaration_t} or [ L{declaration_t} ] - + @return: set( declaration file names ) """ files = set() @@ -242,9 +250,9 @@ class visit_function_has_not_been_found_t( RuntimeError ): """ - exception that is raised, from L{apply_visitor}, when a visitor could not be + exception that is raised, from L{apply_visitor}, when a visitor could not be applied. - + """ def __init__( self, visitor, decl_inst ): RuntimeError.__init__( self ) @@ -257,7 +265,7 @@ def apply_visitor( visitor, decl_inst): """ applies a visitor on declaration instance - + @param visitor: instance @type visitor: L{type_visitor_t} or L{decl_visitor_t} """ Modified: pygccxml_dev/pygccxml/declarations/algorithms_cache.py =================================================================== --- pygccxml_dev/pygccxml/declarations/algorithms_cache.py 2006-08-26 18:27:22 UTC (rev 476) +++ pygccxml_dev/pygccxml/declarations/algorithms_cache.py 2006-08-27 06:52:22 UTC (rev 477) @@ -10,24 +10,83 @@ class algorithms_cache_t( object ): def __init__( self ): object.__init__( self ) - self.full_name = None - self.access_type = None - self.declaration_path = None - + self._enabled = True + + def disable( self ): + self._enabled = False + + def enable( self ): + self._enabled = True + + @property + def enabled( self ): + return self._enabled + +class declaration_algs_cache_t( algorithms_cache_t ): + def __init__( self ): + algorithms_cache_t.__init__( self ) + self._full_name = None + self._access_type = None + self._demangled_name = None + self._declaration_path = None + + def _get_full_name( self ): + if self.enabled: + return self._full_name + return None + def _set_full_name( self, fname ): + self._full_name = fname + full_name = property( _get_full_name, _set_full_name ) + + def _get_access_type( self ): + if self.enabled: + return self._access_type + return None + def _set_access_type( self, access_type ): + self._access_type = access_type + access_type = property( _get_access_type, _set_access_type ) + + def _get_demangled_name( self ): + if self.enabled: + return self._demangled_name + return None + def _set_demangled_name( self, demangled_name ): + self._demangled_name = demangled_name + demangled_name = property( _get_demangled_name, _set_demangled_name ) + + def _get_declaration_path( self ): + if self.enabled: + return self._declaration_path + return None + def _set_declaration_path( self, declaration_path ): + self._declaration_path = declaration_path + declaration_path = property( _get_declaration_path, _set_declaration_path ) + def reset( self ): self.full_name = None self.access_type = None + self.demangled_name = None self.declaration_path = None def reset_name_based( self ): self.full_name = None + self.demangled_name = None self.declaration_path = None - + def reset_access_type( self ): self.access_type = None - -class type_traits_cache_t( object ): - def __init__( self ): - object.__init__( self ) - self.remove_alias = None - + +#Introducing next cache to the type broke unit test. I should find out why. +#~ class type_algs_cache_t( algorithms_cache_t ): + #~ def __init__( self ): + #~ algorithms_cache_t.__init__( self ) + #~ self._remove_alias = None + + #~ def _get_remove_alias( self ): + #~ if self.enabled: + #~ return self._remove_alias + #~ return None + #~ def _set_remove_alias( self, remove_alias ): + #~ self._remove_alias = remove_alias + #~ remove_alias = property( _get_remove_alias, _set_remove_alias ) + Modified: pygccxml_dev/pygccxml/declarations/class_declaration.py =================================================================== --- pygccxml_dev/pygccxml/declarations/class_declaration.py 2006-08-26 18:27:22 UTC (rev 476) +++ pygccxml_dev/pygccxml/declarations/class_declaration.py 2006-08-27 06:52:22 UTC (rev 477) @@ -101,13 +101,12 @@ self._private_members = [] self._protected_members = [] self._aliases = [] - self.__cached_demangled_name = None # Cached value of name from get_name_impl def _get_name_impl( self ): if not self._name: #class with empty name return self._name elif class_t.USE_DEMANGLED_AS_NAME and self.demangled: - if not self.__cached_demangled_name: + if not self.cache.demangled_name: fname = algorithm.full_name( self.parent ) if fname.startswith( '::' ) and not self.demangled.startswith( '::' ): fname = fname[2:] @@ -115,10 +114,13 @@ tmp = self.demangled[ len( fname ): ] #demangled::name if tmp.startswith( '::' ): tmp = tmp[2:] - self.__cached_demangled_name = tmp + self.cache.demangled_name = tmp + return tmp else: - self.__cached_demangled_name = self._name - return self.__cached_demangled_name + self.cache.demangled_name = self._name + return self._name + else: + return self.cache.demangled_name else: return self._name @@ -301,7 +303,7 @@ container = self.private_members del container[ container.index( decl ) ] decl.cache.reset_access_type() - + def find_out_member_access_type( self, member ): """ returns member access type @@ -311,16 +313,19 @@ @return: L{ACCESS_TYPES} """ - assert member.parent is self + assert member.parent is self if not member.cache.access_type: access_type = None if member in self.public_members: - member.cache.access_type = ACCESS_TYPES.PUBLIC + access_type = ACCESS_TYPES.PUBLIC elif member in self.protected_members: - member.cache.access_type = ACCESS_TYPES.PROTECTED + access_type = ACCESS_TYPES.PROTECTED elif member in self.private_members: - member.cache.access_type = ACCESS_TYPES.PRIVATE + access_type = ACCESS_TYPES.PRIVATE else: raise RuntimeError( "Unable to find member within internal members list." ) - return member.cache.access_type - + member.cache.access_type = access_type + return access_type + else: + return member.cache.access_type + Modified: pygccxml_dev/pygccxml/declarations/declaration.py =================================================================== --- pygccxml_dev/pygccxml/declarations/declaration.py 2006-08-26 18:27:22 UTC (rev 476) +++ pygccxml_dev/pygccxml/declarations/declaration.py 2006-08-27 06:52:22 UTC (rev 477) @@ -75,7 +75,7 @@ self._mangled = mangled self._demangled = demangled self._parent = None - self._cache = algorithms_cache.algorithms_cache_t() + self._cache = algorithms_cache.declaration_algs_cache_t() def __str__(self): """Default __str__ method. @@ -164,9 +164,10 @@ def _set_name( self, new_name ): previous_name = self._name self._name = new_name + self.cache.reset_name_based() if previous_name: #the was a rename and not initial "set" self._on_rename() - + name = property( _get_name, _set_name , doc="""Declaration name @type: str @@ -248,4 +249,4 @@ reference to instance of L{algorithms_cache.algorithms_cache_t} class. """ - return self._cache \ No newline at end of file + return self._cache Modified: pygccxml_dev/pygccxml/utils/__init__.py =================================================================== --- pygccxml_dev/pygccxml/utils/__init__.py 2006-08-26 18:27:22 UTC (rev 476) +++ pygccxml_dev/pygccxml/utils/__init__.py 2006-08-27 06:52:22 UTC (rev 477) @@ -13,44 +13,44 @@ import logging import tempfile -def _create_logger_( name ): +def _create_logger_( name ): """implementation details""" logger = logging.getLogger(name) handler = logging.StreamHandler(sys.stdout) handler.setFormatter( logging.Formatter( os.linesep + '%(levelname)s %(message)s' ) ) - logger.addHandler(handler) + logger.addHandler(handler) logger.setLevel(logging.INFO) return logger class loggers: """class-namespace, defines few loggers classes, used in the project""" - gccxml = _create_logger_( 'pygccxml.gccxml' ) + gccxml = _create_logger_( 'pygccxml.gccxml' ) """logger for gccxml functionality - + If you set this logger level to DEBUG, you will be able to see the exact command line, used to invoke GCC-XML and errors that occures during XML parsing """ - + queries_engine = _create_logger_( 'pygccxml.queries_engine' ) """logger for query engine functionality. - + If you set this logger level to DEBUG, you will be able to see what queries you do against declarations tree, measure performance and may be even to improve it. Query engine reports queries and whether they are optimized or not. """ - + declarations_cache = _create_logger_( 'pygccxml.declarations_cache' ) """logger for declarations tree cache functionality - + If you set this logger level to DEBUG, you will be able to see what is exactly - happens, when you read the declarations from cache file. You will be able to + happens, when you read the declarations from cache file. You will be able to decide, whether it worse for you to use this or that cache strategy. """ - + root = logging.getLogger( 'pygccxml' ) """root logger exists for your convinience only""" - + all = [ root, gccxml, queries_engine, declarations_cache ] """contains all logger classes, defined by the class""" @@ -60,12 +60,12 @@ if os.path.exists(file_name): os.remove( file_name ) except Exception, error: - loggers.root.error( "Error ocured while removing temprorary created file('%s'): %s" + loggers.root.error( "Error ocured while removing temprorary created file('%s'): %s" % ( file_name, str( error ) ) ) -def create_temp_file_name(suffix, prefix=None, dir=None): +def create_temp_file_name(suffix, prefix=None, dir=None): """small convinience function that creates temporal file. - + This function is a wrapper aroung Python built-in function - tempfile.mkstemp """ if not prefix: @@ -79,9 +79,9 @@ """return os.path.normpath( os.path.normcase( some_path ) )""" return os.path.normpath( os.path.normcase( some_path ) ) -def get_architecture(): +def get_architecture(): """returns computer architecture: 32 or 64. - + The guess is based on maxint. """ if sys.maxint == 2147483647: @@ -89,4 +89,5 @@ elif sys.maxint == 9223372036854775807: return 64 else: - raise RuntimeError( "Unknown architecture" ) \ No newline at end of file + raise RuntimeError( "Unknown architecture" ) + Added: pygccxml_dev/unittests/algorithms_cache_tester.py =================================================================== --- pygccxml_dev/unittests/algorithms_cache_tester.py (rev 0) +++ pygccxml_dev/unittests/algorithms_cache_tester.py 2006-08-27 06:52:22 UTC (rev 477) @@ -0,0 +1,75 @@ +# Copyright 2004 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) + +import unittest +import autoconfig +import parser_test_case + +from pygccxml import utils +from pygccxml import parser +from pygccxml import declarations + +class algorithms_cache_tester_t( parser_test_case.parser_test_case_t ): + #tester source reader + COMPILATION_MODE = parser.COMPILATION_MODE.ALL_AT_ONCE + def __init__(self, *args ): + parser_test_case.parser_test_case_t.__init__( self, *args ) + self.header = 'core_membership.hpp' + self.global_ns = None + + def setUp(self): + decls = parser.parse( [self.header], self.config ) + self.global_ns = declarations.get_global_namespace( decls ) + + def test_name_based( self ): + cls = self.global_ns.class_( name='class_for_nested_enums_t' ) + + cls_demangled_name = cls.name + self.failUnless( cls.cache.demangled_name == cls_demangled_name ) + + cls_full_name = declarations.full_name( cls ) + self.failUnless( cls.cache.full_name == cls_full_name ) + + cls_declaration_path = declarations.declaration_path( cls ) + self.failUnless( cls.cache.declaration_path == cls_declaration_path ) + + enum = cls.enum( 'ENestedPublic' ) + + enum_full_name = declarations.full_name( enum ) + self.failUnless( enum.cache.full_name == enum_full_name ) + + enum_declaration_path = declarations.declaration_path( enum ) + self.failUnless( enum.cache.declaration_path == enum_declaration_path ) + + #now we change class name, all internal decls cache should be cleared + cls.name = "new_name" + self.failUnless( not cls.cache.full_name ) + self.failUnless( not cls.cache.demangled_name ) + self.failUnless( not cls.cache.declaration_path ) + + self.failUnless( not enum.cache.full_name ) + self.failUnless( not enum.cache.demangled_name ) + self.failUnless( not enum.cache.declaration_path ) + + def test_access_type( self ): + cls = self.global_ns.class_( name='class_for_nested_enums_t' ) + enum = cls.enum( 'ENestedPublic' ) + self.failUnless( enum.cache.access_type == 'public' ) + enum.cache.reset_access_type() + self.failUnless( not enum.cache.access_type ) + self.failUnless( 'public' == cls.find_out_member_access_type( enum ) ) + self.failUnless( enum.cache.access_type == 'public' ) + +def create_suite(): + suite = unittest.TestSuite() + suite.addTest( unittest.makeSuite(algorithms_cache_tester_t)) + + return suite + +def run_suite(): + unittest.TextTestRunner(verbosity=2).run( create_suite() ) + +if __name__ == "__main__": + run_suite() Modified: pygccxml_dev/unittests/test_all.py =================================================================== --- pygccxml_dev/unittests/test_all.py 2006-08-26 18:27:22 UTC (rev 476) +++ pygccxml_dev/unittests/test_all.py 2006-08-27 06:52:22 UTC (rev 477) @@ -17,7 +17,7 @@ import type_traits_tester import core_tester import xmlfile_reader_tester -import filtering_tester +import filtering_tester import text_reader_tester import hierarchy_traveling import patcher_tester @@ -31,16 +31,17 @@ import filters_tester import cache_enums_tester import decl_printer_tester -import typedefs_tester +import typedefs_tester import demangled_tester import unnamed_enums_bug_tester import vector_traits_tester import string_traits_tester import declarations_cache_tester import has_binary_operator_traits_tester +import algorithms_cache_tester def create_suite(): - testers = [ + testers = [ decl_string_tester , declaration_files_tester , declarations_comparison_tester @@ -75,14 +76,15 @@ , string_traits_tester , declarations_cache_tester , has_binary_operator_traits_tester + , algorithms_cache_tester ] - - main_suite = unittest.TestSuite() + + main_suite = unittest.TestSuite() for tester in testers: main_suite.addTest( tester.create_suite() ) return main_suite - + def run_suite(): result = unittest.TextTestRunner(verbosity=2).run( create_suite() ) error_desc = 'EXCEPTION IN SAFE SELECT 9' @@ -104,4 +106,4 @@ ##~ statistics = hotshot.stats.load( statistics_file ) ##~ statistics.strip_dirs() ##~ statistics.sort_stats( 'time', 'calls' ) -##~ statistics.print_stats( 678 ) \ No newline at end of file +##~ statistics.print_stats( 678 ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-26 18:27:38
|
Revision: 476 Author: roman_yakovenko Date: 2006-08-26 11:27:22 -0700 (Sat, 26 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=476&view=rev Log Message: ----------- adding unit tests for gccxml that runs on Linux AMD64 architecture Modified Paths: -------------- pygccxml_dev/unittests/demangled_tester.py pyplusplus_dev/examples/pyboost_dev/dev/date_time/sconscript Added Paths: ----------- pygccxml_dev/unittests/data/demangled_tester_64bit.xml Added: pygccxml_dev/unittests/data/demangled_tester_64bit.xml =================================================================== --- pygccxml_dev/unittests/data/demangled_tester_64bit.xml (rev 0) +++ pygccxml_dev/unittests/data/demangled_tester_64bit.xml 2006-08-26 18:27:22 UTC (rev 476) @@ -0,0 +1,424 @@ +<?xml version="1.0"?> +<GCC_XML cvs_revision="1.113"> + <Namespace id="_1" name="::" members="_3 _4 _5 _6 _7 _8 _9 _10 _11 _12 _13 _14 _15 _16 _17 _18 _19 _20 _21 _22 _23 _24 _25 _26 _27 _28 _29 _30 _31 _32 _33 _34 _35 _36 _37 _38 _39 _40 _41 _42 _43 _44 _45 _46 _47 _48 _49 _50 _51 _52 _53 _54 _55 _56 _57 _58 _59 _60 _61 _62 _63 _64 _65 _66 _67 _68 _69 _70 _71 _72 _73 _74 _75 _76 _77 _78 _79 _80 _81 _82 _83 _84 _85 _86 _87 _88 _89 _90 _91 _92 _93 _94 _95 _96 _97 _98 _99 _100 _101 _102 _103 _104 _105 _106 _107 _108 _109 _110 _111 _112 _113 _114 _115 _116 _117 _118 _119 _120 _121 _122 " mangled="_Z2::" demangled="::"/> + <Namespace id="_2" name="std" context="_1" members="" mangled="_Z3std" demangled="std"/> + <Function id="_3" name="__builtin_cpowl" returns="_123" context="_1" location="f0:131" file="f0" line="131" extern="1"> + <Argument type="_123" location="f0:131" file="f0" line="131"/> + <Argument type="_123" location="f0:131" file="f0" line="131"/> + </Function> + <Function id="_4" name="__builtin_cpow" returns="_124" context="_1" location="f0:130" file="f0" line="130" extern="1"> + <Argument type="_124" location="f0:130" file="f0" line="130"/> + <Argument type="_124" location="f0:130" file="f0" line="130"/> + </Function> + <Function id="_5" name="__builtin_cpowf" returns="_125" context="_1" location="f0:129" file="f0" line="129" extern="1"> + <Argument type="_125" location="f0:129" file="f0" line="129"/> + <Argument type="_125" location="f0:129" file="f0" line="129"/> + </Function> + <Function id="_6" name="__builtin_ctanhl" returns="_123" context="_1" location="f0:128" file="f0" line="128" extern="1"> + <Argument type="_123" location="f0:128" file="f0" line="128"/> + </Function> + <Function id="_7" name="__builtin_ctanh" returns="_124" context="_1" location="f0:127" file="f0" line="127" extern="1"> + <Argument type="_124" location="f0:127" file="f0" line="127"/> + </Function> + <Function id="_8" name="__builtin_ctanhf" returns="_125" context="_1" location="f0:126" file="f0" line="126" extern="1"> + <Argument type="_125" location="f0:126" file="f0" line="126"/> + </Function> + <Function id="_9" name="__builtin_ctanl" returns="_123" context="_1" location="f0:125" file="f0" line="125" extern="1"> + <Argument type="_123" location="f0:125" file="f0" line="125"/> + </Function> + <Function id="_10" name="__builtin_ctan" returns="_124" context="_1" location="f0:124" file="f0" line="124" extern="1"> + <Argument type="_124" location="f0:124" file="f0" line="124"/> + </Function> + <Function id="_11" name="__builtin_ctanf" returns="_125" context="_1" location="f0:123" file="f0" line="123" extern="1"> + <Argument type="_125" location="f0:123" file="f0" line="123"/> + </Function> + <Function id="_12" name="__builtin_csqrtl" returns="_123" context="_1" location="f0:122" file="f0" line="122" extern="1"> + <Argument type="_123" location="f0:122" file="f0" line="122"/> + </Function> + <Function id="_13" name="__builtin_csqrt" returns="_124" context="_1" location="f0:121" file="f0" line="121" extern="1"> + <Argument type="_124" location="f0:121" file="f0" line="121"/> + </Function> + <Function id="_14" name="__builtin_csqrtf" returns="_125" context="_1" location="f0:120" file="f0" line="120" extern="1"> + <Argument type="_125" location="f0:120" file="f0" line="120"/> + </Function> + <Function id="_15" name="__builtin_csinhl" returns="_123" context="_1" location="f0:119" file="f0" line="119" extern="1"> + <Argument type="_123" location="f0:119" file="f0" line="119"/> + </Function> + <Function id="_16" name="__builtin_csinh" returns="_124" context="_1" location="f0:118" file="f0" line="118" extern="1"> + <Argument type="_124" location="f0:118" file="f0" line="118"/> + </Function> + <Function id="_17" name="__builtin_csinhf" returns="_125" context="_1" location="f0:117" file="f0" line="117" extern="1"> + <Argument type="_125" location="f0:117" file="f0" line="117"/> + </Function> + <Function id="_18" name="__builtin_csinl" returns="_123" context="_1" location="f0:116" file="f0" line="116" extern="1"> + <Argument type="_123" location="f0:116" file="f0" line="116"/> + </Function> + <Function id="_19" name="__builtin_csin" returns="_124" context="_1" location="f0:115" file="f0" line="115" extern="1"> + <Argument type="_124" location="f0:115" file="f0" line="115"/> + </Function> + <Function id="_20" name="__builtin_csinf" returns="_125" context="_1" location="f0:114" file="f0" line="114" extern="1"> + <Argument type="_125" location="f0:114" file="f0" line="114"/> + </Function> + <Function id="_21" name="__builtin_clogl" returns="_123" context="_1" location="f0:113" file="f0" line="113" extern="1"> + <Argument type="_123" location="f0:113" file="f0" line="113"/> + </Function> + <Function id="_22" name="__builtin_clog" returns="_124" context="_1" location="f0:112" file="f0" line="112" extern="1"> + <Argument type="_124" location="f0:112" file="f0" line="112"/> + </Function> + <Function id="_23" name="__builtin_clogf" returns="_125" context="_1" location="f0:111" file="f0" line="111" extern="1"> + <Argument type="_125" location="f0:111" file="f0" line="111"/> + </Function> + <Function id="_24" name="__builtin_cexpl" returns="_123" context="_1" location="f0:110" file="f0" line="110" extern="1"> + <Argument type="_123" location="f0:110" file="f0" line="110"/> + </Function> + <Function id="_25" name="__builtin_cexp" returns="_124" context="_1" location="f0:109" file="f0" line="109" extern="1"> + <Argument type="_124" location="f0:109" file="f0" line="109"/> + </Function> + <Function id="_26" name="__builtin_cexpf" returns="_125" context="_1" location="f0:108" file="f0" line="108" extern="1"> + <Argument type="_125" location="f0:108" file="f0" line="108"/> + </Function> + <Function id="_27" name="__builtin_ccoshl" returns="_123" context="_1" location="f0:107" file="f0" line="107" extern="1"> + <Argument type="_123" location="f0:107" file="f0" line="107"/> + </Function> + <Function id="_28" name="__builtin_ccosh" returns="_124" context="_1" location="f0:106" file="f0" line="106" extern="1"> + <Argument type="_124" location="f0:106" file="f0" line="106"/> + </Function> + <Function id="_29" name="__builtin_ccoshf" returns="_125" context="_1" location="f0:105" file="f0" line="105" extern="1"> + <Argument type="_125" location="f0:105" file="f0" line="105"/> + </Function> + <Function id="_30" name="__builtin_ccosl" returns="_123" context="_1" location="f0:104" file="f0" line="104" extern="1"> + <Argument type="_123" location="f0:104" file="f0" line="104"/> + </Function> + <Function id="_31" name="__builtin_ccos" returns="_124" context="_1" location="f0:103" file="f0" line="103" extern="1"> + <Argument type="_124" location="f0:103" file="f0" line="103"/> + </Function> + <Function id="_32" name="__builtin_ccosf" returns="_125" context="_1" location="f0:102" file="f0" line="102" extern="1"> + <Argument type="_125" location="f0:102" file="f0" line="102"/> + </Function> + <Function id="_33" name="__builtin_popcountll" returns="_126" context="_1" location="f0:101" file="f0" line="101" extern="1"> + <Argument type="_127" location="f0:101" file="f0" line="101"/> + </Function> + <Function id="_34" name="__builtin_popcountl" returns="_126" context="_1" location="f0:100" file="f0" line="100" extern="1"> + <Argument type="_128" location="f0:100" file="f0" line="100"/> + </Function> + <Function id="_35" name="__builtin_popcount" returns="_126" context="_1" location="f0:99" file="f0" line="99" extern="1"> + <Argument type="_126" location="f0:99" file="f0" line="99"/> + </Function> + <Function id="_36" name="__builtin_ctzll" returns="_126" context="_1" location="f0:98" file="f0" line="98" extern="1"> + <Argument type="_127" location="f0:98" file="f0" line="98"/> + </Function> + <Function id="_37" name="__builtin_ctzl" returns="_126" context="_1" location="f0:97" file="f0" line="97" extern="1"> + <Argument type="_128" location="f0:97" file="f0" line="97"/> + </Function> + <Function id="_38" name="__builtin_ctz" returns="_126" context="_1" location="f0:96" file="f0" line="96" extern="1"> + <Argument type="_126" location="f0:96" file="f0" line="96"/> + </Function> + <Function id="_39" name="__builtin_cargl" returns="_129" context="_1" location="f0:95" file="f0" line="95" extern="1"> + <Argument type="_123" location="f0:95" file="f0" line="95"/> + </Function> + <Function id="_40" name="__builtin_carg" returns="_130" context="_1" location="f0:94" file="f0" line="94" extern="1"> + <Argument type="_124" location="f0:94" file="f0" line="94"/> + </Function> + <Function id="_41" name="__builtin_cargf" returns="_131" context="_1" location="f0:93" file="f0" line="93" extern="1"> + <Argument type="_125" location="f0:93" file="f0" line="93"/> + </Function> + <Function id="_42" name="__builtin_cabsl" returns="_129" context="_1" location="f0:92" file="f0" line="92" extern="1"> + <Argument type="_123" location="f0:92" file="f0" line="92"/> + </Function> + <Function id="_43" name="__builtin_cabs" returns="_130" context="_1" location="f0:91" file="f0" line="91" extern="1"> + <Argument type="_124" location="f0:91" file="f0" line="91"/> + </Function> + <Function id="_44" name="__builtin_cabsf" returns="_131" context="_1" location="f0:90" file="f0" line="90" extern="1"> + <Argument type="_125" location="f0:90" file="f0" line="90"/> + </Function> + <Function id="_45" name="__builtin_tanl" returns="_129" context="_1" location="f0:89" file="f0" line="89" extern="1"> + <Argument type="_129" location="f0:89" file="f0" line="89"/> + </Function> + <Function id="_46" name="__builtin_tanhl" returns="_129" context="_1" location="f0:88" file="f0" line="88" extern="1"> + <Argument type="_129" location="f0:88" file="f0" line="88"/> + </Function> + <Function id="_47" name="__builtin_tanhf" returns="_131" context="_1" location="f0:87" file="f0" line="87" extern="1"> + <Argument type="_131" location="f0:87" file="f0" line="87"/> + </Function> + <Function id="_48" name="__builtin_tanh" returns="_130" context="_1" location="f0:86" file="f0" line="86" extern="1"> + <Argument type="_130" location="f0:86" file="f0" line="86"/> + </Function> + <Function id="_49" name="__builtin_tanf" returns="_131" context="_1" location="f0:85" file="f0" line="85" extern="1"> + <Argument type="_131" location="f0:85" file="f0" line="85"/> + </Function> + <Function id="_50" name="__builtin_tan" returns="_130" context="_1" location="f0:84" file="f0" line="84" extern="1"> + <Argument type="_130" location="f0:84" file="f0" line="84"/> + </Function> + <Function id="_51" name="__builtin_sinhl" returns="_129" context="_1" location="f0:79" file="f0" line="79" extern="1"> + <Argument type="_129" location="f0:79" file="f0" line="79"/> + </Function> + <Function id="_52" name="__builtin_sinhf" returns="_131" context="_1" location="f0:78" file="f0" line="78" extern="1"> + <Argument type="_131" location="f0:78" file="f0" line="78"/> + </Function> + <Function id="_53" name="__builtin_sinh" returns="_130" context="_1" location="f0:77" file="f0" line="77" extern="1"> + <Argument type="_130" location="f0:77" file="f0" line="77"/> + </Function> + <Function id="_54" name="__builtin_powil" returns="_129" context="_1" location="f0:74" file="f0" line="74" extern="1"> + <Argument type="_129" location="f0:74" file="f0" line="74"/> + <Argument type="_126" location="f0:74" file="f0" line="74"/> + </Function> + <Function id="_55" name="__builtin_powif" returns="_131" context="_1" location="f0:73" file="f0" line="73" extern="1"> + <Argument type="_131" location="f0:73" file="f0" line="73"/> + <Argument type="_126" location="f0:73" file="f0" line="73"/> + </Function> + <Function id="_56" name="__builtin_powi" returns="_130" context="_1" location="f0:72" file="f0" line="72" extern="1"> + <Argument type="_130" location="f0:72" file="f0" line="72"/> + <Argument type="_126" location="f0:72" file="f0" line="72"/> + </Function> + <Function id="_57" name="__builtin_powl" returns="_129" context="_1" location="f0:71" file="f0" line="71" extern="1"> + <Argument type="_129" location="f0:71" file="f0" line="71"/> + <Argument type="_129" location="f0:71" file="f0" line="71"/> + </Function> + <Function id="_58" name="__builtin_powf" returns="_131" context="_1" location="f0:70" file="f0" line="70" extern="1"> + <Argument type="_131" location="f0:70" file="f0" line="70"/> + <Argument type="_131" location="f0:70" file="f0" line="70"/> + </Function> + <Function id="_59" name="__builtin_modfl" returns="_129" context="_1" location="f0:69" file="f0" line="69" extern="1"> + <Argument type="_129" location="f0:69" file="f0" line="69"/> + <Argument type="_132" location="f0:69" file="f0" line="69"/> + </Function> + <Function id="_60" name="__builtin_modff" returns="_131" context="_1" location="f0:68" file="f0" line="68" extern="1"> + <Argument type="_131" location="f0:68" file="f0" line="68"/> + <Argument type="_133" location="f0:68" file="f0" line="68"/> + </Function> + <Function id="_61" name="__builtin_log10l" returns="_129" context="_1" location="f0:65" file="f0" line="65" extern="1"> + <Argument type="_129" location="f0:65" file="f0" line="65"/> + </Function> + <Function id="_62" name="__builtin_log10f" returns="_131" context="_1" location="f0:64" file="f0" line="64" extern="1"> + <Argument type="_131" location="f0:64" file="f0" line="64"/> + </Function> + <Function id="_63" name="__builtin_log10" returns="_130" context="_1" location="f0:63" file="f0" line="63" extern="1"> + <Argument type="_130" location="f0:63" file="f0" line="63"/> + </Function> + <Function id="_64" name="__builtin_ldexpl" returns="_129" context="_1" location="f0:61" file="f0" line="61" extern="1"> + <Argument type="_129" location="f0:61" file="f0" line="61"/> + <Argument type="_126" location="f0:61" file="f0" line="61"/> + </Function> + <Function id="_65" name="__builtin_ldexpf" returns="_131" context="_1" location="f0:60" file="f0" line="60" extern="1"> + <Argument type="_131" location="f0:60" file="f0" line="60"/> + <Argument type="_126" location="f0:60" file="f0" line="60"/> + </Function> + <Function id="_66" name="__builtin_ldexp" returns="_130" context="_1" location="f0:59" file="f0" line="59" extern="1"> + <Argument type="_130" location="f0:59" file="f0" line="59"/> + <Argument type="_126" location="f0:59" file="f0" line="59"/> + </Function> + <Function id="_67" name="__builtin_frexpl" returns="_129" context="_1" location="f0:58" file="f0" line="58" extern="1"> + <Argument type="_129" location="f0:58" file="f0" line="58"/> + <Argument type="_134" location="f0:58" file="f0" line="58"/> + </Function> + <Function id="_68" name="__builtin_frexpf" returns="_131" context="_1" location="f0:57" file="f0" line="57" extern="1"> + <Argument type="_131" location="f0:57" file="f0" line="57"/> + <Argument type="_134" location="f0:57" file="f0" line="57"/> + </Function> + <Function id="_69" name="__builtin_frexp" returns="_130" context="_1" location="f0:56" file="f0" line="56" extern="1"> + <Argument type="_130" location="f0:56" file="f0" line="56"/> + <Argument type="_134" location="f0:56" file="f0" line="56"/> + </Function> + <Function id="_70" name="__builtin_fmodl" returns="_129" context="_1" location="f0:55" file="f0" line="55" extern="1"> + <Argument type="_129" location="f0:55" file="f0" line="55"/> + <Argument type="_129" location="f0:55" file="f0" line="55"/> + </Function> + <Function id="_71" name="__builtin_fmodf" returns="_131" context="_1" location="f0:54" file="f0" line="54" extern="1"> + <Argument type="_131" location="f0:54" file="f0" line="54"/> + <Argument type="_131" location="f0:54" file="f0" line="54"/> + </Function> + <Function id="_72" name="__builtin_floorl" returns="_129" context="_1" location="f0:53" file="f0" line="53" extern="1"> + <Argument type="_129" location="f0:53" file="f0" line="53"/> + </Function> + <Function id="_73" name="__builtin_floorf" returns="_131" context="_1" location="f0:52" file="f0" line="52" extern="1"> + <Argument type="_131" location="f0:52" file="f0" line="52"/> + </Function> + <Function id="_74" name="__builtin_floor" returns="_130" context="_1" location="f0:51" file="f0" line="51" extern="1"> + <Argument type="_130" location="f0:51" file="f0" line="51"/> + </Function> + <Function id="_75" name="__builtin_coshl" returns="_129" context="_1" location="f0:43" file="f0" line="43" extern="1"> + <Argument type="_129" location="f0:43" file="f0" line="43"/> + </Function> + <Function id="_76" name="__builtin_coshf" returns="_131" context="_1" location="f0:42" file="f0" line="42" extern="1"> + <Argument type="_131" location="f0:42" file="f0" line="42"/> + </Function> + <Function id="_77" name="__builtin_cosh" returns="_130" context="_1" location="f0:41" file="f0" line="41" extern="1"> + <Argument type="_130" location="f0:41" file="f0" line="41"/> + </Function> + <Function id="_78" name="__builtin_ceill" returns="_129" context="_1" location="f0:38" file="f0" line="38" extern="1"> + <Argument type="_129" location="f0:38" file="f0" line="38"/> + </Function> + <Function id="_79" name="__builtin_ceilf" returns="_131" context="_1" location="f0:37" file="f0" line="37" extern="1"> + <Argument type="_131" location="f0:37" file="f0" line="37"/> + </Function> + <Function id="_80" name="__builtin_ceil" returns="_130" context="_1" location="f0:36" file="f0" line="36" extern="1"> + <Argument type="_130" location="f0:36" file="f0" line="36"/> + </Function> + <Function id="_81" name="__builtin_atanl" returns="_129" context="_1" location="f0:35" file="f0" line="35" extern="1"> + <Argument type="_129" location="f0:35" file="f0" line="35"/> + </Function> + <Function id="_82" name="__builtin_atanf" returns="_131" context="_1" location="f0:34" file="f0" line="34" extern="1"> + <Argument type="_131" location="f0:34" file="f0" line="34"/> + </Function> + <Function id="_83" name="__builtin_atan2l" returns="_129" context="_1" location="f0:33" file="f0" line="33" extern="1"> + <Argument type="_129" location="f0:33" file="f0" line="33"/> + <Argument type="_129" location="f0:33" file="f0" line="33"/> + </Function> + <Function id="_84" name="__builtin_atan2f" returns="_131" context="_1" location="f0:32" file="f0" line="32" extern="1"> + <Argument type="_131" location="f0:32" file="f0" line="32"/> + <Argument type="_131" location="f0:32" file="f0" line="32"/> + </Function> + <Function id="_85" name="__builtin_atan2" returns="_130" context="_1" location="f0:31" file="f0" line="31" extern="1"> + <Argument type="_130" location="f0:31" file="f0" line="31"/> + <Argument type="_130" location="f0:31" file="f0" line="31"/> + </Function> + <Function id="_86" name="__builtin_atan" returns="_130" context="_1" location="f0:30" file="f0" line="30" extern="1"> + <Argument type="_130" location="f0:30" file="f0" line="30"/> + </Function> + <Function id="_87" name="__builtin_asinl" returns="_129" context="_1" location="f0:29" file="f0" line="29" extern="1"> + <Argument type="_129" location="f0:29" file="f0" line="29"/> + </Function> + <Function id="_88" name="__builtin_asinf" returns="_131" context="_1" location="f0:28" file="f0" line="28" extern="1"> + <Argument type="_131" location="f0:28" file="f0" line="28"/> + </Function> + <Function id="_89" name="__builtin_asin" returns="_130" context="_1" location="f0:27" file="f0" line="27" extern="1"> + <Argument type="_130" location="f0:27" file="f0" line="27"/> + </Function> + <Function id="_90" name="__builtin_acosl" returns="_129" context="_1" location="f0:26" file="f0" line="26" extern="1"> + <Argument type="_129" location="f0:26" file="f0" line="26"/> + </Function> + <Function id="_91" name="__builtin_acosf" returns="_131" context="_1" location="f0:25" file="f0" line="25" extern="1"> + <Argument type="_131" location="f0:25" file="f0" line="25"/> + </Function> + <Function id="_92" name="__builtin_acos" returns="_130" context="_1" location="f0:24" file="f0" line="24" extern="1"> + <Argument type="_130" location="f0:24" file="f0" line="24"/> + </Function> + <Function id="_93" name="__builtin_expect" returns="_128" context="_1" location="f0:16" file="f0" line="16" extern="1"> + <Argument name="EXP" type="_128" location="f0:16" file="f0" line="16"/> + <Argument name="C" type="_128" location="f0:16" file="f0" line="16"/> + </Function> + <Function id="_94" name="__builtin_prefetch" returns="_135" context="_1" location="f0:17" file="f0" line="17" extern="1"> + <Argument name="ADDR" type="_136" location="f0:17" file="f0" line="17"/> + <Ellipsis/> + </Function> + <Function id="_95" name="__builtin_return" returns="_135" context="_1" location="f0:13" file="f0" line="13" extern="1" attributes="nothrow noreturn"> + <Argument name="RESULT" type="_137" location="f0:13" file="f0" line="13"/> + </Function> + <Function id="_96" name="__builtin_return_address" returns="_137" context="_1" location="f0:14" file="f0" line="14" extern="1"> + <Argument name="LEVEL" type="_138" location="f0:14" file="f0" line="14"/> + </Function> + <Function id="_97" name="__builtin_frame_address" returns="_137" context="_1" location="f0:15" file="f0" line="15" extern="1"> + <Argument name="LEVEL" type="_138" location="f0:15" file="f0" line="15"/> + </Function> + <Function id="_98" name="__builtin_nansl" returns="_129" context="_1" mangled="nansl" demangled="__int128" location="f0:23" file="f0" line="23" extern="1" attributes="nothrow const"> + <Argument name="str" type="_139" location="f0:23" file="f0" line="23"/> + </Function> + <Function id="_99" name="__builtin_nansf" returns="_131" context="_1" mangled="nansf" demangled="__int128" location="f0:22" file="f0" line="22" extern="1" attributes="nothrow const"> + <Argument name="str" type="_139" location="f0:22" file="f0" line="22"/> + </Function> + <Function id="_100" name="__builtin_nans" returns="_130" context="_1" mangled="nans" demangled="__int128" location="f0:21" file="f0" line="21" extern="1" attributes="nothrow const"> + <Argument name="str" type="_139" location="f0:21" file="f0" line="21"/> + </Function> + <Function id="_101" name="__builtin_infl" returns="_129" context="_1" location="f0:20" file="f0" line="20" extern="1" attributes="nothrow const"/> + <Function id="_102" name="__builtin_inff" returns="_131" context="_1" location="f0:19" file="f0" line="19" extern="1" attributes="nothrow const"/> + <Function id="_103" name="__builtin_inf" returns="_130" context="_1" location="f0:18" file="f0" line="18" extern="1" attributes="nothrow const"/> + <Function id="_104" name="__builtin_logl" returns="_129" context="_1" mangled="logl" demangled="long" location="f0:67" file="f0" line="67" extern="1" attributes="nothrow"> + <Argument type="_129" location="f0:67" file="f0" line="67"/> + </Function> + <Function id="_105" name="__builtin_expl" returns="_129" context="_1" mangled="expl" demangled="long double" location="f0:47" file="f0" line="47" extern="1" attributes="nothrow"> + <Argument type="_129" location="f0:47" file="f0" line="47"/> + </Function> + <Function id="_106" name="__builtin_cosl" returns="_129" context="_1" mangled="cosl" demangled="char" location="f0:44" file="f0" line="44" extern="1" attributes="nothrow pure"> + <Argument type="_129" location="f0:44" file="f0" line="44"/> + </Function> + <Function id="_107" name="__builtin_sinl" returns="_129" context="_1" mangled="sinl" demangled="short" location="f0:80" file="f0" line="80" extern="1" attributes="nothrow pure"> + <Argument type="_129" location="f0:80" file="f0" line="80"/> + </Function> + <Function id="_108" name="__builtin_sqrtl" returns="_129" context="_1" mangled="sqrtl" demangled="short" location="f0:83" file="f0" line="83" extern="1" attributes="nothrow"> + <Argument type="_129" location="f0:83" file="f0" line="83"/> + </Function> + <Function id="_109" name="__builtin_logf" returns="_131" context="_1" mangled="logf" demangled="long" location="f0:66" file="f0" line="66" extern="1" attributes="nothrow"> + <Argument type="_131" location="f0:66" file="f0" line="66"/> + </Function> + <Function id="_110" name="__builtin_expf" returns="_131" context="_1" mangled="expf" demangled="long double" location="f0:46" file="f0" line="46" extern="1" attributes="nothrow"> + <Argument type="_131" location="f0:46" file="f0" line="46"/> + </Function> + <Function id="_111" name="__builtin_cosf" returns="_131" context="_1" mangled="cosf" demangled="char" location="f0:40" file="f0" line="40" extern="1" attributes="nothrow pure"> + <Argument type="_131" location="f0:40" file="f0" line="40"/> + </Function> + <Function id="_112" name="__builtin_sinf" returns="_131" context="_1" mangled="sinf" demangled="short" location="f0:76" file="f0" line="76" extern="1" attributes="nothrow pure"> + <Argument type="_131" location="f0:76" file="f0" line="76"/> + </Function> + <Function id="_113" name="__builtin_sqrtf" returns="_131" context="_1" mangled="sqrtf" demangled="short" location="f0:82" file="f0" line="82" extern="1" attributes="nothrow"> + <Argument type="_131" location="f0:82" file="f0" line="82"/> + </Function> + <Function id="_114" name="__builtin_log" returns="_130" context="_1" mangled="log" demangled="long" location="f0:62" file="f0" line="62" extern="1" attributes="nothrow"> + <Argument type="_130" location="f0:62" file="f0" line="62"/> + </Function> + <Function id="_115" name="__builtin_exp" returns="_130" context="_1" mangled="exp" demangled="long double" location="f0:45" file="f0" line="45" extern="1" attributes="nothrow"> + <Argument type="_130" location="f0:45" file="f0" line="45"/> + </Function> + <Function id="_116" name="__builtin_cos" returns="_130" context="_1" mangled="cos" demangled="char" location="f0:39" file="f0" line="39" extern="1" attributes="nothrow pure"> + <Argument type="_130" location="f0:39" file="f0" line="39"/> + </Function> + <Function id="_117" name="__builtin_sin" returns="_130" context="_1" mangled="sin" demangled="short" location="f0:75" file="f0" line="75" extern="1" attributes="nothrow pure"> + <Argument type="_130" location="f0:75" file="f0" line="75"/> + </Function> + <Function id="_118" name="__builtin_sqrt" returns="_130" context="_1" mangled="sqrt" demangled="short" location="f0:81" file="f0" line="81" extern="1" attributes="nothrow"> + <Argument type="_130" location="f0:81" file="f0" line="81"/> + </Function> + <Function id="_119" name="__builtin_fabsl" returns="_129" context="_1" location="f0:50" file="f0" line="50" extern="1" attributes="nothrow const"> + <Argument type="_129" location="f0:50" file="f0" line="50"/> + </Function> + <Function id="_120" name="__builtin_fabsf" returns="_131" context="_1" location="f0:49" file="f0" line="49" extern="1" attributes="nothrow const"> + <Argument type="_131" location="f0:49" file="f0" line="49"/> + </Function> + <Function id="_121" name="__builtin_fabs" returns="_130" context="_1" location="f0:48" file="f0" line="48" extern="1" attributes="nothrow const"> + <Argument type="_130" location="f0:48" file="f0" line="48"/> + </Function> + <Namespace id="_122" name="demangled" context="_1" members="_140 " mangled="_Z9demangled" demangled="demangled"/> + <FundamentalType id="_123" name="complex long double" size="256" align="128"/> + <FundamentalType id="_124" name="complex double" size="128" align="64"/> + <FundamentalType id="_125" name="complex float" size="64" align="32"/> + <FundamentalType id="_126" name="int" size="32" align="32"/> + <FundamentalType id="_127" name="long long int" size="64" align="64"/> + <FundamentalType id="_128" name="long int" size="64" align="64"/> + <FundamentalType id="_129" name="long double" size="128" align="128"/> + <FundamentalType id="_130" name="double" size="64" align="64"/> + <FundamentalType id="_131" name="float" size="32" align="32"/> + <PointerType id="_132" type="_129" size="64" align="64"/> + <PointerType id="_133" type="_131" size="64" align="64"/> + <PointerType id="_134" type="_126" size="64" align="64"/> + <FundamentalType id="_135" name="void" align="8"/> + <PointerType id="_136" type="_135c" size="64" align="64"/> + <PointerType id="_137" type="_135" size="64" align="64"/> + <FundamentalType id="_138" name="unsigned int" size="32" align="32"/> + <PointerType id="_139" type="_143c" size="64" align="64"/> + <Struct id="_140" name="buggy" context="_122" mangled="N9demangled5buggyE" demangled="demangled::buggy" location="f1:18" file="f1" line="18" artificial="1" size="8" align="8" members="_145 _147 _148 _149 _150 " bases=""/> + <Struct id="_141" name="item_t<25214903917,11,2147483648>" context="_122" mangled="N9demangled6item_tILm25214903917ELm11ELm2147483648EEE" demangled="demangled::item_t<25214903917l, 11l, 2147483648l>" location="f1:12" file="f1" line="12" artificial="1" size="8" align="8" members="_151 _152 _153 _154 _155 " bases=""/> + <Field id="_145" name="my_item_var" type="_141" offset="0" context="_140" access="public" mangled="_ZN9demangled5buggy11my_item_varE" demangled="demangled::buggy::my_item_var" location="f1:21" file="f1" line="21"/> + <FundamentalType id="_146" name="long unsigned int" size="64" align="64"/> + <Typedef id="_147" name="ulong" type="_146" context="_140" access="public" location="f1:19" file="f1" line="19"/> + <Typedef id="_148" name="my_item_t" type="_141" context="_140" access="public" location="f1:20" file="f1" line="20"/> + <Constructor id="_149" name="buggy" artificial="1" throw="" context="_140" access="public" mangled="_ZN9demangled5buggyC1ERKS0_ *INTERNAL* " demangled="demangled::buggy::buggy(demangled::buggy const&)" location="f1:18" file="f1" line="18" inline="1"> + <Argument name="_ctor_arg" type="_156" location="f1:18" file="f1" line="18"/> + </Constructor> + <Constructor id="_150" name="buggy" explicit="1" artificial="1" throw="" context="_140" access="public" mangled="_ZN9demangled5buggyC1Ev *INTERNAL* " demangled="demangled::buggy::buggy()" location="f1:18" file="f1" line="18" inline="1"/> + <Variable id="_151" name="v1" type="_146c" init="25214903917" context="_141" access="public" mangled="_ZN9demangled6item_tILm25214903917ELm11ELm2147483648EE2v1E" demangled="demangled::item_t<25214903917l, 11l, 2147483648l>::v1" location="f1:13" file="f1" line="13" extern="1"/> + <Variable id="_152" name="v2" type="_146c" init="11" context="_141" access="public" mangled="_ZN9demangled6item_tILm25214903917ELm11ELm2147483648EE2v2E" demangled="demangled::item_t<25214903917l, 11l, 2147483648l>::v2" location="f1:14" file="f1" line="14" extern="1"/> + <Variable id="_153" name="v3" type="_146c" init="2147483648" context="_141" access="public" mangled="_ZN9demangled6item_tILm25214903917ELm11ELm2147483648EE2v3E" demangled="demangled::item_t<25214903917l, 11l, 2147483648l>::v3" location="f1:15" file="f1" line="15" extern="1"/> + <Constructor id="_154" name="item_t" artificial="1" throw="" context="_141" access="public" mangled="_ZN9demangled6item_tILm25214903917ELm11ELm2147483648EEC1ERKS1_ *INTERNAL* " demangled="demangled::item_t<25214903917l, 11l, 2147483648l>::item_t(demangled::item_t<25214903917l, 11l, 2147483648l> const&)" location="f1:12" file="f1" line="12" inline="1"> + <Argument name="_ctor_arg" type="_158" location="f1:12" file="f1" line="12"/> + </Constructor> + <Constructor id="_155" name="item_t" explicit="1" artificial="1" throw="" context="_141" access="public" mangled="_ZN9demangled6item_tILm25214903917ELm11ELm2147483648EEC1Ev *INTERNAL* " demangled="demangled::item_t<25214903917l, 11l, 2147483648l>::item_t()" location="f1:12" file="f1" line="12" inline="1"/> + <ReferenceType id="_156" type="_140c" size="64" align="64"/> + <CvQualifiedType id="_146c" type="_146" const="1"/> + <ReferenceType id="_158" type="_141c" size="64" align="64"/> + <FundamentalType id="_143" name="char" size="8" align="8"/> + <CvQualifiedType id="_143c" type="_143" const="1"/> + <CvQualifiedType id="_135c" type="_135" const="1"/> + <CvQualifiedType id="_141c" type="_141" const="1"/> + <CvQualifiedType id="_140c" type="_140" const="1"/> + <File id="f0" name="/usr/local/share/gccxml-0.7/GCC/4.1/gccxml_builtins.h"/> + <File id="f1" name="/home/gotti/pygccxml-0.8.1/unittests/data/demangled.hpp"/> +</GCC_XML> Modified: pygccxml_dev/unittests/demangled_tester.py =================================================================== --- pygccxml_dev/unittests/demangled_tester.py 2006-08-26 17:26:11 UTC (rev 475) +++ pygccxml_dev/unittests/demangled_tester.py 2006-08-26 18:27:22 UTC (rev 476) @@ -3,6 +3,7 @@ # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) +import os import unittest import autoconfig import parser_test_case @@ -11,26 +12,49 @@ from pygccxml import parser from pygccxml import declarations -class tester_t( parser_test_case.parser_test_case_t ): - def __init__(self, *args ): +class tester_impl_t( parser_test_case.parser_test_case_t ): + def __init__(self, architecture, *args ): parser_test_case.parser_test_case_t.__init__( self, *args ) self.header = 'demangled.hpp' self.global_ns = None + self.architecture = architecture def setUp(self): - if not self.global_ns: - decls = parser.parse( [self.header], self.config ) - self.global_ns = declarations.get_global_namespace( decls ) - self.global_ns.init_optimizer() + reader = parser.source_reader_t( self.config ) + decls = None + if 32 == self.architecture: + decls = reader.read_file( self.header ) + else: + original_get_architecture = utils.get_architecture + utils.get_architecture = lambda: 64 + decls = reader.read_xml_file( + os.path.join( autoconfig.data_directory, 'demangled_tester_64bit.xml' ) ) + utils.get_architecture = original_get_architecture + self.global_ns = declarations.get_global_namespace( decls ) def test( self ): demangled = self.global_ns.namespace( 'demangled' ) - cls = demangled.class_( 'item_t<3740067437l, 11l, 2147483648l>' ) - self.failUnless( cls._name == 'item_t<0deece66d,11,080000000>' ) - + if 32 == self.architecture: + cls = demangled.class_( 'item_t<3740067437l, 11l, 2147483648l>' ) + self.failUnless( cls._name == 'item_t<0deece66d,11,080000000>' ) + else: + cls = demangled.class_( "item_t<25214903917l, 11l, 2147483648l>" ) + self.failUnless( cls._name == 'item_t<25214903917,11,2147483648>' ) + + +class tester_32_t( tester_impl_t ): + def __init__(self, *args): + tester_impl_t.__init__(self, 32, *args) + +class tester_64_t( tester_impl_t ): + def __init__(self, *args): + tester_impl_t.__init__(self, 64, *args) + + def create_suite(): suite = unittest.TestSuite() - suite.addTest( unittest.makeSuite(tester_t)) + suite.addTest( unittest.makeSuite(tester_32_t)) + suite.addTest( unittest.makeSuite(tester_64_t)) return suite def run_suite(): Modified: pyplusplus_dev/examples/pyboost_dev/dev/date_time/sconscript =================================================================== --- pyplusplus_dev/examples/pyboost_dev/dev/date_time/sconscript 2006-08-26 17:26:11 UTC (rev 475) +++ pyplusplus_dev/examples/pyboost_dev/dev/date_time/sconscript 2006-08-26 18:27:22 UTC (rev 476) @@ -1,49 +1,49 @@ -#! /usr/bin/python -# Copyright 2004 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) - -import os -import sys -import date_time_settings - -Import( 'env' ) - -def get_ccflags(): - if sys.platform == 'win32': - return date_time_settings.scons.ccflags \ - + map( lambda ds: '/D%s' % ds, date_time_settings.defined_symbols ) - else: - return map( lambda ds: '-D' + ds, date_time_settings.defined_symbols ) - -def get_source_files(): - source_files = filter( lambda s: s.endswith( '.cpp' ), os.listdir(date_time_settings.generated_files_dir) ) - return map( lambda fname: os.path.join( date_time_settings.generated_files_dir, fname ), source_files ) - - -def get_libs(): - libs = [] - if sys.platform == 'linux2': - libs.append('libboost_date_time-gcc-1_35') - return libs - -def get_target(): - return os.path.join( date_time_settings.generated_files_dir - , date_time_settings.module_name + date_time_settings.scons.suffix ) - -local_env = env.Copy() -local_env.Append( LIBS=get_libs() ) -local_env.Append( CPPPATH=[ date_time_settings.generated_files_dir ] ) -local_env.Append( CCFLAGS=get_ccflags() ) - -_date_time_ = local_env.SharedLibrary( target=date_time_settings.module_name - , source=get_source_files() ) - -if sys.platform == 'win32': - boost_date_time_so_dll = os.path.join( date_time_settings.boost.libs, 'boost_date_time-vc71-mt-1_35.dll' ) -else: - boost_date_time_so_dll = os.path.join( date_time_settings.boost.libs, 'libboost_date_time-gcc-1_35.so' ) - - +#! /usr/bin/python +# Copyright 2004 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) + +import os +import sys +import date_time_settings + +Import( 'env' ) + +def get_ccflags(): + if sys.platform == 'win32': + return date_time_settings.scons.ccflags \ + + map( lambda ds: '/D%s' % ds, date_time_settings.defined_symbols ) + else: + return map( lambda ds: '-D' + ds, date_time_settings.defined_symbols ) + +def get_source_files(): + source_files = filter( lambda s: s.endswith( '.cpp' ), os.listdir(date_time_settings.generated_files_dir) ) + return map( lambda fname: os.path.join( date_time_settings.generated_files_dir, fname ), source_files ) + + +def get_libs(): + libs = [] + if sys.platform == 'linux2': + libs.append('libboost_date_time-gcc-1_35') + return libs + +def get_target(): + return os.path.join( date_time_settings.generated_files_dir + , date_time_settings.module_name + date_time_settings.scons.suffix ) + +local_env = env.Copy() +local_env.Append( LIBS=get_libs() ) +local_env.Append( CPPPATH=[ date_time_settings.generated_files_dir ] ) +local_env.Append( CCFLAGS=get_ccflags() ) + +_date_time_ = local_env.SharedLibrary( target=date_time_settings.module_name + , source=get_source_files() ) + +if sys.platform == 'win32': + boost_date_time_so_dll = os.path.join( date_time_settings.boost.libs, 'boost_date_time-vc71-mt-1_35.dll' ) +else: + boost_date_time_so_dll = os.path.join( date_time_settings.boost.libs, 'libboost_date_time-gcc-1_35.so' ) + + local_env.Install( '#pyboost/date_time', [_date_time_, boost_date_time_so_dll ] ) \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-26 17:26:25
|
Revision: 475 Author: roman_yakovenko Date: 2006-08-26 10:26:11 -0700 (Sat, 26 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=475&view=rev Log Message: ----------- adding declarations and type algorirthms result cache Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/algorithm.py pygccxml_dev/pygccxml/declarations/class_declaration.py pygccxml_dev/pygccxml/declarations/declaration.py pygccxml_dev/pygccxml/declarations/namespace.py pygccxml_dev/pygccxml/declarations/scopedef.py pygccxml_dev/pygccxml/parser/linker.py Added Paths: ----------- pygccxml_dev/pygccxml/declarations/algorithms_cache.py Modified: pygccxml_dev/pygccxml/declarations/algorithm.py =================================================================== --- pygccxml_dev/pygccxml/declarations/algorithm.py 2006-08-26 12:14:17 UTC (rev 474) +++ pygccxml_dev/pygccxml/declarations/algorithm.py 2006-08-26 17:26:11 UTC (rev 475) @@ -19,18 +19,15 @@ """ if not decl: return [] - cached_decl_path = getattr(decl, "cached_decl_path", None) - if cached_decl_path: - return cached_decl_path - else: + if not decl.cache.declaration_path: result = [ decl.name ] parent = decl.parent while parent: result.append( parent.name ) parent = parent.parent result.reverse() - setattr(decl, "cached_decl_path", result) - return result + decl.cache.declaration_path = result + return decl.cache.declaration_path def full_name( decl ): """ @@ -44,11 +41,13 @@ """ if None is decl: raise RuntimeError( "Unable to generate full name for None object!" ) - decl_path = declaration_path( decl ) - ##Here I have lack of knowledge: - ##TODO: "What is the full name of declaration declared in unnamed namespace?" - result = filter( None, decl_path ) - return result[0] + '::'.join( result[1:] ) + if not decl.cache.full_name: + decl_path = declaration_path( decl ) + ##Here I have lack of knowledge: + ##TODO: "What is the full name of declaration declared in unnamed namespace?" + result = filter( None, decl_path ) + decl.cache.full_name = result[0] + '::'.join( result[1:] ) + return decl.cache.full_name def make_flatten( decl_or_decls ): Added: pygccxml_dev/pygccxml/declarations/algorithms_cache.py =================================================================== --- pygccxml_dev/pygccxml/declarations/algorithms_cache.py (rev 0) +++ pygccxml_dev/pygccxml/declarations/algorithms_cache.py 2006-08-26 17:26:11 UTC (rev 475) @@ -0,0 +1,33 @@ +# Copyright 2004 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) + +""" +defines class that will keep results of different calculations. +""" + +class algorithms_cache_t( object ): + def __init__( self ): + object.__init__( self ) + self.full_name = None + self.access_type = None + self.declaration_path = None + + def reset( self ): + self.full_name = None + self.access_type = None + self.declaration_path = None + + def reset_name_based( self ): + self.full_name = None + self.declaration_path = None + + def reset_access_type( self ): + self.access_type = None + +class type_traits_cache_t( object ): + def __init__( self ): + object.__init__( self ) + self.remove_alias = None + Modified: pygccxml_dev/pygccxml/declarations/class_declaration.py =================================================================== --- pygccxml_dev/pygccxml/declarations/class_declaration.py 2006-08-26 12:14:17 UTC (rev 474) +++ pygccxml_dev/pygccxml/declarations/class_declaration.py 2006-08-26 17:26:11 UTC (rev 475) @@ -107,9 +107,7 @@ if not self._name: #class with empty name return self._name elif class_t.USE_DEMANGLED_AS_NAME and self.demangled: - if self.__cached_demangled_name: - return self.__cached_demangled_name - else: + if not self.__cached_demangled_name: fname = algorithm.full_name( self.parent ) if fname.startswith( '::' ) and not self.demangled.startswith( '::' ): fname = fname[2:] @@ -120,7 +118,7 @@ self.__cached_demangled_name = tmp else: self.__cached_demangled_name = self._name - return self.__cached_demangled_name + return self.__cached_demangled_name else: return self._name @@ -246,6 +244,8 @@ returns list of members according to access type If access equals to None, then returned list will contain all members. + You should not modify the list content, otherwise different optimization + data will stop work and may to give you wrong results. @param access: describes desired members @type access: L{ACCESS_TYPES} @@ -265,25 +265,24 @@ all_members.extend( self.private_members ) return all_members - def set_members( self, access, new_members ): - """ - set list of members according to access type + def adopt_declaration( self, decl, access ): + """adds new declaration to the class - @param access: describes desired members - @type access: L{ACCESS_TYPES} + @param decl: reference to a L{declaration<declaration_t>} - @param new_members: list of new members - @type new_members: [ L{member<declaration_t>} ] + @param access: member access type + @type access: L{ACCESS_TYPES} """ - assert( access in ACCESS_TYPES.ALL ) if access == ACCESS_TYPES.PUBLIC: - self.public_members = new_members + self.public_members.append( decl ) elif access == ACCESS_TYPES.PROTECTED: - self.protected_members = new_members + self.protected_members.append( decl ) + elif access == ACCESS_TYPES.PRIVATE: + self.private_members.append( decl ) else: - self.private_members = new_members - for member in new_members: - member.parent = self + raise RuntimeError( "Invalid access type: %s." % access ) + decl.parent = self + decl.cache.access_type = access def remove_declaration( self, decl ): """ @@ -293,19 +292,16 @@ @type decl: L{declaration_t} """ container = None - if decl in self.public_members: + access_type = self.find_out_member_access_type( decl ) + if access_type == ACCESS_TYPES.PUBLIC: container = self.public_members - elif decl in self.protected_members: + elif access_type == ACCESS_TYPES.PROTECTED: container = self.protected_members - elif decl in self.private_members: + else: #decl.cache.access_type == ACCESS_TYPES.PRVATE container = self.private_members - else: - raise ValueError() del container[ container.index( decl ) ] - #add more comment about this. - #if not keep_parent: - # decl.parent=None - + decl.cache.reset_access_type() + def find_out_member_access_type( self, member ): """ returns member access type @@ -316,19 +312,15 @@ @return: L{ACCESS_TYPES} """ assert member.parent is self - cached_access_type = getattr(member, "_cached_access_type", None) - if cached_access_type: - return cached_access_type - else: + if not member.cache.access_type: access_type = None if member in self.public_members: - access_type = ACCESS_TYPES.PUBLIC + member.cache.access_type = ACCESS_TYPES.PUBLIC elif member in self.protected_members: - access_type = ACCESS_TYPES.PROTECTED + member.cache.access_type = ACCESS_TYPES.PROTECTED elif member in self.private_members: - access_type = ACCESS_TYPES.PRIVATE + member.cache.access_type = ACCESS_TYPES.PRIVATE else: raise RuntimeError( "Unable to find member within internal members list." ) - setattr(member, "_cached_access_type", access_type) - return access_type + return member.cache.access_type Modified: pygccxml_dev/pygccxml/declarations/declaration.py =================================================================== --- pygccxml_dev/pygccxml/declarations/declaration.py 2006-08-26 12:14:17 UTC (rev 474) +++ pygccxml_dev/pygccxml/declarations/declaration.py 2006-08-26 17:26:11 UTC (rev 475) @@ -12,8 +12,8 @@ import algorithm import templates +import algorithms_cache - class location_t(object): """provides information about the location of the declaration within the source file. @@ -75,8 +75,7 @@ self._mangled = mangled self._demangled = demangled self._parent = None - - #self._cached_name = None + self._cache = algorithms_cache.algorithms_cache_t() def __str__(self): """Default __str__ method. @@ -159,8 +158,15 @@ # return self._cached_name return self._get_name_impl() + def _on_rename( self ): + pass + def _set_name( self, new_name ): + previous_name = self._name self._name = new_name + if previous_name: #the was a rename and not initial "set" + self._on_rename() + name = property( _get_name, _set_name , doc="""Declaration name @type: str @@ -236,3 +242,10 @@ doc="""Full name of the declaration @type: str """ ) + @property + def cache( self ): + """implementation details + + reference to instance of L{algorithms_cache.algorithms_cache_t} class. + """ + return self._cache \ No newline at end of file Modified: pygccxml_dev/pygccxml/declarations/namespace.py =================================================================== --- pygccxml_dev/pygccxml/declarations/namespace.py 2006-08-26 12:14:17 UTC (rev 474) +++ pygccxml_dev/pygccxml/declarations/namespace.py 2006-08-26 17:26:11 UTC (rev 475) @@ -48,6 +48,10 @@ self.declarations.append( decl ) inst.declarations = [] + def adopt_declaration( self, decl ): + self.declarations.append( decl ) + decl.parent = self + def remove_declaration( self, decl ): """ removes decl from members list Modified: pygccxml_dev/pygccxml/declarations/scopedef.py =================================================================== --- pygccxml_dev/pygccxml/declarations/scopedef.py 2006-08-26 12:14:17 UTC (rev 474) +++ pygccxml_dev/pygccxml/declarations/scopedef.py 2006-08-26 17:26:11 UTC (rev 475) @@ -205,6 +205,15 @@ return add_operator( symbol ) return name #both name and symbol are None + def _on_rename( self ): + for decl in self.decls(allow_empty=True): + decl.cache.reset_name_based() + #I am not sure whether to introduce this or not? + #It could be very time consuming operation + it changes optimize query + #data structures. + #if self.parent: + # if self.parent._optimized: + # self.parent.init_optimizer() def __normalize_args( self, **keywds ): """implementation details""" Modified: pygccxml_dev/pygccxml/parser/linker.py =================================================================== --- pygccxml_dev/pygccxml/parser/linker.py 2006-08-26 12:14:17 UTC (rev 474) +++ pygccxml_dev/pygccxml/parser/linker.py 2006-08-26 17:26:11 UTC (rev 475) @@ -54,10 +54,9 @@ continue decl = self.__decls[member] if isinstance( self.__inst, class_t ): - self.__inst.get_members( access ).append( decl ) + self.__inst.adopt_declaration( decl, access ) else: - self.__inst.declarations.append( decl ) - decl.parent = self.__inst + self.__inst.adopt_declaration( decl ) def __link_calldef(self): self.__inst.return_type = self.__link_type( self.__inst.return_type ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-26 12:14:43
|
Revision: 474 Author: roman_yakovenko Date: 2006-08-26 05:14:17 -0700 (Sat, 26 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=474&view=rev Log Message: ----------- adding unit tests for gccxml that runs on Linux AMD64 architecture Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/type_traits.py pygccxml_dev/pygccxml/parser/patcher.py pygccxml_dev/pygccxml/utils/__init__.py pygccxml_dev/unittests/data/core_cache.hpp pygccxml_dev/unittests/data/patcher.hpp pygccxml_dev/unittests/patcher_tester.py Added Paths: ----------- pygccxml_dev/unittests/data/patcher_tester_64bit.xml Modified: pygccxml_dev/pygccxml/declarations/type_traits.py =================================================================== --- pygccxml_dev/pygccxml/declarations/type_traits.py 2006-08-26 08:16:46 UTC (rev 473) +++ pygccxml_dev/pygccxml/declarations/type_traits.py 2006-08-26 12:14:17 UTC (rev 474) @@ -28,25 +28,25 @@ import class_declaration import types as build_in_types -def __remove_alias(tp, tp_is_clone): +def __remove_alias(type_): """implementation details""" - #implementation of this function is important - if isinstance( tp, cpptypes.compound_t ): - if not tp_is_clone: - tp = tp.clone() - tp_is_clone = True #copy on first modification - tp.base = __remove_alias( tp.base, tp_is_clone ) - return tp - elif isinstance( tp, typedef.typedef_t ): - return __remove_alias( tp.type, tp_is_clone ) - elif isinstance( tp, cpptypes.declarated_t ) and isinstance( tp.declaration, typedef.typedef_t ): - return __remove_alias( tp.declaration.type, tp_is_clone ) - else: - return tp + if isinstance( type_, typedef.typedef_t ): + return __remove_alias( type_.type ) + if isinstance( type_, cpptypes.declarated_t ) and isinstance( type_.declaration, typedef.typedef_t ): + return __remove_alias( type_.declaration.type ) + if isinstance( type_, cpptypes.compound_t ): + type_.base = __remove_alias( type_.base ) + return type_ + return type_ -def remove_alias(tp): +def remove_alias(type_): """returns type without typedefs""" - return __remove_alias( tp, False ) + if isinstance( type_, cpptypes.type_t ): + return __remove_alias( type_.clone() ) + elif isinstance( type_, typedef.typedef_t ): + return __remove_alias( type_.type.clone() ) + else: + return type_ def create_cv_types( base ): """implementation details""" Modified: pygccxml_dev/pygccxml/parser/patcher.py =================================================================== --- pygccxml_dev/pygccxml/parser/patcher.py 2006-08-26 08:16:46 UTC (rev 473) +++ pygccxml_dev/pygccxml/parser/patcher.py 2006-08-26 12:14:17 UTC (rev 474) @@ -3,6 +3,7 @@ # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) +from pygccxml import utils from pygccxml import declarations class patcher_base_t(object): @@ -73,9 +74,14 @@ return arg.default_value except: pass - + try: int( arg.default_value, 16 ) + if 64 == utils.get_architecture(): + #on 64 bit architecture, gccxml reports 0fffff, which is valid number + #the problem is that in this case it is so buggy so pygccxml can not fix it + #users will have to fix the default value manually + return arg.default_value default_value = arg.default_value.lower() found_hex = filter( lambda ch: ch in 'abcdef', default_value ) if found_hex and not default_value.startswith( '0x' ): Modified: pygccxml_dev/pygccxml/utils/__init__.py =================================================================== --- pygccxml_dev/pygccxml/utils/__init__.py 2006-08-26 08:16:46 UTC (rev 473) +++ pygccxml_dev/pygccxml/utils/__init__.py 2006-08-26 12:14:17 UTC (rev 474) @@ -80,6 +80,10 @@ return os.path.normpath( os.path.normcase( some_path ) ) def get_architecture(): + """returns computer architecture: 32 or 64. + + The guess is based on maxint. + """ if sys.maxint == 2147483647: return 32 elif sys.maxint == 9223372036854775807: Modified: pygccxml_dev/unittests/data/core_cache.hpp =================================================================== --- pygccxml_dev/unittests/data/core_cache.hpp 2006-08-26 08:16:46 UTC (rev 473) +++ pygccxml_dev/unittests/data/core_cache.hpp 2006-08-26 12:14:17 UTC (rev 474) @@ -22,4 +22,4 @@ #endif//__core_cache_hpp__ -//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 \ No newline at end of file Modified: pygccxml_dev/unittests/data/patcher.hpp =================================================================== --- pygccxml_dev/unittests/data/patcher.hpp 2006-08-26 08:16:46 UTC (rev 473) +++ pygccxml_dev/unittests/data/patcher.hpp 2006-08-26 12:14:17 UTC (rev 474) @@ -1,53 +1,52 @@ -// Copyright 2004 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) - -#ifndef __patcher_hpp__ -#define __patcher_hpp__ - -namespace ns1{ namespace ns2{ - -enum fruit{ apple, orange }; - -} } - -void fix_enum( ns1::ns2::fruit arg=ns1::ns2::apple ); - -typedef unsigned long long ull; -void fix_numeric( ull arg=(ull)-1 ); - -namespace fx{ - enum{ unnamed = 0 }; - void fix_unnamed( int x=unnamed ); -} - -namespace function_call{ - inline int calc( int,int, int){ return 0; } - void fix_function_call( int i=calc( 1,2,3) ); -} - -namespace fundamental{ - enum spam { eggs }; - void fix_fundamental(unsigned int v=eggs); -} - - -namespace typedef_{ - -struct original_name{ - original_name(){} -}; - -typedef original_name alias; - -} - -void typedef__func( const typedef_::alias& position = typedef_::alias() ); - - -/*struct default_arg_t{};*/ -/*default_arg_t create_default_argument();*/ -/*void double_call( default_arg_t x=create_default_argument() );*/ -#endif//__patcher_hpp__ - +// Copyright 2004 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) + +#ifndef __patcher_hpp__ +#define __patcher_hpp__ + +namespace ns1{ namespace ns2{ + +enum fruit{ apple, orange }; + +} } + +void fix_enum( ns1::ns2::fruit arg=ns1::ns2::apple ); + +typedef unsigned long long ull; +void fix_numeric( ull arg=(ull)-1 ); + +namespace fx{ + enum{ unnamed = 0 }; + void fix_unnamed( int x=unnamed ); +} + +namespace function_call{ + inline int calc( int,int, int){ return 0; } + void fix_function_call( int i=calc( 1,2,3) ); +} + +namespace fundamental{ + enum spam { eggs }; + void fix_fundamental(unsigned int v=eggs); +} + + +namespace typedef_{ + +struct original_name{ + original_name(){} +}; + +typedef original_name alias; + +} + +void typedef__func( const typedef_::alias& position = typedef_::alias() ); + + +/*struct default_arg_t{};*/ +/*default_arg_t create_default_argument();*/ +/*void double_call( default_arg_t x=create_default_argument() );*/ +#endif//__patcher_hpp__ Added: pygccxml_dev/unittests/data/patcher_tester_64bit.xml =================================================================== --- pygccxml_dev/unittests/data/patcher_tester_64bit.xml (rev 0) +++ pygccxml_dev/unittests/data/patcher_tester_64bit.xml 2006-08-26 12:14:17 UTC (rev 474) @@ -0,0 +1,452 @@ +<?xml version="1.0"?> +<GCC_XML cvs_revision="1.113"> + <Namespace id="_1" name="::" members="_3 _4 _6 _7 _8 _9 _10 _11 _12 _13 _14 _15 _16 _17 _18 _19 _20 _21 _22 _23 _24 _25 _26 _27 _28 _29 _30 _31 _32 _33 _34 _35 _36 _37 _38 _39 _40 _41 _42 _43 _44 _45 _46 _47 _48 _49 _50 _51 _52 _53 _54 _55 _56 _57 _58 _59 _60 _61 _62 _63 _64 _65 _66 _67 _68 _69 _70 _71 _72 _73 _74 _75 _76 _77 _78 _79 _80 _81 _82 _83 _84 _85 _86 _87 _88 _89 _90 _91 _92 _93 _94 _95 _96 _97 _98 _99 _100 _101 _102 _103 _104 _105 _106 _107 _108 _109 _110 _111 _112 _113 _114 _115 _116 _117 _118 _119 _120 _121 _122 _123 _124 _125 _126 _127 _128 _129 _130 _131 " mangled="_Z2::" demangled="::"/> + <Namespace id="_2" name="std" context="_1" members="" mangled="_Z3std" demangled="std"/> + <Function id="_3" name="typedef__func" returns="_132" context="_1" mangled="_Z13typedef__funcRKN8typedef_13original_nameE" demangled="typedef__func(typedef_::original_name const&)" location="f0:46" file="f0" line="46" extern="1"> + <Argument name="position" type="_133" location="f0:46" file="f0" line="46" default="alias()"/> + </Function> + <Function id="_4" name="fix_numeric" returns="_132" context="_1" mangled="_Z11fix_numericy" demangled="fix_numeric(unsigned long long)" location="f0:18" file="f0" line="18" extern="1"> + <Argument name="arg" type="_6" location="f0:18" file="f0" line="18" default="0ffffffff"/> + </Function> + <FundamentalType id="_5" name="long long unsigned int" size="64" align="64"/> + <Typedef id="_6" name="ull" type="_5" context="_1" location="f0:17" file="f0" line="17"/> + <Function id="_7" name="fix_enum" returns="_132" context="_1" mangled="_Z8fix_enumN3ns13ns25fruitE" demangled="fix_enum(ns1::ns2::fruit)" location="f0:15" file="f0" line="15" extern="1"> + <Argument name="arg" type="_134" location="f0:15" file="f0" line="15" default="apple"/> + </Function> + <Function id="_8" name="__builtin_cpowl" returns="_135" context="_1" location="f1:131" file="f1" line="131" extern="1"> + <Argument type="_135" location="f1:131" file="f1" line="131"/> + <Argument type="_135" location="f1:131" file="f1" line="131"/> + </Function> + <Function id="_9" name="__builtin_cpow" returns="_136" context="_1" location="f1:130" file="f1" line="130" extern="1"> + <Argument type="_136" location="f1:130" file="f1" line="130"/> + <Argument type="_136" location="f1:130" file="f1" line="130"/> + </Function> + <Function id="_10" name="__builtin_cpowf" returns="_137" context="_1" location="f1:129" file="f1" line="129" extern="1"> + <Argument type="_137" location="f1:129" file="f1" line="129"/> + <Argument type="_137" location="f1:129" file="f1" line="129"/> + </Function> + <Function id="_11" name="__builtin_ctanhl" returns="_135" context="_1" location="f1:128" file="f1" line="128" extern="1"> + <Argument type="_135" location="f1:128" file="f1" line="128"/> + </Function> + <Function id="_12" name="__builtin_ctanh" returns="_136" context="_1" location="f1:127" file="f1" line="127" extern="1"> + <Argument type="_136" location="f1:127" file="f1" line="127"/> + </Function> + <Function id="_13" name="__builtin_ctanhf" returns="_137" context="_1" location="f1:126" file="f1" line="126" extern="1"> + <Argument type="_137" location="f1:126" file="f1" line="126"/> + </Function> + <Function id="_14" name="__builtin_ctanl" returns="_135" context="_1" location="f1:125" file="f1" line="125" extern="1"> + <Argument type="_135" location="f1:125" file="f1" line="125"/> + </Function> + <Function id="_15" name="__builtin_ctan" returns="_136" context="_1" location="f1:124" file="f1" line="124" extern="1"> + <Argument type="_136" location="f1:124" file="f1" line="124"/> + </Function> + <Function id="_16" name="__builtin_ctanf" returns="_137" context="_1" location="f1:123" file="f1" line="123" extern="1"> + <Argument type="_137" location="f1:123" file="f1" line="123"/> + </Function> + <Function id="_17" name="__builtin_csqrtl" returns="_135" context="_1" location="f1:122" file="f1" line="122" extern="1"> + <Argument type="_135" location="f1:122" file="f1" line="122"/> + </Function> + <Function id="_18" name="__builtin_csqrt" returns="_136" context="_1" location="f1:121" file="f1" line="121" extern="1"> + <Argument type="_136" location="f1:121" file="f1" line="121"/> + </Function> + <Function id="_19" name="__builtin_csqrtf" returns="_137" context="_1" location="f1:120" file="f1" line="120" extern="1"> + <Argument type="_137" location="f1:120" file="f1" line="120"/> + </Function> + <Function id="_20" name="__builtin_csinhl" returns="_135" context="_1" location="f1:119" file="f1" line="119" extern="1"> + <Argument type="_135" location="f1:119" file="f1" line="119"/> + </Function> + <Function id="_21" name="__builtin_csinh" returns="_136" context="_1" location="f1:118" file="f1" line="118" extern="1"> + <Argument type="_136" location="f1:118" file="f1" line="118"/> + </Function> + <Function id="_22" name="__builtin_csinhf" returns="_137" context="_1" location="f1:117" file="f1" line="117" extern="1"> + <Argument type="_137" location="f1:117" file="f1" line="117"/> + </Function> + <Function id="_23" name="__builtin_csinl" returns="_135" context="_1" location="f1:116" file="f1" line="116" extern="1"> + <Argument type="_135" location="f1:116" file="f1" line="116"/> + </Function> + <Function id="_24" name="__builtin_csin" returns="_136" context="_1" location="f1:115" file="f1" line="115" extern="1"> + <Argument type="_136" location="f1:115" file="f1" line="115"/> + </Function> + <Function id="_25" name="__builtin_csinf" returns="_137" context="_1" location="f1:114" file="f1" line="114" extern="1"> + <Argument type="_137" location="f1:114" file="f1" line="114"/> + </Function> + <Function id="_26" name="__builtin_clogl" returns="_135" context="_1" location="f1:113" file="f1" line="113" extern="1"> + <Argument type="_135" location="f1:113" file="f1" line="113"/> + </Function> + <Function id="_27" name="__builtin_clog" returns="_136" context="_1" location="f1:112" file="f1" line="112" extern="1"> + <Argument type="_136" location="f1:112" file="f1" line="112"/> + </Function> + <Function id="_28" name="__builtin_clogf" returns="_137" context="_1" location="f1:111" file="f1" line="111" extern="1"> + <Argument type="_137" location="f1:111" file="f1" line="111"/> + </Function> + <Function id="_29" name="__builtin_cexpl" returns="_135" context="_1" location="f1:110" file="f1" line="110" extern="1"> + <Argument type="_135" location="f1:110" file="f1" line="110"/> + </Function> + <Function id="_30" name="__builtin_cexp" returns="_136" context="_1" location="f1:109" file="f1" line="109" extern="1"> + <Argument type="_136" location="f1:109" file="f1" line="109"/> + </Function> + <Function id="_31" name="__builtin_cexpf" returns="_137" context="_1" location="f1:108" file="f1" line="108" extern="1"> + <Argument type="_137" location="f1:108" file="f1" line="108"/> + </Function> + <Function id="_32" name="__builtin_ccoshl" returns="_135" context="_1" location="f1:107" file="f1" line="107" extern="1"> + <Argument type="_135" location="f1:107" file="f1" line="107"/> + </Function> + <Function id="_33" name="__builtin_ccosh" returns="_136" context="_1" location="f1:106" file="f1" line="106" extern="1"> + <Argument type="_136" location="f1:106" file="f1" line="106"/> + </Function> + <Function id="_34" name="__builtin_ccoshf" returns="_137" context="_1" location="f1:105" file="f1" line="105" extern="1"> + <Argument type="_137" location="f1:105" file="f1" line="105"/> + </Function> + <Function id="_35" name="__builtin_ccosl" returns="_135" context="_1" location="f1:104" file="f1" line="104" extern="1"> + <Argument type="_135" location="f1:104" file="f1" line="104"/> + </Function> + <Function id="_36" name="__builtin_ccos" returns="_136" context="_1" location="f1:103" file="f1" line="103" extern="1"> + <Argument type="_136" location="f1:103" file="f1" line="103"/> + </Function> + <Function id="_37" name="__builtin_ccosf" returns="_137" context="_1" location="f1:102" file="f1" line="102" extern="1"> + <Argument type="_137" location="f1:102" file="f1" line="102"/> + </Function> + <Function id="_38" name="__builtin_popcountll" returns="_138" context="_1" location="f1:101" file="f1" line="101" extern="1"> + <Argument type="_139" location="f1:101" file="f1" line="101"/> + </Function> + <Function id="_39" name="__builtin_popcountl" returns="_138" context="_1" location="f1:100" file="f1" line="100" extern="1"> + <Argument type="_140" location="f1:100" file="f1" line="100"/> + </Function> + <Function id="_40" name="__builtin_popcount" returns="_138" context="_1" location="f1:99" file="f1" line="99" extern="1"> + <Argument type="_138" location="f1:99" file="f1" line="99"/> + </Function> + <Function id="_41" name="__builtin_ctzll" returns="_138" context="_1" location="f1:98" file="f1" line="98" extern="1"> + <Argument type="_139" location="f1:98" file="f1" line="98"/> + </Function> + <Function id="_42" name="__builtin_ctzl" returns="_138" context="_1" location="f1:97" file="f1" line="97" extern="1"> + <Argument type="_140" location="f1:97" file="f1" line="97"/> + </Function> + <Function id="_43" name="__builtin_ctz" returns="_138" context="_1" location="f1:96" file="f1" line="96" extern="1"> + <Argument type="_138" location="f1:96" file="f1" line="96"/> + </Function> + <Function id="_44" name="__builtin_cargl" returns="_141" context="_1" location="f1:95" file="f1" line="95" extern="1"> + <Argument type="_135" location="f1:95" file="f1" line="95"/> + </Function> + <Function id="_45" name="__builtin_carg" returns="_142" context="_1" location="f1:94" file="f1" line="94" extern="1"> + <Argument type="_136" location="f1:94" file="f1" line="94"/> + </Function> + <Function id="_46" name="__builtin_cargf" returns="_143" context="_1" location="f1:93" file="f1" line="93" extern="1"> + <Argument type="_137" location="f1:93" file="f1" line="93"/> + </Function> + <Function id="_47" name="__builtin_cabsl" returns="_141" context="_1" location="f1:92" file="f1" line="92" extern="1"> + <Argument type="_135" location="f1:92" file="f1" line="92"/> + </Function> + <Function id="_48" name="__builtin_cabs" returns="_142" context="_1" location="f1:91" file="f1" line="91" extern="1"> + <Argument type="_136" location="f1:91" file="f1" line="91"/> + </Function> + <Function id="_49" name="__builtin_cabsf" returns="_143" context="_1" location="f1:90" file="f1" line="90" extern="1"> + <Argument type="_137" location="f1:90" file="f1" line="90"/> + </Function> + <Function id="_50" name="__builtin_tanl" returns="_141" context="_1" location="f1:89" file="f1" line="89" extern="1"> + <Argument type="_141" location="f1:89" file="f1" line="89"/> + </Function> + <Function id="_51" name="__builtin_tanhl" returns="_141" context="_1" location="f1:88" file="f1" line="88" extern="1"> + <Argument type="_141" location="f1:88" file="f1" line="88"/> + </Function> + <Function id="_52" name="__builtin_tanhf" returns="_143" context="_1" location="f1:87" file="f1" line="87" extern="1"> + <Argument type="_143" location="f1:87" file="f1" line="87"/> + </Function> + <Function id="_53" name="__builtin_tanh" returns="_142" context="_1" location="f1:86" file="f1" line="86" extern="1"> + <Argument type="_142" location="f1:86" file="f1" line="86"/> + </Function> + <Function id="_54" name="__builtin_tanf" returns="_143" context="_1" location="f1:85" file="f1" line="85" extern="1"> + <Argument type="_143" location="f1:85" file="f1" line="85"/> + </Function> + <Function id="_55" name="__builtin_tan" returns="_142" context="_1" location="f1:84" file="f1" line="84" extern="1"> + <Argument type="_142" location="f1:84" file="f1" line="84"/> + </Function> + <Function id="_56" name="__builtin_sinhl" returns="_141" context="_1" location="f1:79" file="f1" line="79" extern="1"> + <Argument type="_141" location="f1:79" file="f1" line="79"/> + </Function> + <Function id="_57" name="__builtin_sinhf" returns="_143" context="_1" location="f1:78" file="f1" line="78" extern="1"> + <Argument type="_143" location="f1:78" file="f1" line="78"/> + </Function> + <Function id="_58" name="__builtin_sinh" returns="_142" context="_1" location="f1:77" file="f1" line="77" extern="1"> + <Argument type="_142" location="f1:77" file="f1" line="77"/> + </Function> + <Function id="_59" name="__builtin_powil" returns="_141" context="_1" location="f1:74" file="f1" line="74" extern="1"> + <Argument type="_141" location="f1:74" file="f1" line="74"/> + <Argument type="_138" location="f1:74" file="f1" line="74"/> + </Function> + <Function id="_60" name="__builtin_powif" returns="_143" context="_1" location="f1:73" file="f1" line="73" extern="1"> + <Argument type="_143" location="f1:73" file="f1" line="73"/> + <Argument type="_138" location="f1:73" file="f1" line="73"/> + </Function> + <Function id="_61" name="__builtin_powi" returns="_142" context="_1" location="f1:72" file="f1" line="72" extern="1"> + <Argument type="_142" location="f1:72" file="f1" line="72"/> + <Argument type="_138" location="f1:72" file="f1" line="72"/> + </Function> + <Function id="_62" name="__builtin_powl" returns="_141" context="_1" location="f1:71" file="f1" line="71" extern="1"> + <Argument type="_141" location="f1:71" file="f1" line="71"/> + <Argument type="_141" location="f1:71" file="f1" line="71"/> + </Function> + <Function id="_63" name="__builtin_powf" returns="_143" context="_1" location="f1:70" file="f1" line="70" extern="1"> + <Argument type="_143" location="f1:70" file="f1" line="70"/> + <Argument type="_143" location="f1:70" file="f1" line="70"/> + </Function> + <Function id="_64" name="__builtin_modfl" returns="_141" context="_1" location="f1:69" file="f1" line="69" extern="1"> + <Argument type="_141" location="f1:69" file="f1" line="69"/> + <Argument type="_144" location="f1:69" file="f1" line="69"/> + </Function> + <Function id="_65" name="__builtin_modff" returns="_143" context="_1" location="f1:68" file="f1" line="68" extern="1"> + <Argument type="_143" location="f1:68" file="f1" line="68"/> + <Argument type="_145" location="f1:68" file="f1" line="68"/> + </Function> + <Function id="_66" name="__builtin_log10l" returns="_141" context="_1" location="f1:65" file="f1" line="65" extern="1"> + <Argument type="_141" location="f1:65" file="f1" line="65"/> + </Function> + <Function id="_67" name="__builtin_log10f" returns="_143" context="_1" location="f1:64" file="f1" line="64" extern="1"> + <Argument type="_143" location="f1:64" file="f1" line="64"/> + </Function> + <Function id="_68" name="__builtin_log10" returns="_142" context="_1" location="f1:63" file="f1" line="63" extern="1"> + <Argument type="_142" location="f1:63" file="f1" line="63"/> + </Function> + <Function id="_69" name="__builtin_ldexpl" returns="_141" context="_1" location="f1:61" file="f1" line="61" extern="1"> + <Argument type="_141" location="f1:61" file="f1" line="61"/> + <Argument type="_138" location="f1:61" file="f1" line="61"/> + </Function> + <Function id="_70" name="__builtin_ldexpf" returns="_143" context="_1" location="f1:60" file="f1" line="60" extern="1"> + <Argument type="_143" location="f1:60" file="f1" line="60"/> + <Argument type="_138" location="f1:60" file="f1" line="60"/> + </Function> + <Function id="_71" name="__builtin_ldexp" returns="_142" context="_1" location="f1:59" file="f1" line="59" extern="1"> + <Argument type="_142" location="f1:59" file="f1" line="59"/> + <Argument type="_138" location="f1:59" file="f1" line="59"/> + </Function> + <Function id="_72" name="__builtin_frexpl" returns="_141" context="_1" location="f1:58" file="f1" line="58" extern="1"> + <Argument type="_141" location="f1:58" file="f1" line="58"/> + <Argument type="_146" location="f1:58" file="f1" line="58"/> + </Function> + <Function id="_73" name="__builtin_frexpf" returns="_143" context="_1" location="f1:57" file="f1" line="57" extern="1"> + <Argument type="_143" location="f1:57" file="f1" line="57"/> + <Argument type="_146" location="f1:57" file="f1" line="57"/> + </Function> + <Function id="_74" name="__builtin_frexp" returns="_142" context="_1" location="f1:56" file="f1" line="56" extern="1"> + <Argument type="_142" location="f1:56" file="f1" line="56"/> + <Argument type="_146" location="f1:56" file="f1" line="56"/> + </Function> + <Function id="_75" name="__builtin_fmodl" returns="_141" context="_1" location="f1:55" file="f1" line="55" extern="1"> + <Argument type="_141" location="f1:55" file="f1" line="55"/> + <Argument type="_141" location="f1:55" file="f1" line="55"/> + </Function> + <Function id="_76" name="__builtin_fmodf" returns="_143" context="_1" location="f1:54" file="f1" line="54" extern="1"> + <Argument type="_143" location="f1:54" file="f1" line="54"/> + <Argument type="_143" location="f1:54" file="f1" line="54"/> + </Function> + <Function id="_77" name="__builtin_floorl" returns="_141" context="_1" location="f1:53" file="f1" line="53" extern="1"> + <Argument type="_141" location="f1:53" file="f1" line="53"/> + </Function> + <Function id="_78" name="__builtin_floorf" returns="_143" context="_1" location="f1:52" file="f1" line="52" extern="1"> + <Argument type="_143" location="f1:52" file="f1" line="52"/> + </Function> + <Function id="_79" name="__builtin_floor" returns="_142" context="_1" location="f1:51" file="f1" line="51" extern="1"> + <Argument type="_142" location="f1:51" file="f1" line="51"/> + </Function> + <Function id="_80" name="__builtin_coshl" returns="_141" context="_1" location="f1:43" file="f1" line="43" extern="1"> + <Argument type="_141" location="f1:43" file="f1" line="43"/> + </Function> + <Function id="_81" name="__builtin_coshf" returns="_143" context="_1" location="f1:42" file="f1" line="42" extern="1"> + <Argument type="_143" location="f1:42" file="f1" line="42"/> + </Function> + <Function id="_82" name="__builtin_cosh" returns="_142" context="_1" location="f1:41" file="f1" line="41" extern="1"> + <Argument type="_142" location="f1:41" file="f1" line="41"/> + </Function> + <Function id="_83" name="__builtin_ceill" returns="_141" context="_1" location="f1:38" file="f1" line="38" extern="1"> + <Argument type="_141" location="f1:38" file="f1" line="38"/> + </Function> + <Function id="_84" name="__builtin_ceilf" returns="_143" context="_1" location="f1:37" file="f1" line="37" extern="1"> + <Argument type="_143" location="f1:37" file="f1" line="37"/> + </Function> + <Function id="_85" name="__builtin_ceil" returns="_142" context="_1" location="f1:36" file="f1" line="36" extern="1"> + <Argument type="_142" location="f1:36" file="f1" line="36"/> + </Function> + <Function id="_86" name="__builtin_atanl" returns="_141" context="_1" location="f1:35" file="f1" line="35" extern="1"> + <Argument type="_141" location="f1:35" file="f1" line="35"/> + </Function> + <Function id="_87" name="__builtin_atanf" returns="_143" context="_1" location="f1:34" file="f1" line="34" extern="1"> + <Argument type="_143" location="f1:34" file="f1" line="34"/> + </Function> + <Function id="_88" name="__builtin_atan2l" returns="_141" context="_1" location="f1:33" file="f1" line="33" extern="1"> + <Argument type="_141" location="f1:33" file="f1" line="33"/> + <Argument type="_141" location="f1:33" file="f1" line="33"/> + </Function> + <Function id="_89" name="__builtin_atan2f" returns="_143" context="_1" location="f1:32" file="f1" line="32" extern="1"> + <Argument type="_143" location="f1:32" file="f1" line="32"/> + <Argument type="_143" location="f1:32" file="f1" line="32"/> + </Function> + <Function id="_90" name="__builtin_atan2" returns="_142" context="_1" location="f1:31" file="f1" line="31" extern="1"> + <Argument type="_142" location="f1:31" file="f1" line="31"/> + <Argument type="_142" location="f1:31" file="f1" line="31"/> + </Function> + <Function id="_91" name="__builtin_atan" returns="_142" context="_1" location="f1:30" file="f1" line="30" extern="1"> + <Argument type="_142" location="f1:30" file="f1" line="30"/> + </Function> + <Function id="_92" name="__builtin_asinl" returns="_141" context="_1" location="f1:29" file="f1" line="29" extern="1"> + <Argument type="_141" location="f1:29" file="f1" line="29"/> + </Function> + <Function id="_93" name="__builtin_asinf" returns="_143" context="_1" location="f1:28" file="f1" line="28" extern="1"> + <Argument type="_143" location="f1:28" file="f1" line="28"/> + </Function> + <Function id="_94" name="__builtin_asin" returns="_142" context="_1" location="f1:27" file="f1" line="27" extern="1"> + <Argument type="_142" location="f1:27" file="f1" line="27"/> + </Function> + <Function id="_95" name="__builtin_acosl" returns="_141" context="_1" location="f1:26" file="f1" line="26" extern="1"> + <Argument type="_141" location="f1:26" file="f1" line="26"/> + </Function> + <Function id="_96" name="__builtin_acosf" returns="_143" context="_1" location="f1:25" file="f1" line="25" extern="1"> + <Argument type="_143" location="f1:25" file="f1" line="25"/> + </Function> + <Function id="_97" name="__builtin_acos" returns="_142" context="_1" location="f1:24" file="f1" line="24" extern="1"> + <Argument type="_142" location="f1:24" file="f1" line="24"/> + </Function> + <Function id="_98" name="__builtin_expect" returns="_140" context="_1" location="f1:16" file="f1" line="16" extern="1"> + <Argument name="EXP" type="_140" location="f1:16" file="f1" line="16"/> + <Argument name="C" type="_140" location="f1:16" file="f1" line="16"/> + </Function> + <Function id="_99" name="__builtin_prefetch" returns="_132" context="_1" location="f1:17" file="f1" line="17" extern="1"> + <Argument name="ADDR" type="_147" location="f1:17" file="f1" line="17"/> + <Ellipsis/> + </Function> + <Function id="_100" name="__builtin_return" returns="_132" context="_1" location="f1:13" file="f1" line="13" extern="1" attributes="nothrow noreturn"> + <Argument name="RESULT" type="_148" location="f1:13" file="f1" line="13"/> + </Function> + <Function id="_101" name="__builtin_return_address" returns="_148" context="_1" location="f1:14" file="f1" line="14" extern="1"> + <Argument name="LEVEL" type="_149" location="f1:14" file="f1" line="14"/> + </Function> + <Function id="_102" name="__builtin_frame_address" returns="_148" context="_1" location="f1:15" file="f1" line="15" extern="1"> + <Argument name="LEVEL" type="_149" location="f1:15" file="f1" line="15"/> + </Function> + <Function id="_103" name="__builtin_nansl" returns="_141" context="_1" mangled="nansl" demangled="__int128" location="f1:23" file="f1" line="23" extern="1" attributes="nothrow const"> + <Argument name="str" type="_150" location="f1:23" file="f1" line="23"/> + </Function> + <Function id="_104" name="__builtin_nansf" returns="_143" context="_1" mangled="nansf" demangled="__int128" location="f1:22" file="f1" line="22" extern="1" attributes="nothrow const"> + <Argument name="str" type="_150" location="f1:22" file="f1" line="22"/> + </Function> + <Function id="_105" name="__builtin_nans" returns="_142" context="_1" mangled="nans" demangled="__int128" location="f1:21" file="f1" line="21" extern="1" attributes="nothrow const"> + <Argument name="str" type="_150" location="f1:21" file="f1" line="21"/> + </Function> + <Function id="_106" name="__builtin_infl" returns="_141" context="_1" location="f1:20" file="f1" line="20" extern="1" attributes="nothrow const"/> + <Function id="_107" name="__builtin_inff" returns="_143" context="_1" location="f1:19" file="f1" line="19" extern="1" attributes="nothrow const"/> + <Function id="_108" name="__builtin_inf" returns="_142" context="_1" location="f1:18" file="f1" line="18" extern="1" attributes="nothrow const"/> + <Function id="_109" name="__builtin_logl" returns="_141" context="_1" mangled="logl" demangled="long" location="f1:67" file="f1" line="67" extern="1" attributes="nothrow"> + <Argument type="_141" location="f1:67" file="f1" line="67"/> + </Function> + <Function id="_110" name="__builtin_expl" returns="_141" context="_1" mangled="expl" demangled="long double" location="f1:47" file="f1" line="47" extern="1" attributes="nothrow"> + <Argument type="_141" location="f1:47" file="f1" line="47"/> + </Function> + <Function id="_111" name="__builtin_cosl" returns="_141" context="_1" mangled="cosl" demangled="char" location="f1:44" file="f1" line="44" extern="1" attributes="nothrow pure"> + <Argument type="_141" location="f1:44" file="f1" line="44"/> + </Function> + <Function id="_112" name="__builtin_sinl" returns="_141" context="_1" mangled="sinl" demangled="short" location="f1:80" file="f1" line="80" extern="1" attributes="nothrow pure"> + <Argument type="_141" location="f1:80" file="f1" line="80"/> + </Function> + <Function id="_113" name="__builtin_sqrtl" returns="_141" context="_1" mangled="sqrtl" demangled="short" location="f1:83" file="f1" line="83" extern="1" attributes="nothrow"> + <Argument type="_141" location="f1:83" file="f1" line="83"/> + </Function> + <Function id="_114" name="__builtin_logf" returns="_143" context="_1" mangled="logf" demangled="long" location="f1:66" file="f1" line="66" extern="1" attributes="nothrow"> + <Argument type="_143" location="f1:66" file="f1" line="66"/> + </Function> + <Function id="_115" name="__builtin_expf" returns="_143" context="_1" mangled="expf" demangled="long double" location="f1:46" file="f1" line="46" extern="1" attributes="nothrow"> + <Argument type="_143" location="f1:46" file="f1" line="46"/> + </Function> + <Function id="_116" name="__builtin_cosf" returns="_143" context="_1" mangled="cosf" demangled="char" location="f1:40" file="f1" line="40" extern="1" attributes="nothrow pure"> + <Argument type="_143" location="f1:40" file="f1" line="40"/> + </Function> + <Function id="_117" name="__builtin_sinf" returns="_143" context="_1" mangled="sinf" demangled="short" location="f1:76" file="f1" line="76" extern="1" attributes="nothrow pure"> + <Argument type="_143" location="f1:76" file="f1" line="76"/> + </Function> + <Function id="_118" name="__builtin_sqrtf" returns="_143" context="_1" mangled="sqrtf" demangled="short" location="f1:82" file="f1" line="82" extern="1" attributes="nothrow"> + <Argument type="_143" location="f1:82" file="f1" line="82"/> + </Function> + <Function id="_119" name="__builtin_log" returns="_142" context="_1" mangled="log" demangled="long" location="f1:62" file="f1" line="62" extern="1" attributes="nothrow"> + <Argument type="_142" location="f1:62" file="f1" line="62"/> + </Function> + <Function id="_120" name="__builtin_exp" returns="_142" context="_1" mangled="exp" demangled="long double" location="f1:45" file="f1" line="45" extern="1" attributes="nothrow"> + <Argument type="_142" location="f1:45" file="f1" line="45"/> + </Function> + <Function id="_121" name="__builtin_cos" returns="_142" context="_1" mangled="cos" demangled="char" location="f1:39" file="f1" line="39" extern="1" attributes="nothrow pure"> + <Argument type="_142" location="f1:39" file="f1" line="39"/> + </Function> + <Function id="_122" name="__builtin_sin" returns="_142" context="_1" mangled="sin" demangled="short" location="f1:75" file="f1" line="75" extern="1" attributes="nothrow pure"> + <Argument type="_142" location="f1:75" file="f1" line="75"/> + </Function> + <Function id="_123" name="__builtin_sqrt" returns="_142" context="_1" mangled="sqrt" demangled="short" location="f1:81" file="f1" line="81" extern="1" attributes="nothrow"> + <Argument type="_142" location="f1:81" file="f1" line="81"/> + </Function> + <Function id="_124" name="__builtin_fabsl" returns="_141" context="_1" location="f1:50" file="f1" line="50" extern="1" attributes="nothrow const"> + <Argument type="_141" location="f1:50" file="f1" line="50"/> + </Function> + <Function id="_125" name="__builtin_fabsf" returns="_143" context="_1" location="f1:49" file="f1" line="49" extern="1" attributes="nothrow const"> + <Argument type="_143" location="f1:49" file="f1" line="49"/> + </Function> + <Function id="_126" name="__builtin_fabs" returns="_142" context="_1" location="f1:48" file="f1" line="48" extern="1" attributes="nothrow const"> + <Argument type="_142" location="f1:48" file="f1" line="48"/> + </Function> + <Namespace id="_127" name="typedef_" context="_1" members="_152 _151 " mangled="_Z8typedef_" demangled="typedef_"/> + <Namespace id="_128" name="fundamental" context="_1" members="_153 _154 " mangled="_Z11fundamental" demangled="fundamental"/> + <Namespace id="_129" name="function_call" context="_1" members="_155 _156 " mangled="_Z13function_call" demangled="function_call"/> + <Namespace id="_130" name="fx" context="_1" members="_157 _158 " mangled="_Z2fx" demangled="fx"/> + <Namespace id="_131" name="ns1" context="_1" members="_159 " mangled="_Z3ns1" demangled="ns1"/> + <FundamentalType id="_132" name="void" align="8"/> + <ReferenceType id="_133" type="_152c" size="64" align="64"/> + <Enumeration id="_134" name="fruit" context="_159" location="f0:11" file="f0" line="11" artificial="1" size="32" align="32"> + <EnumValue name="apple" init="0"/> + <EnumValue name="orange" init="1"/> + </Enumeration> + <FundamentalType id="_135" name="complex long double" size="256" align="128"/> + <FundamentalType id="_136" name="complex double" size="128" align="64"/> + <FundamentalType id="_137" name="complex float" size="64" align="32"/> + <FundamentalType id="_138" name="int" size="32" align="32"/> + <FundamentalType id="_139" name="long long int" size="64" align="64"/> + <FundamentalType id="_140" name="long int" size="64" align="64"/> + <FundamentalType id="_141" name="long double" size="128" align="128"/> + <FundamentalType id="_142" name="double" size="64" align="64"/> + <FundamentalType id="_143" name="float" size="32" align="32"/> + <PointerType id="_144" type="_141" size="64" align="64"/> + <PointerType id="_145" type="_143" size="64" align="64"/> + <PointerType id="_146" type="_138" size="64" align="64"/> + <PointerType id="_147" type="_132c" size="64" align="64"/> + <PointerType id="_148" type="_132" size="64" align="64"/> + <FundamentalType id="_149" name="unsigned int" size="32" align="32"/> + <PointerType id="_150" type="_162c" size="64" align="64"/> + <Struct id="_151" name="original_name" context="_127" mangled="N8typedef_13original_nameE" demangled="typedef_::original_name" location="f0:38" file="f0" line="38" artificial="1" size="8" align="8" members="_164 _165 " bases=""/> + <Typedef id="_152" name="alias" type="_151" context="_127" location="f0:42" file="f0" line="42"/> + <Function id="_153" name="fix_fundamental" returns="_132" context="_128" mangled="_ZN11fundamental15fix_fundamentalEj" demangled="fundamental::fix_fundamental(unsigned)" location="f0:32" file="f0" line="32" extern="1"> + <Argument name="v" type="_149" location="f0:32" file="f0" line="32" default="eggs"/> + </Function> + <Enumeration id="_154" name="spam" context="_128" location="f0:31" file="f0" line="31" artificial="1" size="32" align="32"> + <EnumValue name="eggs" init="0"/> + </Enumeration> + <Function id="_155" name="fix_function_call" returns="_132" context="_129" mangled="_ZN13function_call17fix_function_callEi" demangled="function_call::fix_function_call(int)" location="f0:27" file="f0" line="27" extern="1"> + <Argument name="i" type="_138" location="f0:27" file="f0" line="27" default="function_call::calc(int, int, int)(1, 2, 3)"/> + </Function> + <Function id="_156" name="calc" returns="_138" context="_129" mangled="_ZN13function_call4calcEiii" demangled="function_call::calc(int, int, int)" location="f0:26" file="f0" line="26" endline="26" inline="1"> + <Argument type="_138" location="f0:26" file="f0" line="26"/> + <Argument type="_138" location="f0:26" file="f0" line="26"/> + <Argument type="_138" location="f0:26" file="f0" line="26"/> + </Function> + <Function id="_157" name="fix_unnamed" returns="_132" context="_130" mangled="_ZN2fx11fix_unnamedEi" demangled="fx::fix_unnamed(int)" location="f0:22" file="f0" line="22" extern="1"> + <Argument name="x" type="_138" location="f0:22" file="f0" line="22" default="unnamed"/> + </Function> + <Enumeration id="_158" name="._0" context="_130" location="f0:21" file="f0" line="21" artificial="1" size="32" align="32"> + <EnumValue name="unnamed" init="0"/> + </Enumeration> + <Namespace id="_159" name="ns2" context="_131" members="_134 " mangled="_ZN3ns13ns2E" demangled="ns1::ns2"/> + <Constructor id="_164" name="original_name" artificial="1" throw="" context="_151" access="public" mangled="_ZN8typedef_13original_nameC1ERKS0_ *INTERNAL* " demangled="typedef_::original_name::original_name(typedef_::original_name const&)" location="f0:38" file="f0" line="38" inline="1"> + <Argument name="_ctor_arg" type="_166" location="f0:38" file="f0" line="38"/> + </Constructor> + <Constructor id="_165" name="original_name" explicit="1" context="_151" access="public" mangled="_ZN8typedef_13original_nameC1Ev *INTERNAL* " demangled="typedef_::original_name::original_name()" location="f0:39" file="f0" line="39" endline="39" inline="1"/> + <ReferenceType id="_166" type="_151c" size="64" align="64"/> + <FundamentalType id="_162" name="char" size="8" align="8"/> + <CvQualifiedType id="_162c" type="_162" const="1"/> + <CvQualifiedType id="_132c" type="_132" const="1"/> + <CvQualifiedType id="_151c" type="_151" const="1"/> + <CvQualifiedType id="_152c" type="_152" const="1"/> + <File id="f0" name="/home/gotti/pygccxml-0.8.1/unittests/data/patcher.hpp"/> + <File id="f1" name="/usr/local/share/gccxml-0.7/GCC/4.1/gccxml_builtins.h"/> +</GCC_XML> Modified: pygccxml_dev/unittests/patcher_tester.py =================================================================== --- pygccxml_dev/unittests/patcher_tester.py 2006-08-26 08:16:46 UTC (rev 473) +++ pygccxml_dev/unittests/patcher_tester.py 2006-08-26 12:14:17 UTC (rev 474) @@ -3,6 +3,7 @@ # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) +import os import unittest import autoconfig import parser_test_case @@ -11,20 +12,26 @@ from pygccxml import parser from pygccxml import declarations -class tester_t( parser_test_case.parser_test_case_t ): +class tester_impl_t( parser_test_case.parser_test_case_t ): decls = None - def __init__(self, *args): + def __init__(self, architecture, *args): parser_test_case.parser_test_case_t.__init__(self, *args) + self.architecture = architecture self.__decls = None def setUp( self ): - if tester_t.decls is None: - reader = parser.source_reader_t( self.config ) - tester_t.decls = reader.read_file( 'patcher.hpp' ) - self.__decls = tester_t.decls - + reader = parser.source_reader_t( self.config ) + if 32 == self.architecture: + self.__decls = reader.read_file( 'patcher.hpp' ) + else: + original_get_architecture = utils.get_architecture + utils.get_architecture = lambda: 64 + self.__decls = reader.read_xml_file( + os.path.join( autoconfig.data_directory, 'patcher_tester_64bit.xml' ) ) + utils.get_architecture = original_get_architecture + def test_enum_patcher(self): fix_enum = declarations.find_declaration( self.__decls, type=declarations.free_function_t, name='fix_enum' ) self.failUnless( fix_enum, "Free function fix_enum has not been found." ) @@ -35,8 +42,11 @@ def test_numeric_patcher(self): fix_numeric = declarations.find_declaration( self.__decls, type=declarations.free_function_t, name='fix_numeric' ) self.failUnless( fix_numeric, "Free function fix_numeric has not been found." ) - self.failUnless( fix_numeric.arguments[0].default_value == u"0xffffffffffffffff" ) - + if 32 == self.architecture: + self.failUnless( fix_numeric.arguments[0].default_value == u"0xffffffffffffffff" ) + else: + self.failUnless( fix_numeric.arguments[0].default_value == u"0ffffffff" ) + def test_unnamed_enum_patcher(self): fix_unnamed = declarations.find_declaration( self.__decls, type=declarations.free_function_t, name='fix_unnamed' ) self.failUnless( fix_unnamed, "Free function fix_unnamed has not been found." ) @@ -57,9 +67,18 @@ self.failUnless( typedef__func, "Free function typedef__func has not been found." ) self.failUnless( typedef__func.arguments[0].default_value == u"::typedef_::alias( )" ) +class tester_32_t( tester_impl_t ): + def __init__(self, *args): + tester_impl_t.__init__(self, 32, *args) + +class tester_64_t( tester_impl_t ): + def __init__(self, *args): + tester_impl_t.__init__(self, 64, *args) + def create_suite(): suite = unittest.TestSuite() - suite.addTest( unittest.makeSuite(tester_t)) + suite.addTest( unittest.makeSuite(tester_32_t)) + suite.addTest( unittest.makeSuite(tester_64_t)) return suite def run_suite(): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-26 08:16:53
|
Revision: 473 Author: roman_yakovenko Date: 2006-08-26 01:16:46 -0700 (Sat, 26 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=473&view=rev Log Message: ----------- adding declaration cache test data file to manifest Modified Paths: -------------- pygccxml_dev/MANIFEST.in pygccxml_dev/pygccxml/utils/__init__.py Modified: pygccxml_dev/MANIFEST.in =================================================================== --- pygccxml_dev/MANIFEST.in 2006-08-26 07:43:43 UTC (rev 472) +++ pygccxml_dev/MANIFEST.in 2006-08-26 08:16:46 UTC (rev 473) @@ -1,13 +1,13 @@ -include LICENSE_1_0.txt -include MANIFEST.in -include unittests/*.py -include unittests/data/*.hpp -include unittests/data/*.xml -recursive-include docs/apidocs *.css -recursive-include docs/apidocs *.html -include docs/*.rest -include docs/*.png -include docs/example/* -include docs/history/* -include docs/logos/* -prune docs/*/.svn +include LICENSE_1_0.txt +include MANIFEST.in +include unittests/*.py +include unittests/data/*.hpp +include unittests/data/*.xml +include unittests/data/*.txt +recursive-include docs/apidocs *.css +recursive-include docs/apidocs *.html +include docs/*.rest +include docs/*.png +include docs/example/* +include docs/history/* +prune docs/*/.svn \ No newline at end of file Modified: pygccxml_dev/pygccxml/utils/__init__.py =================================================================== --- pygccxml_dev/pygccxml/utils/__init__.py 2006-08-26 07:43:43 UTC (rev 472) +++ pygccxml_dev/pygccxml/utils/__init__.py 2006-08-26 08:16:46 UTC (rev 473) @@ -77,4 +77,12 @@ def normalize_path( some_path ): """return os.path.normpath( os.path.normcase( some_path ) )""" - return os.path.normpath( os.path.normcase( some_path ) ) \ No newline at end of file + return os.path.normpath( os.path.normcase( some_path ) ) + +def get_architecture(): + if sys.maxint == 2147483647: + return 32 + elif sys.maxint == 9223372036854775807: + return 64 + else: + raise RuntimeError( "Unknown architecture" ) \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-26 07:43:51
|
Revision: 472 Author: roman_yakovenko Date: 2006-08-26 00:43:43 -0700 (Sat, 26 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=472&view=rev Log Message: ----------- incrementing versions Modified Paths: -------------- pydsc_dev/setup.py pygccxml_dev/setup.py pyplusplus_dev/setup.py Modified: pydsc_dev/setup.py =================================================================== --- pydsc_dev/setup.py 2006-08-26 07:32:22 UTC (rev 471) +++ pydsc_dev/setup.py 2006-08-26 07:43:43 UTC (rev 472) @@ -52,7 +52,7 @@ generate_doc() setup( name="pydsc" - , version = "0.2" + , version = "0.3" , description="Python documentation and comments spell checker" , author="Roman Yakovenko" , author_email="rom...@gm..." Modified: pygccxml_dev/setup.py =================================================================== --- pygccxml_dev/setup.py 2006-08-26 07:32:22 UTC (rev 471) +++ pygccxml_dev/setup.py 2006-08-26 07:43:43 UTC (rev 472) @@ -53,7 +53,7 @@ setup( name = "pygccxml", - version = "0.8.1", + version = "0.8.2", description = "GCC-XML generated file reader", author = "Roman Yakovenko", author_email = "rom...@gm...", Modified: pyplusplus_dev/setup.py =================================================================== --- pyplusplus_dev/setup.py 2006-08-26 07:32:22 UTC (rev 471) +++ pyplusplus_dev/setup.py 2006-08-26 07:43:43 UTC (rev 472) @@ -87,7 +87,7 @@ setup( name = "Py++", - version = "0.8.1", + version = "0.8.2", description="Py++ is a framework of components for creating C++ code generator for Boost.Python library", author="Roman Yakovenko", author_email="rom...@gm...", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-26 07:32:38
|
Revision: 471 Author: roman_yakovenko Date: 2006-08-26 00:32:22 -0700 (Sat, 26 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=471&view=rev Log Message: ----------- introducing built-in functionality for exception translation Modified Paths: -------------- pyplusplus_dev/pyplusplus/code_creators/__init__.py pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py pyplusplus_dev/pyplusplus/module_creator/creator.py pyplusplus_dev/unittests/cppexceptions_tester.py pyplusplus_dev/unittests/data/cppexceptions_to_be_exported.hpp pyplusplus_dev/unittests/test_all.py Added Paths: ----------- pyplusplus_dev/pyplusplus/code_creators/exception_translator.py Modified: pyplusplus_dev/pyplusplus/code_creators/__init__.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/__init__.py 2006-08-26 07:16:06 UTC (rev 470) +++ pyplusplus_dev/pyplusplus/code_creators/__init__.py 2006-08-26 07:32:22 UTC (rev 471) @@ -107,4 +107,8 @@ from indexing_suites import indexing_suite1_t from indexing_suites import indexing_suite2_t -from indexing_suites import value_traits_t \ No newline at end of file +from indexing_suites import value_traits_t + +from exception_translator import exception_translator_t +from exception_translator import exception_translator_register_t + Added: pyplusplus_dev/pyplusplus/code_creators/exception_translator.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/exception_translator.py (rev 0) +++ pyplusplus_dev/pyplusplus/code_creators/exception_translator.py 2006-08-26 07:32:22 UTC (rev 471) @@ -0,0 +1,43 @@ +# Copyright 2004 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) + +import os +import types +import algorithm +import code_creator +import declaration_based +from pygccxml import declarations + +class exception_translator_t( declaration_based.declaration_based_t ): + def __init__(self, exception_class ): + declaration_based.declaration_based_t.__init__( self, declaration=exception_class ) + + @property + def translator_name( self ): + return 'translate_%(alias)s' % { 'alias' : self.declaration.alias } + + def _create_impl(self): + return os.linesep.join([ + "void translate_%(alias)s( const %(cls_name)s& %(arg_name)s ){" \ + , self.indent( self.declaration.exception_translation_code ) + , "}"]) \ + % { 'alias' : self.declaration.alias + , 'cls_name' : self.decl_identifier + , 'arg_name' : self.declaration.exception_argument_name } + + +class exception_translator_register_t( declaration_based.declaration_based_t ): + def __init__(self, exception_class, exception_translator): + declaration_based.declaration_based_t.__init__( self, declaration=exception_class ) + self.works_on_instance = False + self.translator = exception_translator + + def _create_impl( self ): + return '%(register_exception_translator)s< %(cls)s >( &%(translator)s );' \ + % { 'register_exception_translator' : algorithm.create_identifier( self, 'boost::python::register_exception_translator' ) + , 'cls' : self.decl_identifier + , 'translator' : self.translator.translator_name } + + \ No newline at end of file Modified: pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py 2006-08-26 07:16:06 UTC (rev 470) +++ pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py 2006-08-26 07:32:22 UTC (rev 471) @@ -136,7 +136,8 @@ self._wrapper_code = [] self._null_constructor_body = '' self._copy_constructor_body = '' - + self._exception_translation_code = None + def _get_redefine_operators( self ): return self._redefine_operators def _set_redefine_operators( self, new_value ): @@ -207,6 +208,43 @@ copy_constructor_body = property( _get_copy_constructor_body, _set_copy_constructor_body , doc="copy constructor code, that will be added as is to the copy constructor of class-wrapper") + @property + def exception_argument_name( self ): + """exception argument name for translate exception function + + If you don't understand what this argument is, please take a look on + Boost.Python documentation: http://www.boost.org/libs/python/doc/v2/exception_translator.html + """ + return 'exc' + + def _get_exception_translation_code( self ): + return self._exception_translation_code + def _set_exception_translation_code( self, code ): + self._exception_translation_code = code + exception_translation_code = property( _get_exception_translation_code, _set_exception_translation_code + , doc="C++ exception to Python exception translation code" \ + +"\nExample: PyErr_SetString(PyExc_RuntimeError, exc.what()); " \ + +"\nPy++ will generate the rest of the code." \ + +"\nPay attention: the exception variable name is exc." ) + + def translate_exception_to_string( self, python_exception_type, to_string ): + """registers exception translation to string + + @param python_exception_type: Python exception type, for example PyExc_RuntimeError + @type python_exception_type: str + + @param to_string: C++ expression that extracts information from exception. + The type of expression should be char*. + @type to_string: str + """ + #NICE TO HAVE: + #1. exception\assert\warning should be raised if python_exception_type + # does not contain valid Python exception + #2. Py++ can validate, that member function returns char* + code = "PyErr_SetString( %(exception_type)s, %(to_string)s ); " \ + % { 'exception_type' : python_exception_type, 'to_string' : to_string } + self.exception_translation_code = code + def add_declaration_code( self, code ): """adds the code to the declaration section""" self.declaration_code.append( user_text.user_text_t( code ) ) Modified: pyplusplus_dev/pyplusplus/module_creator/creator.py =================================================================== --- pyplusplus_dev/pyplusplus/module_creator/creator.py 2006-08-26 07:16:06 UTC (rev 470) +++ pyplusplus_dev/pyplusplus/module_creator/creator.py 2006-08-26 07:32:22 UTC (rev 471) @@ -743,6 +743,14 @@ class_inst.remove_creator( static_method ) class_inst.adopt_creator( static_method ) + if temp_curr_decl.exception_translation_code: + translator = code_creators.exception_translator_t( temp_curr_decl ) + self.__extmodule.adopt_declaration_creator( translator ) + class_inst.user_declarations.append( translator ) + translator_register \ + = code_creators.exception_translator_register_t( temp_curr_decl, translator ) + class_inst.adopt_creator( translator_register ) + self.curr_decl = temp_curr_decl self.curr_code_creator = temp_curr_parent Modified: pyplusplus_dev/unittests/cppexceptions_tester.py =================================================================== --- pyplusplus_dev/unittests/cppexceptions_tester.py 2006-08-26 07:16:06 UTC (rev 470) +++ pyplusplus_dev/unittests/cppexceptions_tester.py 2006-08-26 07:32:22 UTC (rev 471) @@ -38,26 +38,30 @@ , *args ) def customize( self, mb ): - mb.class_( 'custom_exception_t' ).add_code( REGISTER_CODE, False) - mb.build_code_creator( tester_t.EXTENSION_NAME ) + #mb.class_( 'custom_exception_t' ).add_code( REGISTER_CODE, False) + #mb.build_code_creator( tester_t.EXTENSION_NAME ) - mb.code_creator.add_include( "boost/bind.hpp" ) - mb.code_creator.add_include( "iostream" ) - translate = code_creators.custom_text_t( TRANSLATE_CODE ) - mb.code_creator.adopt_creator( translate, -1 ) + #mb.code_creator.add_include( "boost/bind.hpp" ) + #mb.code_creator.add_include( "iostream" ) + #translate = code_creators.custom_text_t( TRANSLATE_CODE ) + #mb.code_creator.adopt_creator( translate, -1 ) + custom_exception = mb.class_( 'custom_exception_t' ) + custom_exception.translate_exception_to_string( 'PyExc_RuntimeError', 'exc.what().c_str()' ) def run_tests( self, module): - custom_exception_t = module.custom_exception_t - bases = list( custom_exception_t.__bases__ ) + [RuntimeError] - custom_exception_t.__bases__ = tuple( bases ) - custom_exception_t.__str__ = custom_exception_t.what try: module.throw_custom_exception() except RuntimeError, error: - self.failUnless( str(error) == "profe of concept" ) + self.failUnless( "profe of concept" in str( error ) ) + #custom_exception_t = module.custom_exception_t + #bases = list( custom_exception_t.__bases__ ) + [RuntimeError] + #custom_exception_t.__bases__ = tuple( bases ) + #custom_exception_t.__str__ = custom_exception_t.what + #try: + #module.throw_custom_exception() + #except RuntimeError, error: + #self.failUnless( str(error) == "profe of concept" ) - - def create_suite(): suite = unittest.TestSuite() suite.addTest( unittest.makeSuite(tester_t)) Modified: pyplusplus_dev/unittests/data/cppexceptions_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/cppexceptions_to_be_exported.hpp 2006-08-26 07:16:06 UTC (rev 470) +++ pyplusplus_dev/unittests/data/cppexceptions_to_be_exported.hpp 2006-08-26 07:32:22 UTC (rev 471) @@ -1,15 +1,15 @@ -// Copyright 2004 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) - -#ifndef __cppexceptions_to_be_exported_hpp__ -#define __cppexceptions_to_be_exported_hpp__ +// Copyright 2004 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) +#ifndef __cppexceptions_to_be_exported_hpp__ +#define __cppexceptions_to_be_exported_hpp__ + #include <string> - -namespace cppexceptions{ +namespace cppexceptions{ + struct custom_exception_t{ custom_exception_t( const std::string& error ) : m_error( error ) @@ -18,7 +18,7 @@ const std::string& what() const{ return m_error; } - + private: const std::string m_error; }; @@ -27,6 +27,6 @@ throw custom_exception_t( "profe of concept" ); } -} - +} + #endif//__cppexceptions_to_be_exported_hpp__ Modified: pyplusplus_dev/unittests/test_all.py =================================================================== --- pyplusplus_dev/unittests/test_all.py 2006-08-26 07:16:06 UTC (rev 470) +++ pyplusplus_dev/unittests/test_all.py 2006-08-26 07:32:22 UTC (rev 471) @@ -58,6 +58,7 @@ import vector3_tester import default_args_tester import unnamed_classes_tester +import cppexceptions_tester def create_suite(times): testers = [ @@ -112,6 +113,7 @@ , abstract_classes_tester , indexing_suites2_tester , unnamed_classes_tester + , cppexceptions_tester ] main_suite = unittest.TestSuite() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mb...@us...> - 2006-08-26 07:16:13
|
Revision: 470 Author: mbaas Date: 2006-08-26 00:16:06 -0700 (Sat, 26 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=470&view=rev Log Message: ----------- Call policies passed to cdef() were ignored. This is fixed now. Modified Paths: -------------- pyplusplus_dev/contrib/pypp_api/pypp_api/declwrapper.py Modified: pyplusplus_dev/contrib/pypp_api/pypp_api/declwrapper.py =================================================================== --- pyplusplus_dev/contrib/pypp_api/pypp_api/declwrapper.py 2006-08-25 22:16:54 UTC (rev 469) +++ pyplusplus_dev/contrib/pypp_api/pypp_api/declwrapper.py 2006-08-26 07:16:06 UTC (rev 470) @@ -307,7 +307,8 @@ else: args = ['"%s"'%name, fn] if policies!=None: - pass # todo + policystr = policies.create(None) + args.append(policystr) if keywords!=None: args.append("(%s)"%", ".join(map(lambda x: "bp::"+str(x), keywords))) if doc!=None: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2006-08-25 22:16:56
|
Revision: 469 Author: allenb Date: 2006-08-25 15:16:54 -0700 (Fri, 25 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=469&view=rev Log Message: ----------- - Cache the member_access_type. This change makes my build generation script run ~3x faster. Your mileage may vary. Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/class_declaration.py Modified: pygccxml_dev/pygccxml/declarations/class_declaration.py =================================================================== --- pygccxml_dev/pygccxml/declarations/class_declaration.py 2006-08-25 18:24:08 UTC (rev 468) +++ pygccxml_dev/pygccxml/declarations/class_declaration.py 2006-08-25 22:16:54 UTC (rev 469) @@ -315,12 +315,20 @@ @return: L{ACCESS_TYPES} """ - assert member.parent is self - if member in self.public_members: - return ACCESS_TYPES.PUBLIC - elif member in self.protected_members: - return ACCESS_TYPES.PROTECTED - elif member in self.private_members: - return ACCESS_TYPES.PRIVATE + assert member.parent is self + cached_access_type = getattr(member, "_cached_access_type", None) + if cached_access_type: + return cached_access_type else: - raise RuntimeError( "Unable to find member within internal members list." ) + access_type = None + if member in self.public_members: + access_type = ACCESS_TYPES.PUBLIC + elif member in self.protected_members: + access_type = ACCESS_TYPES.PROTECTED + elif member in self.private_members: + access_type = ACCESS_TYPES.PRIVATE + else: + raise RuntimeError( "Unable to find member within internal members list." ) + setattr(member, "_cached_access_type", access_type) + return access_type + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-25 18:24:31
|
Revision: 468 Author: roman_yakovenko Date: 2006-08-25 11:24:08 -0700 (Fri, 25 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=468&view=rev Log Message: ----------- Fixing AttributeError bug, adding test cases Modified Paths: -------------- pyplusplus_dev/unittests/data/member_variables_to_be_exported.cpp pyplusplus_dev/unittests/data/member_variables_to_be_exported.hpp Modified: pyplusplus_dev/unittests/data/member_variables_to_be_exported.cpp =================================================================== --- pyplusplus_dev/unittests/data/member_variables_to_be_exported.cpp 2006-08-25 18:23:07 UTC (rev 467) +++ pyplusplus_dev/unittests/data/member_variables_to_be_exported.cpp 2006-08-25 18:24:08 UTC (rev 468) @@ -1,45 +1,44 @@ -// Copyright 2004 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) - -#include "member_variables_to_be_exported.hpp" - -namespace member_variables{ - -int point::instance_count = 0; -const point::color point::default_color = point::red; - -unsigned int get_a(const bit_fields_t& inst){ - return inst.a; -} - -void set_a( bit_fields_t& inst, unsigned int new_value ){ - inst.a = new_value; -} - -unsigned int get_b(const bit_fields_t& inst){ - return inst.b; -} - -namespace pointers{ - -std::auto_ptr<tree_node_t> create_tree(){ - std::auto_ptr<tree_node_t> root( new tree_node_t() ); - root->data = new data_t(); - root->data->value = 0; - - root->left = new tree_node_t( root.get() ); - root->left->data = new data_t(); - root->left->data->value = 1; - - return root; -} - -} +// Copyright 2004 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) +#include "member_variables_to_be_exported.hpp" + +namespace member_variables{ + +int point::instance_count = 0; +const point::color point::default_color = point::red; + +unsigned int get_a(const bit_fields_t& inst){ + return inst.a; +} + +void set_a( bit_fields_t& inst, unsigned int new_value ){ + inst.a = new_value; +} + +unsigned int get_b(const bit_fields_t& inst){ + return inst.b; +} + +namespace pointers{ + +std::auto_ptr<tree_node_t> create_tree(){ + std::auto_ptr<tree_node_t> root( new tree_node_t() ); + root->data = new data_t(); + root->data->value = 0; + + root->left = new tree_node_t( root.get() ); + root->left->data = new data_t(); + root->left->data->value = 1; + + return root; +} + +} + namespace statics{ std::string mem_var_str_t::class_name( "mem_var_str_t" ); -} -} - +} +} Modified: pyplusplus_dev/unittests/data/member_variables_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/member_variables_to_be_exported.hpp 2006-08-25 18:23:07 UTC (rev 467) +++ pyplusplus_dev/unittests/data/member_variables_to_be_exported.hpp 2006-08-25 18:24:08 UTC (rev 468) @@ -1,139 +1,139 @@ -// Copyright 2004 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) - -#ifndef __member_variables_to_be_exported_hpp__ -#define __member_variables_to_be_exported_hpp__ -#include <memory> +// Copyright 2004 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) + +#ifndef __member_variables_to_be_exported_hpp__ +#define __member_variables_to_be_exported_hpp__ +#include <memory> #include <string> - -namespace member_variables{ - -struct point{ - enum color{ red, green, blue }; - - point() - : prefered_color( blue ) - , x( -1 ) - , y( 2 ) - {++instance_count;} - - point( const point& other ) - : prefered_color( other.prefered_color ) - , x( other.x ) - , y( other.y ) - {} - - ~point() - { --instance_count; } - - int x; - int y; - const color prefered_color; - static int instance_count; - static const color default_color; -}; - -struct bit_fields_t{ - bit_fields_t() - : b(28){} - unsigned int a : 1; - unsigned int : 0; - const unsigned int b : 11; -}; - -unsigned int get_a(const bit_fields_t& inst); -void set_a( bit_fields_t& inst, unsigned int new_value ); -unsigned int get_b(const bit_fields_t& inst); - -struct array_t{ - array_t(){ - for( int i = 0; i < 10; ++i ){ - ivars[i] = -i; - } - } - - struct variable_t{ - variable_t() : value(-9){} - int value; - }; - - int get_ivars_item( int index ){ - return ivars[index]; - } - - const variable_t vars[3]; - int ivars[10]; - int ivars2[10]; -}; - -namespace pointers{ - -struct data_t{ - data_t() : value( 201 ) {} - int value; - static char* reserved; -}; - -struct tree_node_t{ - data_t *data; - tree_node_t *left; - tree_node_t *right; - const tree_node_t *parent; - - tree_node_t(const tree_node_t* parent=0) - : data(0) - , left( 0 ) - , right( 0 ) - , parent( parent ) - {} - - ~tree_node_t(){ - if( left ){ - delete left; - } - if( right ){ - delete right; - } - if( data ){ - delete data; - } - } -}; - -std::auto_ptr<tree_node_t> create_tree(); - -} - -namespace reference{ - -enum EFruit{ apple, orange }; - -struct fundamental_t{ - fundamental_t( EFruit& fruit, const int& i ) - : m_fruit( fruit ), m_i( i ) - {} - - EFruit& m_fruit; - const int& m_i; -}; - -struct A{}; - - -struct B { - B( A& a_ ): a( a_ ){} - A& a; -}; - -struct C { - C( A& a_ ): a( a_ ){} - const A& a; -}; -} +namespace member_variables{ +struct point{ + enum color{ red, green, blue }; + + point() + : prefered_color( blue ) + , x( -1 ) + , y( 2 ) + {++instance_count;} + + point( const point& other ) + : prefered_color( other.prefered_color ) + , x( other.x ) + , y( other.y ) + {} + + ~point() + { --instance_count; } + + int x; + int y; + const color prefered_color; + static int instance_count; + static const color default_color; +}; + +struct bit_fields_t{ + bit_fields_t() + : b(28){} + unsigned int a : 1; + unsigned int : 0; + const unsigned int b : 11; +}; + +unsigned int get_a(const bit_fields_t& inst); +void set_a( bit_fields_t& inst, unsigned int new_value ); +unsigned int get_b(const bit_fields_t& inst); + +struct array_t{ + array_t(){ + for( int i = 0; i < 10; ++i ){ + ivars[i] = -i; + } + } + + struct variable_t{ + variable_t() : value(-9){} + int value; + }; + + int get_ivars_item( int index ){ + return ivars[index]; + } + + const variable_t vars[3]; + int ivars[10]; + int ivars2[10]; +}; + +namespace pointers{ + +struct data_t{ + data_t() : value( 201 ) {} + int value; + static char* reserved; +}; + +struct tree_node_t{ + data_t *data; + tree_node_t *left; + tree_node_t *right; + const tree_node_t *parent; + + tree_node_t(const tree_node_t* parent=0) + : data(0) + , left( 0 ) + , right( 0 ) + , parent( parent ) + {} + + ~tree_node_t(){ + if( left ){ + delete left; + } + if( right ){ + delete right; + } + if( data ){ + delete data; + } + } +}; + +std::auto_ptr<tree_node_t> create_tree(); + +} + +namespace reference{ + +enum EFruit{ apple, orange }; + +struct fundamental_t{ + fundamental_t( EFruit& fruit, const int& i ) + : m_fruit( fruit ), m_i( i ) + {} + + EFruit& m_fruit; + const int& m_i; +}; + +struct A{}; + + +struct B { + B( A& a_ ): a( a_ ){} + A& a; +}; + +struct C { + C( A& a_ ): a( a_ ){} + const A& a; +}; + +} + namespace statics{ struct mem_var_str_t{ @@ -142,6 +142,20 @@ }; } - -} -#endif//__member_variables_to_be_exported_hpp__ + +namespace bugs{ +struct allocator_ { + void * (*alloc) (unsigned); + void (*dispose) (void *p); +}; + +typedef struct allocator_ *allocator_t; + +struct faulty { + allocator_t allocator; +}; + +} + +} +#endif//__member_variables_to_be_exported_hpp__ \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-25 18:23:43
|
Revision: 467 Author: roman_yakovenko Date: 2006-08-25 11:23:07 -0700 (Fri, 25 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=467&view=rev Log Message: ----------- Fixing AttributeError bug Modified Paths: -------------- pyplusplus_dev/pyplusplus/code_creators/member_variable.py Modified: pyplusplus_dev/pyplusplus/code_creators/member_variable.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/member_variable.py 2006-08-25 03:13:02 UTC (rev 466) +++ pyplusplus_dev/pyplusplus/code_creators/member_variable.py 2006-08-25 18:23:07 UTC (rev 467) @@ -207,7 +207,7 @@ setter_type = property( _get_setter_type ) def _get_has_setter( self ): - return not declarations.is_const( self.declaration.type.base ) + return not declarations.is_const( self.declaration.type ) has_setter = property( _get_has_setter ) def _create_impl(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |