pygccxml-commit Mailing List for C++ Python language bindings (Page 37)
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: <rom...@us...> - 2007-03-25 09:54:14
|
Revision: 958 http://svn.sourceforge.net/pygccxml/?rev=958&view=rev Author: roman_yakovenko Date: 2007-03-25 02:54:13 -0700 (Sun, 25 Mar 2007) Log Message: ----------- another attempt to solve "transfer ownership" problem Modified Paths: -------------- pyplusplus_dev/pyplusplus/code_creators/calldef.py pyplusplus_dev/pyplusplus/code_creators/class_declaration.py pyplusplus_dev/pyplusplus/code_creators/smart_pointers.py pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py pyplusplus_dev/pyplusplus/module_creator/creator.py pyplusplus_dev/unittests/data/transfer_ownership_to_be_exported.hpp pyplusplus_dev/unittests/indexing_suites2_tester.py pyplusplus_dev/unittests/transfer_ownership_tester.py Added Paths: ----------- pyplusplus_dev/unittests/data/transfer_ownership_old_to_be_exported.hpp pyplusplus_dev/unittests/transfer_ownership_old_tester.py Modified: pyplusplus_dev/pyplusplus/code_creators/calldef.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/calldef.py 2007-03-21 22:51:36 UTC (rev 957) +++ pyplusplus_dev/pyplusplus/code_creators/calldef.py 2007-03-25 09:54:13 UTC (rev 958) @@ -862,8 +862,9 @@ result.append( self.parent.wrapper_alias ) result.append( '(' ) args = [] - if not self.target_configuration.boost_python_has_wrapper_held_type: - args.append( 'PyObject*' ) + if not self.target_configuration.boost_python_has_wrapper_held_type \ + or self.declaration.parent.require_self_reference: + args.append( 'PyObject* self' ) args_decl = self.args_declaration() if args_decl: args.append( args_decl ) @@ -905,17 +906,18 @@ """ Creates wrapper class constructor from wrapped class instance. """ - def __init__( self, class_inst ): + def __init__( self, constructor ): code_creator.code_creator_t.__init__( self ) - declaration_based.declaration_based_t.__init__( self, declaration=class_inst ) + declaration_based.declaration_based_t.__init__( self, declaration=constructor ) def _create_declaration(self): result = [] - result.append( self.parent.wrapper_alias ) + result.append( self.parent.declaration.wrapper_alias ) result.append( '(' ) - if not self.target_configuration.boost_python_has_wrapper_held_type: - result.append( 'PyObject*, ' ) - declarated = declarations.declarated_t( self.declaration ) + if not self.target_configuration.boost_python_has_wrapper_held_type \ + or self.declaration.parent.require_self_reference: + result.append( 'PyObject* self, ' ) + declarated = declarations.declarated_t( self.declaration.parent ) const_decl = declarations.const_t( declarated ) const_ref_decl = declarations.reference_t( const_decl ) identifier = algorithm.create_identifier( self, const_ref_decl.decl_string ) @@ -933,7 +935,7 @@ answer.append( ': ' + self._create_constructor_call() ) answer.append( ' , ' + self.parent.boost_wrapper_identifier + '(){' ) answer.append( self.indent( '// copy constructor' ) ) - answer.append( self.indent( self.declaration.copy_constructor_body ) ) + answer.append( self.indent( self.parent.declaration.copy_constructor_body ) ) answer.append( '}' ) return os.linesep.join( answer ) @@ -943,22 +945,23 @@ """ Creates wrapper for compiler generated null constructor. """ - def __init__( self, class_inst ): + def __init__( self, constructor ): code_creator.code_creator_t.__init__( self ) - declaration_based.declaration_based_t.__init__( self, declaration=class_inst ) - + declaration_based.declaration_based_t.__init__( self, declaration=constructor ) + def _create_constructor_call( self ): return algorithm.create_identifier( self, self.parent.declaration.decl_string ) + '()' def _create_impl(self): - answer = [ self.parent.wrapper_alias + '(' ] - if not self.target_configuration.boost_python_has_wrapper_held_type: - answer[0] = answer[0] + 'PyObject*' + answer = [ self.parent.declaration.wrapper_alias + '(' ] + if not self.target_configuration.boost_python_has_wrapper_held_type \ + or self.declaration.parent.require_self_reference: + answer[0] = answer[0] + 'PyObject* self' answer[0] = answer[0] + ')' answer.append( ': ' + self._create_constructor_call() ) answer.append( ' , ' + self.parent.boost_wrapper_identifier + '(){' ) answer.append( self.indent( '// null constructor' ) ) - answer.append( self.indent( self.declaration.null_constructor_body ) ) + answer.append( self.indent( self.parent.declaration.null_constructor_body ) ) answer.append( '}' ) return os.linesep.join( answer ) Modified: pyplusplus_dev/pyplusplus/code_creators/class_declaration.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/class_declaration.py 2007-03-21 22:51:36 UTC (rev 957) +++ pyplusplus_dev/pyplusplus/code_creators/class_declaration.py 2007-03-25 09:54:13 UTC (rev 958) @@ -178,11 +178,17 @@ held_type = self._generated_held_type() if self.wrapper: - if not self.target_configuration.boost_python_has_wrapper_held_type: + if not self.target_configuration.boost_python_has_wrapper_held_type \ + or self.declaration.require_self_reference: args.append( algorithm.create_identifier( self, self.declaration.decl_string ) ) - args.append( self.wrapper.full_name ) + if self.declaration.require_self_reference: + if not held_type: + args.append( self.wrapper.full_name ) + else: + args.append( self.wrapper.full_name ) else: args.append( algorithm.create_identifier( self, self.declaration.decl_string ) ) + bases = self._generate_bases(base_creators) if bases: args.append( bases ) Modified: pyplusplus_dev/pyplusplus/code_creators/smart_pointers.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/smart_pointers.py 2007-03-21 22:51:36 UTC (rev 957) +++ pyplusplus_dev/pyplusplus/code_creators/smart_pointers.py 2007-03-25 09:54:13 UTC (rev 958) @@ -67,7 +67,8 @@ and self.class_creator.held_type \ and isinstance( self.class_creator.held_type, held_type_t ) \ and self.class_creator.held_type.smart_ptr == self.smart_ptr \ - and self.target_configuration.boost_python_has_wrapper_held_type: + and self.target_configuration.boost_python_has_wrapper_held_type \ + and not self.class_creator.declaration.require_self_reference: return '' #boost.python does it automaticly rptp = algorithm.create_identifier( self, '::boost::python::register_ptr_to_python' ) held_type = held_type_t(self.smart_ptr).create( self ) Modified: pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py 2007-03-21 22:51:36 UTC (rev 957) +++ pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py 2007-03-25 09:54:13 UTC (rev 958) @@ -194,7 +194,8 @@ self._exception_translation_code = None self._properties = [] self._redefined_funcs = None - + self._require_self_reference = False + def _get_redefine_operators( self ): return self._redefine_operators def _set_redefine_operators( self, new_value ): @@ -528,3 +529,10 @@ if self.member_operators( is_assign, allow_empty=True, recursive=False ): return impl_details.GAEUS_VALUES.ALWAYS_TRUE return super(class_t, self).guess_always_expose_using_scope_value() + + def _get_require_self_reference(self): + return self._require_self_reference + def _set_require_self_reference(self, require_self_reference): + self._require_self_reference = require_self_reference + require_self_reference = property( _get_require_self_reference, _set_require_self_reference + , doc="boolean, if True the first argument to the constructor will be reference to self object" ) Modified: pyplusplus_dev/pyplusplus/module_creator/creator.py =================================================================== --- pyplusplus_dev/pyplusplus/module_creator/creator.py 2007-03-21 22:51:36 UTC (rev 957) +++ pyplusplus_dev/pyplusplus/module_creator/creator.py 2007-03-25 09:54:13 UTC (rev 958) @@ -626,12 +626,12 @@ #~ #to construct wrapper from wrapped classe copy_constr = self.curr_decl.constructor( lambda c: c.is_copy_constructor, recursive=False ) if not self.curr_decl.noncopyable and copy_constr.is_artificial: - copy_constr = code_creators.copy_constructor_wrapper_t( class_inst=self.curr_decl ) - wrapper.adopt_creator( copy_constr ) + cccc = code_creators.copy_constructor_wrapper_t( constructor=copy_constr ) + wrapper.adopt_creator( cccc ) null_constr = declarations.find_trivial_constructor(self.curr_decl) if null_constr and null_constr.is_artificial: #this constructor is not going to be exposed - tcons = code_creators.null_constructor_wrapper_t( class_inst=self.curr_decl ) + tcons = code_creators.null_constructor_wrapper_t( constructor=null_constr ) wrapper.adopt_creator( tcons ) exposed = self.expose_overloaded_mem_fun_using_macro( cls_decl, cls_cc ) Added: pyplusplus_dev/unittests/data/transfer_ownership_old_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/transfer_ownership_old_to_be_exported.hpp (rev 0) +++ pyplusplus_dev/unittests/data/transfer_ownership_old_to_be_exported.hpp 2007-03-25 09:54:13 UTC (rev 958) @@ -0,0 +1,9 @@ +#ifndef __transfer_ownership_old_to_be_exported_hpp__ +#define __transfer_ownership_old_to_be_exported_hpp__ + +#include <iostream> + +#include "transfer_ownership_to_be_exported.hpp" + + +#endif//__transfer_ownership_old_to_be_exported_hpp__ Modified: pyplusplus_dev/unittests/data/transfer_ownership_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/transfer_ownership_to_be_exported.hpp 2007-03-21 22:51:36 UTC (rev 957) +++ pyplusplus_dev/unittests/data/transfer_ownership_to_be_exported.hpp 2007-03-25 09:54:13 UTC (rev 958) @@ -8,7 +8,7 @@ notify(); } protected: - virtual void notify() = 0; + virtual void notify(){}; }; struct do_nothing_t : event_t{ @@ -22,6 +22,10 @@ m_event = event; }; + const event_t* get_event(){ + return m_event; + } + void run() { m_event->invoke(); delete m_event; Modified: pyplusplus_dev/unittests/indexing_suites2_tester.py =================================================================== --- pyplusplus_dev/unittests/indexing_suites2_tester.py 2007-03-21 22:51:36 UTC (rev 957) +++ pyplusplus_dev/unittests/indexing_suites2_tester.py 2007-03-25 09:54:13 UTC (rev 958) @@ -54,6 +54,8 @@ self.failUnless( kv.key == "x" and kv.value == "y" ) for k, v in name2value: self.failUnless( k == "x" and v == "y" ) + for k, v in name2value.iteritems(): + self.failUnless( k == "x" and v == "y" ) items_ptr = module.items_ptr_t() items_ptr.append( item ) Added: pyplusplus_dev/unittests/transfer_ownership_old_tester.py =================================================================== --- pyplusplus_dev/unittests/transfer_ownership_old_tester.py (rev 0) +++ pyplusplus_dev/unittests/transfer_ownership_old_tester.py 2007-03-25 09:54:13 UTC (rev 958) @@ -0,0 +1,128 @@ +# 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 +from pyplusplus import code_creators +from pyplusplus.module_builder import call_policies +from pyplusplus import function_transformers as ft + +decref_code = \ +""" +virtual ~%(cls)s(){ + Py_DECREF( boost::python::detail::wrapper_base_::get_owner(*this) ); +// if (this->m_pyobj) { +// Py_DECREF(this->m_pyobj); +// this->m_pyobj = 0; +// } +} +""" + +incref_code = \ +""" +//if( !this->m_pyobj) { + //this->m_pyobj = boost::python::detail::wrapper_base_::get_owner(*this); + std::cout << "py owner id: " << (int)(boost::python::detail::wrapper_base_::get_owner(*this)); + //Py_INCREF(this->m_pyobj); +//} +""" + +impl_conv_code = \ +""" +boost::python::implicitly_convertible< std::auto_ptr< %(from)s >, std::auto_ptr< %(to)s > >(); +""" + +register_sptr = \ +""" +boost::python::register_ptr_to_python< %s >(); +""" + +class tester_t(fundamental_tester_base.fundamental_tester_base_t): + EXTENSION_NAME = 'transfer_ownership_old' + + def __init__( self, *args ): + fundamental_tester_base.fundamental_tester_base_t.__init__( + self + , tester_t.EXTENSION_NAME + , *args ) + + def customize( self, mb ): + event_clss = mb.classes( lambda cls: cls.name in ( 'event_t', 'do_nothing_t' ) ) + for cls in event_clss: + cls.require_self_reference = True + cls.set_constructors_body( 'Py_INCREF(self); std::cout<< "self: " << (int)(self) << "\\n" << (int)( boost::python::detail::wrapper_base_::get_owner(*this));' ) + cls.add_wrapper_code( decref_code % { 'cls' : cls.wrapper_alias } ) + #~ cls.add_wrapper_code( 'PyObject* m_pyobj;' ) + #~ cls.set_constructors_body( 'm_pyobj=0;' ) + cls.mem_fun( 'notify' ).add_override_precall_code( incref_code ) + #~ cls.mem_fun( 'notify' ).add_default_precall_code( incref_code ) + + cls.held_type = 'std::auto_ptr< %s >' % cls.wrapper_alias + cls.add_registration_code( register_sptr % 'std::auto_ptr< %s >' % cls.decl_string, False ) + cls.add_registration_code( register_sptr % 'std::auto_ptr< %s >' % cls.wrapper_alias, False ) + #~ cls.held_type = 'std::auto_ptr< %s >' % cls.decl_string + cls.add_registration_code( impl_conv_code % { 'from' : cls.wrapper_alias + , 'to' : cls.decl_string } + , False) + for base in cls.recursive_bases: + if base.access_type == 'public': + cls.add_registration_code( #from class to its base + impl_conv_code % { 'from' : cls.decl_string + , 'to' : base.related_class.decl_string } + , False) + + cls.add_registration_code( #from wrapper to clas base class + impl_conv_code % { 'from' : cls.wrapper_alias + , 'to' : base.related_class.decl_string } + , False) + + simulator = mb.class_( 'simulator_t' ) + simulator.mem_fun( 'get_event' ).call_policies \ + = call_policies.return_internal_reference() + schedule = mb.mem_fun( 'schedule' ) + schedule.add_transformation( ft.transfer_ownership(0), alias='schedule' ) + + def run_tests( self, module): + class py_event_t( module.event_t ): + def __init__( self, container ): + module.event_t.__init__( self ) + self.container = container + + def notify( self ): + print 'notify' + self.container.append( 1 ) + + print 'test started' + notify_data = [] + simulator = module.simulator_t() + print 'simulator created' + event = py_event_t( notify_data ) + print 'py_event_t created: ', id( event ) + simulator.schedule( event ) + print 'event was shceduled' + print 'event refcount: ', sys.getrefcount( event ) + print 'simulator refcount: ', sys.getrefcount( simulator ) + #del event + print 'event was deleted' + event = simulator.get_event() + print 'event was restored via saved reference in simulator: ', id( event ) + print 'event refcount: ', sys.getrefcount( simulator.get_event() ) + #print 'call event.notify(): ', simulator.get_event().notify() + print 'call simulator.run()' + simulator.run() + self.failUnless( notify_data[0] == 1 ) + +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/transfer_ownership_tester.py =================================================================== --- pyplusplus_dev/unittests/transfer_ownership_tester.py 2007-03-21 22:51:36 UTC (rev 957) +++ pyplusplus_dev/unittests/transfer_ownership_tester.py 2007-03-25 09:54:13 UTC (rev 958) @@ -9,6 +9,7 @@ import fundamental_tester_base from pyplusplus import code_creators from pyplusplus import function_transformers as ft +from pyplusplus.module_builder import call_policies decref_code = \ """ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2007-03-21 22:51:36
|
Revision: 957 http://svn.sourceforge.net/pygccxml/?rev=957&view=rev Author: allenb Date: 2007-03-21 15:51:36 -0700 (Wed, 21 Mar 2007) Log Message: ----------- - Add a fallback method of getting the template class Modified Paths: -------------- pyplusplus_dev/contrib/goodies/goodie_utils.py Modified: pyplusplus_dev/contrib/goodies/goodie_utils.py =================================================================== --- pyplusplus_dev/contrib/goodies/goodie_utils.py 2007-03-12 12:36:39 UTC (rev 956) +++ pyplusplus_dev/contrib/goodies/goodie_utils.py 2007-03-21 22:51:36 UTC (rev 957) @@ -189,7 +189,12 @@ """ # Look up the decl from the alias db # XXX: I don't know if this is the best way to look up the decl, but it seems to work - self.mDecl = templateBuilder.mAliasDB[self.mTypedefName].declaration.type.declaration + try: + self.mDecl = templateBuilder.mAliasDB[self.mTypedefName].declaration.type.declaration + except: + # If that didn't work, just try to get it from the first declaration + self.mDecl = templateBuilder.mAliasDB[self.mTypedefName].declaration + # Another method # decl_name = templateBuilder.mAliasDB[self.mTypedefName].declaration.name # decl = ns.decl(decl_name) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-03-12 12:36:44
|
Revision: 956 http://svn.sourceforge.net/pygccxml/?rev=956&view=rev Author: roman_yakovenko Date: 2007-03-12 05:36:39 -0700 (Mon, 12 Mar 2007) Log Message: ----------- fixing constructor comment Modified Paths: -------------- pyplusplus_dev/pyplusplus/code_creators/calldef.py Modified: pyplusplus_dev/pyplusplus/code_creators/calldef.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/calldef.py 2007-03-11 11:10:10 UTC (rev 955) +++ pyplusplus_dev/pyplusplus/code_creators/calldef.py 2007-03-12 12:36:39 UTC (rev 956) @@ -885,8 +885,13 @@ def _create_impl(self): answer = [ self._create_declaration() ] answer.append( ': ' + self._create_constructor_call() ) - answer.append( ' , ' + self.parent.boost_wrapper_identifier + '()' ) - answer.append( '{ // Normal constructor' ) + answer.append( ' , ' + self.parent.boost_wrapper_identifier + '(){' ) + if( self.declaration.is_copy_constructor ): + answer.append( self.indent( '// copy constructor' ) ) + elif not self.declaration.arguments: + answer.append( self.indent( '// null constructor' ) ) + else: + answer.append( self.indent( '// constructor' ) ) answer.append( self.declaration.body ) answer.append( '}' ) return os.linesep.join( answer ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-03-11 11:12:25
|
Revision: 955 http://svn.sourceforge.net/pygccxml/?rev=955&view=rev Author: roman_yakovenko Date: 2007-03-11 04:10:10 -0700 (Sun, 11 Mar 2007) Log Message: ----------- correcting small bug in generating wrapper copy constructors Modified Paths: -------------- pyplusplus_dev/pyplusplus/module_creator/creator.py pyplusplus_dev/unittests/data/operators_bug_to_be_exported.hpp pyplusplus_dev/unittests/operators_bug_tester.py Modified: pyplusplus_dev/pyplusplus/module_creator/creator.py =================================================================== --- pyplusplus_dev/pyplusplus/module_creator/creator.py 2007-03-08 07:33:42 UTC (rev 954) +++ pyplusplus_dev/pyplusplus/module_creator/creator.py 2007-03-11 11:10:10 UTC (rev 955) @@ -622,9 +622,10 @@ else: self.__extmodule.adopt_declaration_creator( wrapper ) if declarations.has_trivial_copy( self.curr_decl ): - #I don't know but sometimes boost.python requieres - #to construct wrapper from wrapped classe - if not self.curr_decl.noncopyable: + #~ #I don't know but sometimes boost.python requieres + #~ #to construct wrapper from wrapped classe + copy_constr = self.curr_decl.constructor( lambda c: c.is_copy_constructor, recursive=False ) + if not self.curr_decl.noncopyable and copy_constr.is_artificial: copy_constr = code_creators.copy_constructor_wrapper_t( class_inst=self.curr_decl ) wrapper.adopt_creator( copy_constr ) null_constr = declarations.find_trivial_constructor(self.curr_decl) Modified: pyplusplus_dev/unittests/data/operators_bug_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/operators_bug_to_be_exported.hpp 2007-03-08 07:33:42 UTC (rev 954) +++ pyplusplus_dev/unittests/data/operators_bug_to_be_exported.hpp 2007-03-11 11:10:10 UTC (rev 955) @@ -6,6 +6,8 @@ #ifndef __operators_bug_to_be_exported_hpp__ #define __operators_bug_to_be_exported_hpp__ +#include <string> + namespace operators_bug{ template< typename derived_type, typename value_type > @@ -46,7 +48,19 @@ }; +struct call_copy_constructor_t{ + explicit call_copy_constructor_t( const std::string& x ) + {} + + call_copy_constructor_t( const call_copy_constructor_t& x ){}; + + call_copy_constructor_t& operator=( const call_copy_constructor_t& x ){ + return *this; + } + + virtual void do_nothing(){} +}; } -#endif//__operators_bug_to_be_exported_hpp__ \ No newline at end of file +#endif//__operators_bug_to_be_exported_hpp__ Modified: pyplusplus_dev/unittests/operators_bug_tester.py =================================================================== --- pyplusplus_dev/unittests/operators_bug_tester.py 2007-03-08 07:33:42 UTC (rev 954) +++ pyplusplus_dev/unittests/operators_bug_tester.py 2007-03-11 11:10:10 UTC (rev 955) @@ -24,6 +24,7 @@ tg = code_creators.target_configuration_t( ) #tg.boost_python_has_wrapper_held_type = False mb.build_code_creator( self.EXTENSION_NAME, target_configuration=tg ) + mb.constructors().allow_implicit_conversion = False def run_tests(self, module): i = module.integral() @@ -31,6 +32,9 @@ j = i + i v = module.vector( 2 ) + module.vector.one self.failUnless( v.x == 3 ) + + call_copy_constructor = module.call_copy_constructor_t( "" ) + call_copy_constructor2 = module.call_copy_constructor_t( call_copy_constructor ) def create_suite(): suite = unittest.TestSuite() @@ -41,4 +45,4 @@ unittest.TextTestRunner(verbosity=2).run( create_suite() ) if __name__ == "__main__": - run_suite() \ No newline at end of file + run_suite() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-03-08 07:33:42
|
Revision: 954 http://svn.sourceforge.net/pygccxml/?rev=954&view=rev Author: roman_yakovenko Date: 2007-03-07 23:33:42 -0800 (Wed, 07 Mar 2007) Log Message: ----------- adding new use-case to the test Modified Paths: -------------- pyplusplus_dev/unittests/custom_string_tester.py pyplusplus_dev/unittests/data/custom_string_to_be_exported.hpp Modified: pyplusplus_dev/unittests/custom_string_tester.py =================================================================== --- pyplusplus_dev/unittests/custom_string_tester.py 2007-03-07 19:39:04 UTC (rev 953) +++ pyplusplus_dev/unittests/custom_string_tester.py 2007-03-08 07:33:42 UTC (rev 954) @@ -68,6 +68,7 @@ mb.constructors().allow_implicit_conversion = False mb.variable( 'm_name' ).use_make_functions = True mb.variable( 'm_123' ).use_make_functions = True + mb.class_( 'name_t' ).add_properties(); def run_tests( self, module): self.failUnless( "1" == module.utf16_to_string( "1" ) ) @@ -77,6 +78,9 @@ self.failUnless( '456' == module.utf16_to_string( n.m_name ) ) self.failUnless( '123' == module.utf16_to_string( n.m_123 ) ) + n.name = '11' + self.failUnless( '11' == module.utf16_to_string( n.m_name ) ) + def create_suite(): suite = unittest.TestSuite() suite.addTest( unittest.makeSuite(tester_t)) Modified: pyplusplus_dev/unittests/data/custom_string_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/custom_string_to_be_exported.hpp 2007-03-07 19:39:04 UTC (rev 953) +++ pyplusplus_dev/unittests/data/custom_string_to_be_exported.hpp 2007-03-08 07:33:42 UTC (rev 954) @@ -23,6 +23,7 @@ utf16_t& operator=( const utf16_t& other ){ m_value_a = other.m_value_a; m_value_w = other.m_value_w; + return *this; } std::string const& value_a() const { return m_value_a; } @@ -36,6 +37,9 @@ struct name_t{ name_t() : m_123( "123" ){} + const utf16_t& get_name() const { return m_name; } + void set_name(const utf16_t& n) { m_name = n; } + utf16_t m_name; const utf16_t m_123; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-03-07 19:39:04
|
Revision: 953 http://svn.sourceforge.net/pygccxml/?rev=953&view=rev Author: roman_yakovenko Date: 2007-03-07 11:39:04 -0800 (Wed, 07 Mar 2007) Log Message: ----------- updating documentation Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/declaration.py Modified: pygccxml_dev/pygccxml/declarations/declaration.py =================================================================== --- pygccxml_dev/pygccxml/declarations/declaration.py 2007-03-07 18:55:49 UTC (rev 952) +++ pygccxml_dev/pygccxml/declarations/declaration.py 2007-03-07 19:39:04 UTC (rev 953) @@ -6,8 +6,10 @@ """ defines 2 important classes -This module defines base class for all classes, that describes C++ declaration -and class that defines C++ declaration location. +This module defines: +* declaration_t - base class for all pygccxml defined classes, which describe + a C++ declaration +* location_t - provides information about physical location of the declaration """ import algorithm @@ -15,12 +17,8 @@ import algorithms_cache class location_t(object): - """provides information about the location of the declaration within the source file. + """provides information about the location of the declaration within the source file""" - The header file name and the line number of the declaration can be - accessed via the attributes C{file_name} and C{line}. - """ - def __init__(self, file_name='', line=-1 ): self._file_name = file_name self._line = line @@ -44,29 +42,20 @@ def _set_file_name(self, new_file_name): self._file_name = new_file_name file_name = property( _get_file_name, _set_file_name - , doc="""The full file name of the header in which the declaration was found. - @type: str - """) + , doc="""absolute source file name, type string""" ) def _get_line( self ): return self._line def _set_line( self, new_line ): self._line = new_line - line = property( _get_line, _set_line - , doc="""The line number where the declaration was found - @type: int - """) + line = property( _get_line, _set_line, doc="""line number, type int""") def as_tuple( self ): - """Return the header file name and the line number. - - @returns: Returns a 2-tuple (file name, line number). - """ + """return tuple(self.file_name, self.line)""" return (self.file_name, self.line) class declaration_t( object ): - """Base class for all classes that represent a C++ declaration. - """ + """base class for all classes that represent a C++ declaration""" def __init__( self, name='', location=None, is_artificial=False, mangled=None, demangled=None ): self._name = name @@ -245,8 +234,8 @@ reference to instance of L{algorithms_cache.algorithms_cache_t} class. """ return self._cache - + def i_depend_on_them( self, recursive=True ): - #this method should return list of all types, declarations it depends on + """return list of all types and declarations the declaration depends on""" print self raise NotImplementedError() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-03-07 18:55:52
|
Revision: 952 http://svn.sourceforge.net/pygccxml/?rev=952&view=rev Author: roman_yakovenko Date: 2007-03-07 10:55:49 -0800 (Wed, 07 Mar 2007) Log Message: ----------- adding documentation about transfer_ownership function transformation Added Paths: ----------- pyplusplus_dev/docs/documentation/functions/transformation/built_in/transfer_ownership.rest Added: pyplusplus_dev/docs/documentation/functions/transformation/built_in/transfer_ownership.rest =================================================================== --- pyplusplus_dev/docs/documentation/functions/transformation/built_in/transfer_ownership.rest (rev 0) +++ pyplusplus_dev/docs/documentation/functions/transformation/built_in/transfer_ownership.rest 2007-03-07 18:55:49 UTC (rev 952) @@ -0,0 +1,78 @@ +================================== +``transfer_ownership`` transformer +================================== + +.. contents:: Table of contents + +---------- +Definition +---------- + +"transfer_ownership" transformer changes type of the function argument, from +``T*`` to ``std::auto_ptr<T>``. This transformer was born to provide the answer +to `How can I wrap a function which needs to take ownership of a raw pointer?`_ +FAQ. + +.. _`How can I wrap a function which needs to take ownership of a raw pointer?` : http://boost.org/libs/python/doc/v2/faq.html#ownership + +"transfer_ownership" transformer takes one argument, name or index of the +original function argument. The argument type should be "pointer". + +New in version grater than 0.8.5. + +------- +Example +------- + +.. code-block:: C++ + + struct resource_t{...}; + + void do_smth(resource_t* r){ + ... + } + +Lets say that you need to expose "do_smth" function. According to the FAQ, you +have to create small wrapper, which will take ``std::auto_ptr`` as an argument. +Next `Py++`_ code does it for you: + + .. code-block:: Python + + from pygccxml import declarations + from pyplusplus import module_builder + from pyplusplus import function_transformers as FT + + mb = module_builder.module_builder_t( ... ) + + resource = mb.class_( 'resource_t' ) + resource.held_type = 'std::auto_ptr< %s >' % resource.decl_string + do_smth = mb.free_fun( 'do_smth' ) + do_smth.add_transformation( FT.transfer_ownership( 0 ) ) + +What you see below is the relevant pieces of generated code: + + .. code-block:: C++ + + namespace bp = boost::python; + + static void do_smth_4cf7cde5fca92efcdb8519f8c1a4bccd( std::auto_ptr< ::resource_t > r ){ + ::do_smth(r.release()); + } + + BOOST_PYTHON_MODULE(...){ + ... + bp::def( "do_smth", &do_smth_4cf7cde5fca92efcdb8519f8c1a4bccd, ( bp::arg("r") ) ); + } + +.. _`Py++` : ./../pyplusplus.html +.. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html +.. _`Python`: http://www.python.org +.. _`GCC-XML`: http://www.gccxml.org + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + End: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-03-07 18:54:52
|
Revision: 951 http://svn.sourceforge.net/pygccxml/?rev=951&view=rev Author: roman_yakovenko Date: 2007-03-07 10:54:53 -0800 (Wed, 07 Mar 2007) Log Message: ----------- adding work-around to boost.python def_readwrite and def_readonly bugs Modified Paths: -------------- pyplusplus_dev/pyplusplus/code_creators/member_variable.py pyplusplus_dev/pyplusplus/decl_wrappers/variable_wrapper.py pyplusplus_dev/unittests/custom_string_tester.py pyplusplus_dev/unittests/data/custom_string_to_be_exported.hpp Modified: pyplusplus_dev/pyplusplus/code_creators/member_variable.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/member_variable.py 2007-03-07 09:55:51 UTC (rev 950) +++ pyplusplus_dev/pyplusplus/code_creators/member_variable.py 2007-03-07 18:54:53 UTC (rev 951) @@ -108,7 +108,7 @@ return result - def _generate_for_smart_ptr( self ): + def _generate_using_functions( self ): doc = '' add_property = '' make_getter = algorithm.create_identifier( self, '::boost::python::make_getter') @@ -148,8 +148,8 @@ def _create_impl( self ): if declarations.is_pointer( self.declaration.type ): return self._generate_for_pointer() - elif self.declaration.apply_smart_ptr_wa: - return self._generate_for_smart_ptr() + elif self.declaration.apply_smart_ptr_wa or self.declaration.use_make_functions: + return self._generate_using_functions() else: return self._generate_for_none_pointer() Modified: pyplusplus_dev/pyplusplus/decl_wrappers/variable_wrapper.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/variable_wrapper.py 2007-03-07 09:55:51 UTC (rev 950) +++ pyplusplus_dev/pyplusplus/decl_wrappers/variable_wrapper.py 2007-03-07 18:54:53 UTC (rev 951) @@ -20,7 +20,8 @@ self._setter_call_policies = None self._apply_smart_ptr_wa = False self._is_read_only = None - + self._use_make_functions = None + __call_policies_doc__ = \ """There are usecase, when exporting member variable forces Py++ to create accessors functions. Sometime, those functions requires call policies. @@ -40,6 +41,10 @@ else: value_policy = call_policies.copy_non_const_reference self._getter_call_policies = call_policies.return_value_policy( value_policy ) + elif self.use_make_functions: + self._getter_call_policies = call_policies.return_internal_reference() + else: + pass return self._getter_call_policies def set_getter_call_policies( self, call_policies ): self._getter_call_policies = call_policies @@ -48,7 +53,7 @@ def get_setter_call_policies( self ): if None is self._getter_call_policies: - if self.apply_smart_ptr_wa: + if self.apply_smart_ptr_wa or self.use_make_functions: self._setter_call_policies = call_policies.default_call_policies() return self._setter_call_policies def set_setter_call_policies( self, call_policies ): @@ -56,14 +61,35 @@ setter_call_policies = property( get_setter_call_policies, set_setter_call_policies , doc=__call_policies_doc__ ) + __use_make_functions_doc__ = \ + """Generate code using make_getter and make_setter functions + + Basically you don't need to use this, untill you have one of the next use-cases: + * member variable is smart pointer - in this case Boost.Python has small problem + to expose it right. Using the functions is a work around to the problem. + * member variable defined custom r-value converter - may be you don't know + but the conversion is applied only on functions arguments. So you need to + use make_getter/make_setter in order to allow user to enjoy from the + conversion. + + Setting "apply_smart_ptr_wa" and/or "use_make_functions" to "True" will tell + Py++ to generate such code. + """ + def get_apply_smart_ptr_wa( self ): return self._apply_smart_ptr_wa def set_apply_smart_ptr_wa( self, value): self._apply_smart_ptr_wa = value apply_smart_ptr_wa = property( get_apply_smart_ptr_wa, set_apply_smart_ptr_wa - , doc="" ) + , doc=__use_make_functions_doc__ ) - + def get_use_make_functions( self ): + return self._use_make_functions + def set_use_make_functions( self, value ): + self._use_make_functions = value + use_make_functions = property( get_use_make_functions, set_use_make_functions + , doc=__use_make_functions_doc__) + def __find_out_is_read_only(self): type_ = declarations.remove_alias( self.type ) Modified: pyplusplus_dev/unittests/custom_string_tester.py =================================================================== --- pyplusplus_dev/unittests/custom_string_tester.py 2007-03-07 09:55:51 UTC (rev 950) +++ pyplusplus_dev/unittests/custom_string_tester.py 2007-03-07 18:54:53 UTC (rev 951) @@ -66,11 +66,17 @@ mb.add_declaration_code( auto_convert_code ) mb.add_registration_code( register_auto_convert_code ) mb.constructors().allow_implicit_conversion = False + mb.variable( 'm_name' ).use_make_functions = True + mb.variable( 'm_123' ).use_make_functions = True def run_tests( self, module): self.failUnless( "1" == module.utf16_to_string( "1" ) ) self.failUnless( "22" == module.utf16_to_wstring( u"22" ) ) - + n = module.name_t() + n.m_name = '456' + self.failUnless( '456' == module.utf16_to_string( n.m_name ) ) + self.failUnless( '123' == module.utf16_to_string( n.m_123 ) ) + def create_suite(): suite = unittest.TestSuite() suite.addTest( unittest.makeSuite(tester_t)) Modified: pyplusplus_dev/unittests/data/custom_string_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/custom_string_to_be_exported.hpp 2007-03-07 09:55:51 UTC (rev 950) +++ pyplusplus_dev/unittests/data/custom_string_to_be_exported.hpp 2007-03-07 18:54:53 UTC (rev 951) @@ -15,7 +15,16 @@ utf16_t() {} explicit utf16_t(std::string const& value) : m_value_a(value) {} explicit utf16_t(std::wstring const& value) : m_value_w(value) {} - + + utf16_t( const utf16_t& other ) + : m_value_a( other.m_value_a ), m_value_w( other.m_value_w ) + {} + + utf16_t& operator=( const utf16_t& other ){ + m_value_a = other.m_value_a; + m_value_w = other.m_value_w; + } + std::string const& value_a() const { return m_value_a; } std::wstring const& value_w() const { return m_value_w; } @@ -24,6 +33,13 @@ std::string m_value_a; }; +struct name_t{ + name_t() : m_123( "123" ){} + + utf16_t m_name; + const utf16_t m_123; +}; + inline std::string utf16_to_string( const utf16_t& x ){ return x.value_a(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-03-07 09:55:51
|
Revision: 950 http://svn.sourceforge.net/pygccxml/?rev=950&view=rev Author: roman_yakovenko Date: 2007-03-07 01:55:51 -0800 (Wed, 07 Mar 2007) Log Message: ----------- updating documentation Modified Paths: -------------- pyplusplus_dev/docs/comparisons/compare_to.rest pyplusplus_dev/docs/quotes.rest Modified: pyplusplus_dev/docs/comparisons/compare_to.rest =================================================================== --- pyplusplus_dev/docs/comparisons/compare_to.rest 2007-03-07 07:29:32 UTC (rev 949) +++ pyplusplus_dev/docs/comparisons/compare_to.rest 2007-03-07 09:55:51 UTC (rev 950) @@ -28,8 +28,27 @@ The impression of Lakin Wecker, after spending 30 hours working working with `Py++`_: http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=1478&sid=4d77585146aabbc54f4b31ec50874d86 - .. _`Python-OGRE` : http://lakin.weckers.net/index_ogre_python.html + `Python-OGRE`_ project is reached the state, when it has all functionality + provided by similar one - `PyOgre`_. `PyOgre`_ is developed using SWIG. + I suggest you to compare the amount of code, written by `Python-Ogre`_ + developers and `PyOgre`_ ones: + + * `PyOgre`_ sources: http://svn.berlios.de/viewcvs/pyogre/trunk/pyogre/ogre/ + + * `Python-Ogre`_ sources: + + http://python-ogre.python-hosting.com/browser/trunk/python-ogre/code_generators/ogre/ + + http://python-ogre.python-hosting.com/browser/trunk/python-ogre/code_generators/common_utils/ + + Pay attention: functionality defined in "common_utils" package is used by + other scripts too. + + .. _`Python-OGRE` : http://python-ogre.python-hosting.com/ + .. _`PyOgre` : http://www.ogre3d.org/wiki/index.php/PyOgre + + Some other links, that compare Boost.Python, SWIG, SIP and other tools: * `Evaluation of Python/C++ interfacing packages`_ Modified: pyplusplus_dev/docs/quotes.rest =================================================================== --- pyplusplus_dev/docs/quotes.rest 2007-03-07 07:29:32 UTC (rev 949) +++ pyplusplus_dev/docs/quotes.rest 2007-03-07 09:55:51 UTC (rev 950) @@ -104,7 +104,7 @@ .. _`Python Computer Graphics Kit` : http://cgkit.sourceforge.net/ .. _`TnFOX`: http://www.nedprod.com/TnFOX/ .. _`PyOpenSG`: https://realityforge.vrsource.org/view/PyOpenSG/WebHome -.. _`Python-OGRE` : http://lakin.weckers.net/index_ogre_python.html +.. _`Python-OGRE` : http://python-ogre.python-hosting.com/ .. _`OGRE` : http://www.ogre3d.org/index.php?option=com_content&task=view&id=19&Itemid=79 .. Local Variables: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-03-07 07:49:53
|
Revision: 949 http://svn.sourceforge.net/pygccxml/?rev=949&view=rev Author: roman_yakovenko Date: 2007-03-06 23:29:32 -0800 (Tue, 06 Mar 2007) Log Message: ----------- adding new unit tests Added Paths: ----------- pyplusplus_dev/unittests/bpmodule_tester.py pyplusplus_dev/unittests/custom_string_tester.py pyplusplus_dev/unittests/data/custom_string_to_be_exported.hpp Added: pyplusplus_dev/unittests/bpmodule_tester.py =================================================================== --- pyplusplus_dev/unittests/bpmodule_tester.py (rev 0) +++ pyplusplus_dev/unittests/bpmodule_tester.py 2007-03-07 07:29:32 UTC (rev 949) @@ -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) + +import os +import sys +import unittest +import fundamental_tester_base + +class tester_t(fundamental_tester_base.fundamental_tester_base_t): + EXTENSION_NAME = 'bpmodule' + + def __init__( self, *args ): + fundamental_tester_base.fundamental_tester_base_t.__init__( + self + , tester_t.EXTENSION_NAME + , *args ) + + def run_tests( self, module): + pass + +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/custom_string_tester.py =================================================================== --- pyplusplus_dev/unittests/custom_string_tester.py (rev 0) +++ pyplusplus_dev/unittests/custom_string_tester.py 2007-03-07 07:29:32 UTC (rev 949) @@ -0,0 +1,83 @@ +# 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 + +auto_convert_code = \ +""" +namespace bp = boost::python; + +struct PyStringToUTF16{ + + typedef custom_strings::utf16_t string_type; + + static void* convertible(PyObject* obj){ + if( PyString_Check(obj) || PyUnicode_Check(obj) ){ + return obj; + } + else{ + return 0; + } + } + + static void + construct( PyObject* obj, bp::converter::rvalue_from_python_stage1_data* data){ + typedef bp::converter::rvalue_from_python_storage<string_type> string_storage_t; + string_storage_t* the_storage = reinterpret_cast<string_storage_t*>( data ); + void* memory_chunk = the_storage->storage.bytes; + + bp::object py_str( bp::handle<>( bp::borrowed( obj ) ) ); + if( PyString_Check(obj) ){ + std::string c_str = bp::extract<std::string>( py_str ); + new (memory_chunk) string_type(c_str); + } + else{ //unicode + std::wstring c_str = bp::extract<std::wstring>( py_str ); + new (memory_chunk) string_type(c_str); + } + data->convertible = memory_chunk; + } +}; +""" + +register_auto_convert_code = \ +""" +bp::converter::registry::push_back( &PyStringToUTF16::convertible + , &PyStringToUTF16::construct + , bp::type_id<PyStringToUTF16::string_type>() ); + +""" + +class tester_t(fundamental_tester_base.fundamental_tester_base_t): + EXTENSION_NAME = 'custom_string' + + def __init__( self, *args ): + fundamental_tester_base.fundamental_tester_base_t.__init__( + self + , tester_t.EXTENSION_NAME + , *args ) + + def customize( self, mb ): + mb.add_declaration_code( auto_convert_code ) + mb.add_registration_code( register_auto_convert_code ) + mb.constructors().allow_implicit_conversion = False + + def run_tests( self, module): + self.failUnless( "1" == module.utf16_to_string( "1" ) ) + self.failUnless( "22" == module.utf16_to_wstring( u"22" ) ) + +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_string_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/custom_string_to_be_exported.hpp (rev 0) +++ pyplusplus_dev/unittests/data/custom_string_to_be_exported.hpp 2007-03-07 07:29:32 UTC (rev 949) @@ -0,0 +1,37 @@ +// 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 __custom_string_to_be_exported_hpp__ +#define __custom_string_to_be_exported_hpp__ + +#include <string> + +namespace custom_strings{ + +class utf16_t{ +public: + utf16_t() {} + explicit utf16_t(std::string const& value) : m_value_a(value) {} + explicit utf16_t(std::wstring const& value) : m_value_w(value) {} + + std::string const& value_a() const { return m_value_a; } + std::wstring const& value_w() const { return m_value_w; } + +private: + std::wstring m_value_w; + std::string m_value_a; +}; + +inline std::string utf16_to_string( const utf16_t& x ){ + return x.value_a(); +} + +inline std::wstring utf16_to_wstring( const utf16_t& x ){ + return x.value_w(); +} + +} + +#endif//__custom_string_to_be_exported_hpp__ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-03-05 14:16:01
|
Revision: 948 http://svn.sourceforge.net/pygccxml/?rev=948&view=rev Author: roman_yakovenko Date: 2007-03-05 06:15:56 -0800 (Mon, 05 Mar 2007) Log Message: ----------- improving generated code - global variables will be exposed using object( boost::ref( x ) ) Modified Paths: -------------- pyplusplus_dev/pyplusplus/code_creators/global_variable.py Modified: pyplusplus_dev/pyplusplus/code_creators/global_variable.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/global_variable.py 2007-03-05 14:14:31 UTC (rev 947) +++ pyplusplus_dev/pyplusplus/code_creators/global_variable.py 2007-03-05 14:15:56 UTC (rev 948) @@ -11,11 +11,8 @@ import registration_based from pygccxml import declarations from pyplusplus import code_repository +from pyplusplus import decl_wrappers -#TODO: mutable global variable -#scope.attr( "x" ) = object( ptr( &x ) ) - -#TODO: if variable is not const, then export it using boost::python::ptr class global_variable_base_t( registration_based.registration_based_t , declaration_based.declaration_based_t ): """ @@ -48,8 +45,15 @@ result = [] result.append( algorithm.create_identifier( self, '::boost::python::scope' ) ) result.append( '().attr("%s")' % self.alias ) - full_name = pygccxml.declarations.full_name( self.declaration ) - result.append( ' = %s;' % algorithm.create_identifier( self, full_name ) ) + dtype = self.declaration.type + if decl_wrappers.python_traits.is_immutable( dtype ) \ + or pygccxml.declarations.is_const( dtype ) \ + or pygccxml.declarations.smart_pointer_traits.is_smart_pointer( dtype ): + result.append( ' = %s;' % self.decl_identifier ) + else: + obj_identifier = algorithm.create_identifier( self, '::boost::python::object' ) + ref_identifier = algorithm.create_identifier( self, '::boost::ref' ) + result.append( ' = %s( %s( %s ) );' % ( obj_identifier, ref_identifier, self.decl_identifier ) ) return ''.join( result ) class array_gv_t( global_variable_base_t ): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-03-05 14:14:33
|
Revision: 947 http://svn.sourceforge.net/pygccxml/?rev=947&view=rev Author: roman_yakovenko Date: 2007-03-05 06:14:31 -0800 (Mon, 05 Mar 2007) Log Message: ----------- fixing bug reported by Neal - free functions with '.' in the name will not be exported Modified Paths: -------------- pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py Modified: pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py 2007-03-05 09:43:54 UTC (rev 946) +++ pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py 2007-03-05 14:14:31 UTC (rev 947) @@ -130,7 +130,7 @@ def get_exportable( self ): if self._exportable is None: - if self.name.startswith( '__' ): + if self.name.startswith( '__' ) or '.' in self.name: self._exportable_reason = messages.W1000 elif self.location and self.location.file_name == "<internal>": self._exportable_reason = messages.W1001 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-03-05 09:44:00
|
Revision: 946 http://svn.sourceforge.net/pygccxml/?rev=946&view=rev Author: roman_yakovenko Date: 2007-03-05 01:43:54 -0800 (Mon, 05 Mar 2007) Log Message: ----------- updating documentation Modified Paths: -------------- pyplusplus_dev/docs/documentation/index.rest Modified: pyplusplus_dev/docs/documentation/index.rest =================================================================== --- pyplusplus_dev/docs/documentation/index.rest 2007-03-04 20:42:56 UTC (rev 945) +++ pyplusplus_dev/docs/documentation/index.rest 2007-03-05 09:43:54 UTC (rev 946) @@ -9,7 +9,7 @@ ------------ `Py++`_ documentation is always under active development. It is not an easy -task to create and maintain it. I will appreciate any help! +task to create and maintain it. I will appreciate **any help**! How can you help? @@ -25,6 +25,75 @@ * Do you think, that the documentation is not clear, I will be glad to improve it, just point me to the place. + +-------- +Overview +-------- + +* `API docs`_ - contains API documentation, including source code, generated by `epydoc`_ + +.. _`API docs` : ./apidocs/index.html +.. _`epydoc` : http://epydoc.sourceforge.net/ + +* `STL containers`_ - describes various methods to expose STL containers to `Python`_ + +.. _`STL containers` : ./containers.html + +* `architecture`_ - describes the architecture behind `Py++`_ + +.. _`architecture` : ./architecture.html + +* `best practices`_ - `Py++`_ is huge, this document will explain you how to + effectively use it + +.. _`best practices`: ./best_practices.html + +* `documentation string`_ - explains how to automaticly extract a documentation + from the source files and put it as Python documentation string + +.. _`documentation string` : ./doc_string.html + +* `feedback`_ - `Py++`_ could be used as some kind of validator. It checks the + exposed declarations and reports the potential errors. Thus you are able to + create high quality Python bindings from the beginning. This document also + describes how to supress the errors\\warnings. + +.. _`feedback` : ./feedback.html + +* `functions & operators`_ - contains a complete guide to exposing functions and + operators, including "call policies" and description of different caveats + +.. _`functions & operators` : ../functions/functions.html + +* `hints`_ - describes few techinques, which will help you with exposing template + instantiations + +.. _`hints`: ./hints.html + +* `how to ... ?`_ - contains answers for different frequently asked questions + +.. _`how to ... ?` : ./how_to.html + +* `inserting code`_ - a complete guide for insert your code into the generated one + +.. _`inserting code` : ./inserting_code.html + +* `multi-module development`_ - describes how expose hierarchy of classes, which + is spread few different libraries + +.. _`multi-module development`: ./multi_module_development.html + +* `properties`_ - describes how to create class properties using `Py++`_ and + built-in algorithm for automatic properties recognition + +.. _`properties`: ./properties.html + +* `tutorials`_ - don't know where to start? Start here. Small and simple example + will help you to start with `Py++`_. If you want to evaluate `Py++`_ you will + find here small and handy GUI program. + +.. _`tutorials` : ./tutorials/tutorials.html + .. _`Epydoc` : http://epydoc.sourceforge.net/ .. _`Py++` : ./../pyplusplus.html .. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-03-04 20:42:56
|
Revision: 945 http://svn.sourceforge.net/pygccxml/?rev=945&view=rev Author: roman_yakovenko Date: 2007-03-04 12:42:56 -0800 (Sun, 04 Mar 2007) Log Message: ----------- improving css Modified Paths: -------------- website/templates/online/language_binding.css website/templates/online/page_template.html Modified: website/templates/online/language_binding.css =================================================================== --- website/templates/online/language_binding.css 2007-03-04 20:41:03 UTC (rev 944) +++ website/templates/online/language_binding.css 2007-03-04 20:42:56 UTC (rev 945) @@ -86,6 +86,14 @@ width: 211px; height: 71px; } +div.middle_ads { + margin-left: 140px; + padding-top: 0px; + padding-left: 30px; + margin-bottom: 10px; + padding-right: 0px; +} + div.document { margin-left: 140px; padding-top: 0px; Modified: website/templates/online/page_template.html =================================================================== --- website/templates/online/page_template.html 2007-03-04 20:41:03 UTC (rev 944) +++ website/templates/online/page_template.html 2007-03-04 20:42:56 UTC (rev 945) @@ -59,6 +59,25 @@ </script> </div> <div class="rest_document"> + <div class="middle_ads"> + <script type="text/javascript"><!-- + google_ad_client = "pub-0886572017808006"; + google_ad_width = 468; + google_ad_height = 15; + google_ad_format = "468x15_0ads_al"; + //2007-03-01: top-link-unit + google_ad_channel = "4551309584"; + google_color_border = "FFFFFF"; + google_color_bg = "FFFFFF"; + google_color_link = "0033CC"; + google_color_text = "0033CC"; + google_color_url = "0033CC"; + //--></script> + <script type="text/javascript" + src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> + <!-- xml kid bug --> + </script> + </div> <!-- google_ad_section_start --> ${ XML(page_content) } <!-- google_ad_section_end --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-03-04 20:41:10
|
Revision: 944 http://svn.sourceforge.net/pygccxml/?rev=944&view=rev Author: roman_yakovenko Date: 2007-03-04 12:41:03 -0800 (Sun, 04 Mar 2007) Log Message: ----------- fixing spelling errors Modified Paths: -------------- pyplusplus_dev/docs/documentation/multi_module_development.rest pyplusplus_dev/environment.py Modified: pyplusplus_dev/docs/documentation/multi_module_development.rest =================================================================== --- pyplusplus_dev/docs/documentation/multi_module_development.rest 2007-03-04 20:38:31 UTC (rev 943) +++ pyplusplus_dev/docs/documentation/multi_module_development.rest 2007-03-04 20:41:03 UTC (rev 944) @@ -8,11 +8,11 @@ Introduction ------------ -It is a common practices to construct final program or a package from few +It is a common practises to construct final program or a package from few different dependent or independent C++ libraries. Many time these libraries reuse classes\\functions defined in some other library. I think this is a must requirement from a code generator to be able to expose these libraries to `Python`_ , -without "re-exposing" the class\\functions definition twise. +without "re-exposing" the class\\functions definition twice. This functionality is new in version "0.8.6". Modified: pyplusplus_dev/environment.py =================================================================== --- pyplusplus_dev/environment.py 2007-03-04 20:38:31 UTC (rev 943) +++ pyplusplus_dev/environment.py 2007-03-04 20:41:03 UTC (rev 944) @@ -5,7 +5,7 @@ class boost: libs = '' include = '' - + class python: libs = '' include = '' @@ -18,9 +18,9 @@ cmd_build = '' cmd_clean = '' ccflags = [] - + if 'roman' in getpass.getuser(): - + scons.cmd_build = 'scons --file=%s' scons.cmd_clean = 'scons --clean --file=%s' @@ -34,7 +34,7 @@ gccxml.executable = r'd:/dev/gccxml_cvs/gccxml-bin/bin/release/gccxml.exe' else: scons.suffix = '.so' - boost.libs = [ '/home/roman/boost_cvs/libs/python/build/bin-stage' ] + boost.libs = ['/home/roman/boost_cvs/libs/python/build/bin-stage' ] boost.include = '/home/roman/boost_cvs' python.include = '/usr/include/python2.4' gccxml.executable = '/home/roman/gccxml/bin/gccxml' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-03-04 20:38:32
|
Revision: 943 http://svn.sourceforge.net/pygccxml/?rev=943&view=rev Author: roman_yakovenko Date: 2007-03-04 12:38:31 -0800 (Sun, 04 Mar 2007) Log Message: ----------- updating documentation Modified Paths: -------------- pyplusplus_dev/docs/documentation/multi_module_development.rest Modified: pyplusplus_dev/docs/documentation/multi_module_development.rest =================================================================== --- pyplusplus_dev/docs/documentation/multi_module_development.rest 2007-03-01 14:19:19 UTC (rev 942) +++ pyplusplus_dev/docs/documentation/multi_module_development.rest 2007-03-04 20:38:31 UTC (rev 943) @@ -8,75 +8,132 @@ Introduction ------------ -It is a common practices to construct final program or just a library\\package -from few different dependent\\independent packages\\libraries. Many time these -libraries reuse classes\\functions defined in another one. I think this is a must -requirement from a code generator to be able to expose these libraries to `Python`_ , +It is a common practices to construct final program or a package from few +different dependent or independent C++ libraries. Many time these libraries +reuse classes\\functions defined in some other library. I think this is a must +requirement from a code generator to be able to expose these libraries to `Python`_ , without "re-exposing" the class\\functions definition twise. +This functionality is new in version "0.8.6". -Please take a look on `Creating Packages`_ example, in `Boost.Python`_ tutorials. -The example introduces slightly different use case, but it is good enough for us. +--------------------- +Use case introduction +--------------------- -Lets assume ``sounds::core`` namespace defines interface (base class) for all -filter classes. ``sounds::filters`` namespace defines few "filter" classes. +Lets say that you have to expose few libraries, which deal with image processing: -The question now is how to expose the classes to Python, while preserving their -logical location using `Py++`_? +* ``core`` library - defines base class for all image classes - ``image_i`` -.. _`Creating Packages` : http://boost.org/libs/python/doc/tutorial/doc/html/python/techniques.html#python.creating_packages +* ``png`` library - defines class ``png_image_t``, which derives from + ``core::image_i`` and implements functionality for "png" image format. -------------------- -``already_exposed`` -------------------- +The code: -`Py++`_ declaration - .. code-block:: C++ - //file sounds/core/filter_interface.h + namespace core{ + class image_i{ + ... + virtual void load() = 0; + }; + } //core - namespace sounds{ namespace core{ - - struct filter_i{ + namespace png{ + class png_image_t : public core::image_i{ ... - virtual void apply() = 0; + virtual void load(); }; - } } //sounds::core + } -.. code-block:: C++ +The desired goal is to expose every class in its own package. - //file sounds/filters/ogg.h - - #include "sounds/core/filter_interface.h" - - namespace sounds{ namespace ogg{ - - struct noise_cleaner_t : public core::filter_i{ - ... - }; - - } } //sound::ogg +------------------- +``already_exposed`` +------------------- +Every `Py++`_ declaration has ``already_exposed`` property. This property says +to `Py++`_ that the declaration is already exposed in another module: + .. code-block:: Python #generate_code.py script mb_core = module_builder_t( ... ) - mb_core.class_( 'filter_i' ).include() - - mb_filters = module_builder_t( ... ) - mb_filters.class_( '::sounds::core::filter_i' ).already_exposed = True - - #----------------------------------------------^^^^^^^^^^^^^^^^^^^^^^^ - #This will tell to Py++ that "filter_i" class is already exposed - -`Py++`_ will generate right code for both modules: + mb_core.class_( 'image_i' ).include() + mb_core.build_code_creator( 'core' ) + mb.write_module( 'core.cpp' ) + mb_png = module_builder_t( ... ) + mb_png.class_( '::core::image_i' ).already_exposed = True + mb_png.class_( '::png::png_image_t' ).include() + mb_core.build_code_creator( 'png' ) + mb.write_module( 'png.cpp' ) +`Py++`_ will generate code very similar to the next one: +.. code-block:: C++ + //file core.cpp + namespace bp = boost::python; + + struct image_i_wrapper : core::image_i, bp::wrapper< core::image_i > { + image_i_wrapper() + : core::image_i(), bp::wrapper< core::image_i >() + {} + + virtual void load( ){ + bp::override func_load = this->get_override( "load" ); + func_load( ); + } + ... + }; + + BOOST_PYTHON_MODULE(core){ + bp::class_< image_i_wrapper, boost::noncopyable >( "image_i" ) + ... + .def( "load", bp::pure_virtual( &::core::image_i::load ) ); + } + +.. code-block:: C++ + + //file png.cpp + struct png_image_t_wrapper : png::png_image_t, bp::wrapper< png::png_image_t > { + + png_image_t_wrapper() + : png::png_image_t(), bp::wrapper< png::png_image_t >() + {} + + virtual void load( ) { + if( bp::override func_load = this->get_override( "load" ) ) + func_load( ); + else + this->png::png_image_t::load( ); + } + + void default_load( ) { + png::png_image_t::load( ); + } + }; + + BOOST_PYTHON_MODULE(pyplusplus){ + bp::class_< png_image_t_wrapper, bp::bases< core::image_i > >( "png_image_t" ) + //-------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^ + ... + .def( "load", &::png::png_image_t::load, &png_image_t_wrapper::default_load ); + } + +As you can see "png.cpp" file doesn't contains code, which exposes ``core::image_i`` +class. + +------ +Caveat +------ + +You should import module "core", before "png". `Boost.Python`_ requires definition +of any base class to be exposed\\registered before a derive one. + + .. _`Py++` : ./../pyplusplus.html .. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html .. _`Python`: http://www.python.org This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-03-01 14:19:22
|
Revision: 942 http://svn.sourceforge.net/pygccxml/?rev=942&view=rev Author: roman_yakovenko Date: 2007-03-01 06:19:19 -0800 (Thu, 01 Mar 2007) Log Message: ----------- updating documentation Modified Paths: -------------- pyplusplus_dev/docs/documentation/www_configuration.py pyplusplus_dev/docs/history/history.rest Added Paths: ----------- pyplusplus_dev/docs/documentation/multi_module_development.rest Added: pyplusplus_dev/docs/documentation/multi_module_development.rest =================================================================== --- pyplusplus_dev/docs/documentation/multi_module_development.rest (rev 0) +++ pyplusplus_dev/docs/documentation/multi_module_development.rest 2007-03-01 14:19:19 UTC (rev 942) @@ -0,0 +1,92 @@ +======================== +Multi-module development +======================== + +.. contents:: Table of contents + +------------ +Introduction +------------ + +It is a common practices to construct final program or just a library\\package +from few different dependent\\independent packages\\libraries. Many time these +libraries reuse classes\\functions defined in another one. I think this is a must +requirement from a code generator to be able to expose these libraries to `Python`_ , +without "re-exposing" the class\\functions definition twise. + + +Please take a look on `Creating Packages`_ example, in `Boost.Python`_ tutorials. +The example introduces slightly different use case, but it is good enough for us. + +Lets assume ``sounds::core`` namespace defines interface (base class) for all +filter classes. ``sounds::filters`` namespace defines few "filter" classes. + +The question now is how to expose the classes to Python, while preserving their +logical location using `Py++`_? + +.. _`Creating Packages` : http://boost.org/libs/python/doc/tutorial/doc/html/python/techniques.html#python.creating_packages + +------------------- +``already_exposed`` +------------------- + +`Py++`_ declaration + +.. code-block:: C++ + + //file sounds/core/filter_interface.h + + namespace sounds{ namespace core{ + + struct filter_i{ + ... + virtual void apply() = 0; + }; + } } //sounds::core + + +.. code-block:: C++ + + //file sounds/filters/ogg.h + + #include "sounds/core/filter_interface.h" + + namespace sounds{ namespace ogg{ + + struct noise_cleaner_t : public core::filter_i{ + ... + }; + + } } //sound::ogg + +.. code-block:: Python + + #generate_code.py script + + mb_core = module_builder_t( ... ) + mb_core.class_( 'filter_i' ).include() + + mb_filters = module_builder_t( ... ) + mb_filters.class_( '::sounds::core::filter_i' ).already_exposed = True + + #----------------------------------------------^^^^^^^^^^^^^^^^^^^^^^^ + #This will tell to Py++ that "filter_i" class is already exposed + +`Py++`_ will generate right code for both modules: + + + + +.. _`Py++` : ./../pyplusplus.html +.. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html +.. _`Python`: http://www.python.org +.. _`GCC-XML`: http://www.gccxml.org + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + End: + Modified: pyplusplus_dev/docs/documentation/www_configuration.py =================================================================== --- pyplusplus_dev/docs/documentation/www_configuration.py 2007-03-01 10:51:10 UTC (rev 941) +++ pyplusplus_dev/docs/documentation/www_configuration.py 2007-03-01 14:19:19 UTC (rev 942) @@ -6,4 +6,5 @@ , 'doc_string' : 'documentation string' , 'inserting_code' : 'inserting code' , 'best_practices' : 'best practices' -} \ No newline at end of file + , 'multi_module_development' : 'multi-module development' +} Modified: pyplusplus_dev/docs/history/history.rest =================================================================== --- pyplusplus_dev/docs/history/history.rest 2007-03-01 10:51:10 UTC (rev 941) +++ pyplusplus_dev/docs/history/history.rest 2007-03-01 14:19:19 UTC (rev 942) @@ -46,7 +46,7 @@ .. line-separator -2. Added exposing of copy constructors and "operator=". "operator=" is exposed +2. Added exposing of copy constructor and ``operator=``. ``operator=`` is exposed under "assign" name. .. line-separator @@ -55,7 +55,8 @@ .. _`as_tuple` : ../documentation/functions/call_policies.html#as-tuple -4. Added initial support for multi-module development. +4. Added initial support for multi-module development. Now you can mark you declaration + as ``already_exposed``. "Py++" will not create code for it, but will .. line-separator This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-03-01 10:51:10
|
Revision: 941 http://svn.sourceforge.net/pygccxml/?rev=941&view=rev Author: roman_yakovenko Date: 2007-03-01 02:51:10 -0800 (Thu, 01 Mar 2007) Log Message: ----------- updating project history Modified Paths: -------------- pygccxml_dev/docs/history/history.rest Modified: pygccxml_dev/docs/history/history.rest =================================================================== --- pygccxml_dev/docs/history/history.rest 2007-02-28 21:48:58 UTC (rev 940) +++ pygccxml_dev/docs/history/history.rest 2007-03-01 10:51:10 UTC (rev 941) @@ -31,7 +31,7 @@ .. line separator -2. Class ``calldef_t`` has new instance variable - ``does_throw``. It describes +2. Class ``calldef_t`` has property - ``does_throw``. It describes whether the function throws any exception or not. .. line separator @@ -40,6 +40,47 @@ function default arguments. Reference to "enum" declaration extracted properly. Many thanks to Martin Preisler for reporting the bug. +.. line separator + +4. New type traits have been added: + + * ``is_std_ostream`` + * ``is_std_wostream`` + +.. line separator + +5. C++ does not define implicit conversion between an integral type and ``void*``. + ``declarations.is_convertible`` type traitswas fixed. + +.. line separator + +6. ``declarations.is_noncopyable`` type traits implementation was slightly changed. + Now it checks explicitly that class has: + + * default constructor + * copy constructor + * ``operator=`` + * destructor + + If all listed functions exists, than the algorithm returns ``False``, otherwise + it will continue to execute previous logic. + +.. line separator + +7. ``declarations.class_declaration_t`` has new property - ``aliases``. This is + a list of all aliases to the class declaration. + +.. line separator + +8. The message of the exception, which is raised from ``declarations.mdecl_wrapper_t`` + class was improved and now clearly explains what the problem is. + +.. line separator + +9. Small improvment was done for ``parser.default_argument_patcher_t`` class. + ``enum`` extraction is done using functionality provided by type traits module. + + ------------- Version 0.8.5 ------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-02-28 21:48:57
|
Revision: 940 http://svn.sourceforge.net/pygccxml/?rev=940&view=rev Author: roman_yakovenko Date: 2007-02-28 13:48:58 -0800 (Wed, 28 Feb 2007) Log Message: ----------- make dialog to be open on ful screen Modified Paths: -------------- pyplusplus_dev/pyplusplus/gui/ui.py Modified: pyplusplus_dev/pyplusplus/gui/ui.py =================================================================== --- pyplusplus_dev/pyplusplus/gui/ui.py 2007-02-28 21:25:38 UTC (rev 939) +++ pyplusplus_dev/pyplusplus/gui/ui.py 2007-02-28 21:48:58 UTC (rev 940) @@ -377,7 +377,9 @@ pass def show_demo(): - mw = main_widget_ui_t() + root = Tkinter.Tk() + mw = main_widget_ui_t(root) + root.geometry("%dx%d%+d%+d" % (1024, 768, 0, 0)) # (width,height, x, y) mw.mainloop() if __name__ == "__main__": This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-02-28 21:25:37
|
Revision: 939 http://svn.sourceforge.net/pygccxml/?rev=939&view=rev Author: roman_yakovenko Date: 2007-02-28 13:25:38 -0800 (Wed, 28 Feb 2007) Log Message: ----------- improving site look Modified Paths: -------------- website/templates/online/language_binding.css website/templates/online/page_template.html Modified: website/templates/online/language_binding.css =================================================================== --- website/templates/online/language_binding.css 2007-02-27 14:09:35 UTC (rev 938) +++ website/templates/online/language_binding.css 2007-02-28 21:25:38 UTC (rev 939) @@ -1,179 +1,199 @@ h1{ - font-size: 130%; - text-align: left; + font-size: 120%; + text-align: left; } h2{ - font-size: 115%; - text-align: left; + font-size: 110%; + text-align: left; } h3{ - font-size: 100%; - text-align: left; + font-size: 100%; + text-align: left; } p{ - text-align: left; + text-align: left; } body{ - margin-top: 95px; - font-family: verdana, arial, helvetica, sans-serif; - font-size: 10pt; + margin-top: 95px; + font-family: arial, sans-serif; + font-size: 10pt; } div.top-links{ - font-size: 10pt; - display: block; - left: 0px; - bottom: 0px; - margin-top: 10px; - margin-left: 10px; + font-size: 10pt; + display: block; + left: 0px; + bottom: 0px; + margin-top: 10px; + margin-left: 10px; } a:link { - color: #0033CC; - background-color: inherit; - text-decoration: none; + color: #0033CC; + background-color: inherit; + text-decoration: none; } a:hover { - color:blue; - background:#eeeeee; - text-decoration: underline; + color:blue; + background:#eeeeee; + text-decoration: underline; } a:visited { - color: #990099; - background-color: inherit; - text-decoration: none; + color: #990099; + background-color: inherit; + text-decoration: none; } +a.toc-backref { + text-decoration: none ; + color: black +} .top { - color: #AFAFAF; - font-size: 10pt; - margin:0; - padding:0; - background-color: #DFDFDF; - border-bottom: thin solid #333333; - position: absolute; - top: 0px; - left: 0px; - height: 80px; - width: 100%; + color: #AFAFAF; + font-size: 10pt; + margin:0; + padding:0; + background-color: #DFDFDF; + border-bottom: thin solid #333333; + position: absolute; + top: 0px; + left: 0px; + height: 80px; + width: 100%; } div.top h1{ - font-size: 18pt; - margin: 10px 0px 0px 10px; + font-size: 18pt; + margin: 10px 0px 0px 10px; } img{border:none;} a.python-logo img { - margin-top: 5px; - margin-right: 10px; - position: absolute; - top: 0px; - right: 0px; - width: 211px; height: 71px; + margin-top: 5px; + margin-right: 10px; + position: absolute; + top: 0px; + right: 0px; + width: 211px; height: 71px; } div.document { - margin-left: 140px; - padding-top: 0px; - padding-left: 30px; - margin-bottom: 10px; - padding-right: 0px; + margin-left: 140px; + padding-top: 0px; + padding-left: 30px; + margin-bottom: 10px; + padding-right: 0px; } div.section{ margin-bottom:20px; } div.bottom { - margin-left: 160px; - margin-right: 200px; - padding-top: 10px; - padding-left: 10px; - margin-bottom: 30px; - padding-right: 0px; - - background-color: #FFFFFF; + margin-left: 160px; + margin-right: 200px; + padding-top: 10px; + padding-left: 10px; + margin-bottom: 30px; + padding-right: 0px; + + background-color: #FFFFFF; } div.left { - width: 160px; - float: left; - padding: 0; - margin-bottom: 10px; - background-color: #EEEEEE; - border: thin solid #BBB; + width: 160px; + float: left; + padding: 0; + margin-bottom: 10px; + background-color: #EEEEEE; + border: thin solid #BBB; + font-size: 10pt; + font-family: arial, sans-serif; } div.right { - /*width: 275px;*/ - /*height: 36px;*/ - float: right; - /*background-color: #DFDFDF;*/ - color: #000; - /*margin: 2px 0px 0px 2px;*/ - /*padding: 6px 0px 0px 6px;*/ - /*border: thin solid #BBB;*/ + /*width: 275px;*/ + /*height: 36px;*/ + float: right; + /*background-color: #DFDFDF;*/ + color: #000; + /*margin: 2px 0px 0px 2px;*/ + /*padding: 6px 0px 0px 6px;*/ + /*border: thin solid #BBB;*/ } div.right p { font: 8pt arial, sans-serif; text-decoration: underline; } div.contents { - width: 300px; - border: thin solid #BBB; - background-color: #EEEEEE; - color: #000; - padding: 10px; + width: 300px; + border: thin solid #BBB; + background-color: #EEEEEE; + color: #000; + padding-left: 10px; } + +div.contents p{ + font-size: 115%; + font-weight: bold; +} + ol.contents { - margin: 0px 0px 4px 0px; - padding: 2px; + margin: 0px 0px 0px 0px; + padding: 2px; } ol.contents li { display: block; } ol.contents ol { padding-left: 20px; } ul.menu { - width: 160px; - padding: 0; - margin: 0px 0px 20px 0px; + width: 160px; + padding: 0; + margin: 0px 0px 20px 0px; } ul.menu li { - display: block; - border: thin solid #BBB; - margin: 0px 0px 4px 0px; - padding: 2px; - background-color: #DFDFDF; - color: #000; + display: block; + border: thin solid #BBB; + margin: 0px 0px 4px 0px; + padding: 2px; + background-color: #DFDFDF; + color: #000; } ul.menu li a { display: block; width: 100%;} ul.menu li.current { - border-left: 5px solid #BBB; + border-left: 5px solid #BBB; } ul.menu li.submenu { - border: none; - margin: 0; - padding:0; - background: none; + border: none; + margin: 0; + padding:0; + background: none; } ul.menu li.submenu ul { - margin: 0px 0px 0px 10px; - padding: 0px; + margin: 0px 0px 0px 10px; + padding: 0px; } ul.menu li.submenu li { - padding-left: 0px; - border-left: none; - border-right: none; - border-top: none; - border-bottom: thin solid #BBB; - width: 145px; - background: none; + padding-left: 0px; + border-left: none; + border-right: none; + border-top: none; + border-bottom: thin solid #BBB; + width: 145px; + background: none; } + +tt.docutils { + background-color: #eeeeee +} + +div.highlight{ + background-color: #eeeeee +} \ No newline at end of file Modified: website/templates/online/page_template.html =================================================================== --- website/templates/online/page_template.html 2007-02-27 14:09:35 UTC (rev 938) +++ website/templates/online/page_template.html 2007-02-28 21:25:38 UTC (rev 939) @@ -32,10 +32,10 @@ <input type="submit" name="sa" value="Search" /> <input type="hidden" name="cof" value="FORID:10" /> </form> - <script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=searchbox_017839341659215598962%3Arpxttlw8grw"></script> + <script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=searchbox_017839341659215598962%3Arpxttlw8grw"></script> <!-- Google CSE Search Box Ends --> </div> - + <div class="left"> ${ XML( topics_creator.Template(rest_file_path).serialize(fragment=1) ) } <script type="text/javascript"><!-- @@ -46,7 +46,7 @@ google_ad_format = "160x600_as"; google_ad_type = "text_image"; google_ad_channel ="3930442450"; - google_color_border = "BBBBBB"; + google_color_border = "FFFFFF"; google_color_bg = "EEEEEE"; google_color_link = "0033CC"; google_color_text = "000000"; @@ -57,7 +57,7 @@ src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> <!-- xml kid bug --> </script> - </div> + </div> <div class="rest_document"> <!-- google_ad_section_start --> ${ XML(page_content) } @@ -105,6 +105,6 @@ <script type="text/javascript"> _uacct = "UA-355561-1"; urchinTracker(); - </script> + </script> </body> </html> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-02-27 14:17:52
|
Revision: 938 http://svn.sourceforge.net/pygccxml/?rev=938&view=rev Author: roman_yakovenko Date: 2007-02-27 06:09:35 -0800 (Tue, 27 Feb 2007) Log Message: ----------- adding experimental reader for pdb files Added Paths: ----------- pygccxml_dev/unittests/pdb_reader.py Added: pygccxml_dev/unittests/pdb_reader.py =================================================================== --- pygccxml_dev/unittests/pdb_reader.py (rev 0) +++ pygccxml_dev/unittests/pdb_reader.py 2007-02-27 14:09:35 UTC (rev 938) @@ -0,0 +1,22 @@ +import os +import sys +import win32com.client +from sets import Set as set + +MODULE_IDENTIFIER = ('{106173A0-0173-4e5c-84E7-E915422BE997}', 0, 2, 0) +MODULE_PATH = r'Lib\site-packages\win32com\gen_py\106173A0-0173-4e5c-84E7-E915422BE997x0x2x0.py' + +try: + full_module_path = os.path.split( sys.executable )[0] + full_module_path = os.path.join( full_module_path, MODULE_PATH ) + if os.path.exists( full_module_path ): + os.remove( full_module_path ) + print full_module_path, " removed successfully" +except Exception, error: + print error + +msdia = win32com.client.gencache.EnsureModule( *MODULE_IDENTIFIER ) +print msdia + +if __name__ == "__main__": + pass This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-02-27 08:15:49
|
Revision: 937 http://svn.sourceforge.net/pygccxml/?rev=937&view=rev Author: roman_yakovenko Date: 2007-02-27 00:15:49 -0800 (Tue, 27 Feb 2007) Log Message: ----------- operator<< second argument should have type const T&, otherwise the generated code will not compile Modified Paths: -------------- pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py Modified: pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2007-02-26 21:54:54 UTC (rev 936) +++ pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2007-02-27 08:15:49 UTC (rev 937) @@ -344,8 +344,15 @@ type_ = declarations.remove_reference( type_ ) if declarations.is_const( type_ ): return False - return declarations.is_std_ostream( type_ ) \ - or declarations.is_std_wostream( type_ ) + if args_len == 2: + #second argument should has "T const &" type, otherwise the code will not compile + tmp = oper.arguments[1].type + if not declarations.is_reference( tmp ): + return False + tmp = declarations.remove_reference( tmp ) + if not declarations.is_const( tmp ): + return False + return declarations.is_std_ostream( type_ ) or declarations.is_std_wostream( type_ ) @staticmethod def exportable( oper ): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-02-26 21:54:53
|
Revision: 936 http://svn.sourceforge.net/pygccxml/?rev=936&view=rev Author: roman_yakovenko Date: 2007-02-26 13:54:54 -0800 (Mon, 26 Feb 2007) Log Message: ----------- fixes for boost python indexing suite compilation error on 64-bit systems and Python 2.5 from Gustavo Carneiro Modified Paths: -------------- pyplusplus_dev/indexing_suite_v2/indexing/slice.hpp pyplusplus_dev/indexing_suite_v2/src/indexing/indexing_slice.cpp Modified: pyplusplus_dev/indexing_suite_v2/indexing/slice.hpp =================================================================== --- pyplusplus_dev/indexing_suite_v2/indexing/slice.hpp 2007-02-26 21:44:29 UTC (rev 935) +++ pyplusplus_dev/indexing_suite_v2/indexing/slice.hpp 2007-02-26 21:54:54 UTC (rev 936) @@ -48,7 +48,11 @@ // This class provides a convenient interface to Python slice // objects that contain integer bound and stride values. - typedef int index_type; + #if PY_VERSION_HEX < 0x02050000 + typedef int index_type; + #else + typedef Py_ssize_t index_type; + #endif integer_slice (slice const &, index_type length); // integer_slice must know how big the container is so it can Modified: pyplusplus_dev/indexing_suite_v2/src/indexing/indexing_slice.cpp =================================================================== --- pyplusplus_dev/indexing_suite_v2/src/indexing/indexing_slice.cpp 2007-02-26 21:44:29 UTC (rev 935) +++ pyplusplus_dev/indexing_suite_v2/src/indexing/indexing_slice.cpp 2007-02-26 21:54:54 UTC (rev 936) @@ -61,8 +61,8 @@ boost::python::throw_error_already_set (); } - m_start = std::max (0, std::min (length, m_start)); - m_stop = std::max (0, std::min (length, m_stop)); + m_start = std::max (static_cast<index_type> (0), std::min (length, m_start)); + m_stop = std::max (static_cast<index_type> (0), std::min (length, m_stop)); m_direction = (m_step > 0) ? 1 : -1; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2007-02-26 21:44:32
|
Revision: 935 http://svn.sourceforge.net/pygccxml/?rev=935&view=rev Author: roman_yakovenko Date: 2007-02-26 13:44:29 -0800 (Mon, 26 Feb 2007) Log Message: ----------- adding initial support for str( self ) ( operator<< ) support Modified Paths: -------------- pyplusplus_dev/unittests/data/operators_to_be_exported.hpp pyplusplus_dev/unittests/operators_tester.py Modified: pyplusplus_dev/unittests/data/operators_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/operators_to_be_exported.hpp 2007-02-26 21:43:00 UTC (rev 934) +++ pyplusplus_dev/unittests/data/operators_to_be_exported.hpp 2007-02-26 21:44:29 UTC (rev 935) @@ -26,6 +26,23 @@ } }; +struct XXX{ + friend std::ostream& operator<<(std::ostream& s, XXX const& x); +}; + +inline std::ostream& operator<<(std::ostream& s, XXX const& x){ + return s << "<XXX instance at " << &x << ">"; +} + +//Boost.Python does not support member operator<< +struct YYY{ + std::ostream& operator<<(std::ostream& s) const{ + return s; + //return s << "<YYY instance at " << reinterpret_cast<unsigned long>( this )<< ">"; + } +}; + + } } Modified: pyplusplus_dev/unittests/operators_tester.py =================================================================== --- pyplusplus_dev/unittests/operators_tester.py 2007-02-26 21:43:00 UTC (rev 934) +++ pyplusplus_dev/unittests/operators_tester.py 2007-02-26 21:44:29 UTC (rev 935) @@ -7,6 +7,7 @@ import sys import unittest import fundamental_tester_base +from pygccxml import declarations from pyplusplus.module_builder import call_policies class tester_t(fundamental_tester_base.fundamental_tester_base_t): @@ -20,6 +21,14 @@ def customize( self, mb ): mb.global_ns.exclude() + + xxx = mb.class_( 'XXX' ) + xxx.include() + xxx_ref = declarations.reference_t( declarations.const_t( declarations.declarated_t( xxx ) ) ) + oper = mb.global_ns.free_operator( '<<', arg_types=[None, xxx_ref] ) + oper.include() + + mb.class_( 'YYY' ).include() rational = mb.class_('rational<long>') rational.include() @@ -78,7 +87,13 @@ r1 = pyrational( 5, 7 ) self.failUnless( r1.assign( 17 ) == pyrational( 17, 1 ) ) + + x = module.XXX() + print str( x ) + y = module.YYY() + print str( y ) + 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: <rom...@us...> - 2007-02-26 21:43:03
|
Revision: 934 http://svn.sourceforge.net/pygccxml/?rev=934&view=rev Author: roman_yakovenko Date: 2007-02-26 13:43:00 -0800 (Mon, 26 Feb 2007) Log Message: ----------- adding initial support for str( self ) ( operator<< ) support Modified Paths: -------------- pyplusplus_dev/pyplusplus/code_creators/calldef.py pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py pyplusplus_dev/pyplusplus/module_creator/creator.py Modified: pyplusplus_dev/pyplusplus/code_creators/calldef.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/calldef.py 2007-02-26 21:28:13 UTC (rev 933) +++ pyplusplus_dev/pyplusplus/code_creators/calldef.py 2007-02-26 21:43:00 UTC (rev 934) @@ -1003,8 +1003,13 @@ assert not "Unable to find out boost::python::self position. " + str( self.declaration ) def _create_binary_operator(self): + self_identifier = algorithm.create_identifier( self, '::boost::python::self' ) + + if self.declaration.symbol == '<<': + str_identifier = algorithm.create_identifier( self, '::boost::python::self_ns::str' ) + return '%s( %s )' % ( str_identifier, self_identifier ) + answer = [ None, self.declaration.symbol, None ] - self_identifier = algorithm.create_identifier( self, '::boost::python::self' ) self_position = self._findout_self_position() if self_position == self.SELF_POSITION.FIRST: answer[0] = self_identifier Modified: pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2007-02-26 21:28:13 UTC (rev 933) +++ pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2007-02-26 21:43:00 UTC (rev 934) @@ -317,7 +317,7 @@ """helps Py++ to deal with C++ operators""" inplace = [ '+=', '-=', '*=', '/=', '%=', '>>=', '<<=', '&=', '^=', '|=' ] comparison = [ '==', '!=', '<', '>', '<=', '>=' ] - non_member = [ '+', '-', '*', '/', '%', '&', '^', '|' ] #'>>', '<<', not implemented + non_member = [ '+', '-', '*', '/', '%', '&', '^', '|', ] unary = [ '!', '~', '+', '-' ] all = inplace + comparison + non_member + unary @@ -328,7 +328,24 @@ if oper.symbol == '*' and len( oper.arguments ) == 0: #dereference does not make sense return False - return oper.symbol in operators_helper.all + if oper.symbol != '<<': + return oper.symbol in operators_helper.all + + args_len = len( oper.arguments ) + if isinstance( oper, declarations.member_operator_t ):# and args_len != 1: + return False #Boost.Python does not support member operator<< :-( + if isinstance( oper, declarations.free_operator_t ) and args_len != 2: + return False + if not declarations.is_same( oper.return_type, oper.arguments[0].type ): + return False + type_ = oper.return_type + if not declarations.is_reference( type_ ): + return False + type_ = declarations.remove_reference( type_ ) + if declarations.is_const( type_ ): + return False + return declarations.is_std_ostream( type_ ) \ + or declarations.is_std_wostream( type_ ) @staticmethod def exportable( oper ): Modified: pyplusplus_dev/pyplusplus/module_creator/creator.py =================================================================== --- pyplusplus_dev/pyplusplus/module_creator/creator.py 2007-02-26 21:28:13 UTC (rev 933) +++ pyplusplus_dev/pyplusplus/module_creator/creator.py 2007-02-26 21:43:00 UTC (rev 934) @@ -201,6 +201,10 @@ arg_type = declarations.base_type( operator.arguments[0].type ) if isinstance( arg_type, declarations.fundamental_t ): arg_type = declarations.base_type( operator.arguments[1].type ) + elif isinstance( arg_type, declarations.declarated_t ) and arg_type.declaration.ignore: + arg_type = declarations.base_type( operator.arguments[1].type ) + else: + pass assert isinstance( arg_type, declarations.declarated_t ) found = find( lambda decl: arg_type.declaration is decl , self.__extmodule.body.creators ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |