pygccxml-commit Mailing List for C++ Python language bindings (Page 28)
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-12-03 22:38:16
|
Revision: 1184
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1184&view=rev
Author: roman_yakovenko
Date: 2007-12-03 14:38:19 -0800 (Mon, 03 Dec 2007)
Log Message:
-----------
doc updates
Modified Paths:
--------------
pygccxml_dev/docs/links.rest
Modified: pygccxml_dev/docs/links.rest
===================================================================
--- pygccxml_dev/docs/links.rest 2007-12-03 19:35:37 UTC (rev 1183)
+++ pygccxml_dev/docs/links.rest 2007-12-03 22:38:19 UTC (rev 1184)
@@ -16,8 +16,6 @@
* `XTI An Extended Type Information Library`_ - Bjarne Stroustrup talk about adding
reflection information to C++ program.
-
-
.. _`XTI An Extended Type Information Library` : http://lcgapp.cern.ch/project/architecture/XTI_accu.pdf
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-12-03 19:35:33
|
Revision: 1183
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1183&view=rev
Author: roman_yakovenko
Date: 2007-12-03 11:35:37 -0800 (Mon, 03 Dec 2007)
Log Message:
-----------
adding new unittest for constructor declarations
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/code_creators/calldef.py
pyplusplus_dev/unittests/test_all.py
Added Paths:
-----------
pyplusplus_dev/unittests/constructors_bug_tester.py
pyplusplus_dev/unittests/data/constructors_bug_to_be_exported.hpp
Modified: pyplusplus_dev/pyplusplus/code_creators/calldef.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/calldef.py 2007-12-02 20:48:27 UTC (rev 1182)
+++ pyplusplus_dev/pyplusplus/code_creators/calldef.py 2007-12-03 19:35:37 UTC (rev 1183)
@@ -126,7 +126,7 @@
if not self.works_on_instance:
#indenting and adding scope
code = ''.join( result )
- result = [ '{ //%s' % self.decl_identifier ]
+ result = [ '{ //%s' % declarations.full_name( self.declaration ) ]
result.append( os.linesep * 2 )
result.append( self.indent( code ) )
result.append( os.linesep * 2 )
Added: pyplusplus_dev/unittests/constructors_bug_tester.py
===================================================================
--- pyplusplus_dev/unittests/constructors_bug_tester.py (rev 0)
+++ pyplusplus_dev/unittests/constructors_bug_tester.py 2007-12-03 19:35:37 UTC (rev 1183)
@@ -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)
+
+import os
+import sys
+import unittest
+import fundamental_tester_base
+from pyplusplus import code_creators
+
+class tester_t(fundamental_tester_base.fundamental_tester_base_t):
+ EXTENSION_NAME = 'constructors_bug'
+
+ 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/data/constructors_bug_to_be_exported.hpp
===================================================================
--- pyplusplus_dev/unittests/data/constructors_bug_to_be_exported.hpp (rev 0)
+++ pyplusplus_dev/unittests/data/constructors_bug_to_be_exported.hpp 2007-12-03 19:35:37 UTC (rev 1183)
@@ -0,0 +1,28 @@
+// Copyright 2004-2007 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 __constructors_bug_to_be_exported_hpp__
+#define __constructors_bug_to_be_exported_hpp__
+
+struct Joint{};
+struct Actor{};
+
+class JointCallback {
+public:
+
+ class JointBreakCallback {
+ public:
+ virtual void onBreak(Joint*, float, Actor*, Actor*) {}
+ };
+
+ void onBreak(Joint* j, float impulse, Actor* a, Actor* b) {
+ mCallback->onBreak(j,impulse, a,b);
+ }
+
+ JointBreakCallback* mCallback;
+};
+
+
+#endif//__constructors_bug_to_be_exported_hpp__
Modified: pyplusplus_dev/unittests/test_all.py
===================================================================
--- pyplusplus_dev/unittests/test_all.py 2007-12-02 20:48:27 UTC (rev 1182)
+++ pyplusplus_dev/unittests/test_all.py 2007-12-03 19:35:37 UTC (rev 1183)
@@ -95,10 +95,10 @@
import unicode_bug
import include_exclude_bug_tester
import vector_with_shared_data_tester
+import constructors_bug_tester
-
testers = [
algorithms_tester
, module_body_tester
@@ -180,6 +180,7 @@
, include_exclude_bug_tester
, vector_with_shared_data_tester
, templates_tester
+ , constructors_bug_tester
]
class module_runner_t( object ):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-12-02 20:48:23
|
Revision: 1182
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1182&view=rev
Author: roman_yakovenko
Date: 2007-12-02 12:48:27 -0800 (Sun, 02 Dec 2007)
Log Message:
-----------
trying to create new tester that reproduce erronious generated code
Modified Paths:
--------------
pyplusplus_dev/unittests/data/split_module_bug_to_be_exported.hpp
pyplusplus_dev/unittests/split_module_bug_tester.py
Added Paths:
-----------
pyplusplus_dev/unittests/data/split_module_bug_to_be_exported.cpp
pyplusplus_dev/unittests/ogre_generate_tester.py
Added: pyplusplus_dev/unittests/data/split_module_bug_to_be_exported.cpp
===================================================================
--- pyplusplus_dev/unittests/data/split_module_bug_to_be_exported.cpp (rev 0)
+++ pyplusplus_dev/unittests/data/split_module_bug_to_be_exported.cpp 2007-12-02 20:48:27 UTC (rev 1182)
@@ -0,0 +1,3 @@
+#include "split_module_bug_to_be_exported.hpp"
+
+void do_smth(std::vector< image_t > &images){}
Modified: pyplusplus_dev/unittests/data/split_module_bug_to_be_exported.hpp
===================================================================
--- pyplusplus_dev/unittests/data/split_module_bug_to_be_exported.hpp 2007-11-29 07:02:58 UTC (rev 1181)
+++ pyplusplus_dev/unittests/data/split_module_bug_to_be_exported.hpp 2007-12-02 20:48:27 UTC (rev 1182)
@@ -16,4 +16,10 @@
typedef std::vector<int> int_vector;
inline int_vector get_vector(){ return int_vector(); }
+struct image_t{
+ int i;
+};
+
+void do_smth(std::vector< image_t > &images);
+
#endif//__split_module_to_be_exported_hpp__
Added: pyplusplus_dev/unittests/ogre_generate_tester.py
===================================================================
--- pyplusplus_dev/unittests/ogre_generate_tester.py (rev 0)
+++ pyplusplus_dev/unittests/ogre_generate_tester.py 2007-12-02 20:48:27 UTC (rev 1182)
@@ -0,0 +1,50 @@
+# 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 shutil
+import unittest
+import autoconfig
+from pygccxml import parser
+from pygccxml import declarations
+from pyplusplus import code_creators
+from pyplusplus import module_creator
+from pyplusplus import module_builder
+from pyplusplus import utils as pypp_utils
+from pyplusplus import function_transformers as ft
+
+class ogre_generate_tester_t(unittest.TestCase):
+ def test(self):
+ ogre_file = autoconfig.data_directory.replace( 'pyplusplus_dev', 'pygccxml_dev' )
+ ogre_file = parser.create_gccxml_fc( os.path.join( ogre_file, 'ogre1.4.xml' ) )
+
+ mb = module_builder.module_builder_t(
+ [ ogre_file ]
+ , gccxml_path=autoconfig.gccxml.executable
+ , indexing_suite_version=2)
+ mb.global_ns.exclude()
+ mb.namespace('Ogre').include()
+
+ target_dir = os.path.join( autoconfig.build_directory, 'ogre' )
+ if os.path.exists( target_dir ):
+ shutil.rmtree( target_dir )
+ os.mkdir( target_dir )
+
+ mb.build_code_creator( 'Ogre3d' )
+ mb.split_module( target_dir )
+
+
+
+def create_suite():
+ suite = unittest.TestSuite()
+ suite.addTest( unittest.makeSuite(ogre_generate_tester_t))
+ return suite
+
+def run_suite():
+ unittest.TextTestRunner(verbosity=2).run( create_suite() )
+
+if __name__ == "__main__":
+ run_suite()
Modified: pyplusplus_dev/unittests/split_module_bug_tester.py
===================================================================
--- pyplusplus_dev/unittests/split_module_bug_tester.py 2007-11-29 07:02:58 UTC (rev 1181)
+++ pyplusplus_dev/unittests/split_module_bug_tester.py 2007-12-02 20:48:27 UTC (rev 1182)
@@ -19,6 +19,7 @@
fundamental_tester_base.fundamental_tester_base_t.__init__(
self
, tester_t.EXTENSION_NAME
+ , indexing_suite_version=2
, *args )
self.files = []
@@ -30,8 +31,11 @@
def generate_source_files( self, mb ):
files = mb.split_module( autoconfig.build_dir, on_unused_file_found=lambda fpath: fpath )
self.files = filter( lambda fname: fname.endswith( 'cpp' ), files )
+ self.files.append( os.path.join( autoconfig.data_directory
+ , self.EXTENSION_NAME + '_to_be_exported.cpp' ) )
print self.files
+
def get_source_files( self ):
return self.files
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-11-29 07:02:53
|
Revision: 1181
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1181&view=rev
Author: roman_yakovenko
Date: 2007-11-28 23:02:58 -0800 (Wed, 28 Nov 2007)
Log Message:
-----------
improving create_with_signature algorithm - fucntion, which are template instantiations will be exposed with signature
Modified Paths:
--------------
pyplusplus_dev/unittests/test_all.py
Added Paths:
-----------
pyplusplus_dev/unittests/data/mailing_list_help_to_be_exported.hpp
pyplusplus_dev/unittests/data/templates_to_be_exported.hpp
pyplusplus_dev/unittests/mailing_list_help_tester.py
pyplusplus_dev/unittests/templates_tester.py
Added: pyplusplus_dev/unittests/data/mailing_list_help_to_be_exported.hpp
===================================================================
--- pyplusplus_dev/unittests/data/mailing_list_help_to_be_exported.hpp (rev 0)
+++ pyplusplus_dev/unittests/data/mailing_list_help_to_be_exported.hpp 2007-11-29 07:02:58 UTC (rev 1181)
@@ -0,0 +1,20 @@
+#ifndef __mailing_list_help_hpp__
+#define __mailing_list_help_hpp__
+
+#include <string>
+
+class foo
+{
+public:
+
+ foo() {std::strcpy(buffer, "good bye cruel world!\0\0");}
+ char buffer[24];
+};
+
+class bar
+{
+public:
+ foo f;
+};
+
+#endif//__mailing_list_help_hpp__
Added: pyplusplus_dev/unittests/data/templates_to_be_exported.hpp
===================================================================
--- pyplusplus_dev/unittests/data/templates_to_be_exported.hpp (rev 0)
+++ pyplusplus_dev/unittests/data/templates_to_be_exported.hpp 2007-11-29 07:02:58 UTC (rev 1181)
@@ -0,0 +1,31 @@
+// 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 __enums_to_be_exported_hpp__
+#define __enums_to_be_exported_hpp__
+
+#include "boost/rational.hpp"
+
+class C{
+public:
+
+ template<typename T>
+ T get_value() const{
+ return static_cast<T>(m_value);
+ }
+
+private:
+ int m_value;
+};
+
+struct instantiator_t{
+ instantiator_t(){
+ boost::gcd<long int>( 1, 1);
+ C c;
+ c.get_value<int>();
+ }
+};
+
+#endif//__enums_to_be_exported_hpp__
Added: pyplusplus_dev/unittests/mailing_list_help_tester.py
===================================================================
--- pyplusplus_dev/unittests/mailing_list_help_tester.py (rev 0)
+++ pyplusplus_dev/unittests/mailing_list_help_tester.py 2007-11-29 07:02:58 UTC (rev 1181)
@@ -0,0 +1,47 @@
+# 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
+
+class tester_t(fundamental_tester_base.fundamental_tester_base_t):
+ EXTENSION_NAME = 'mailing_list_help'
+
+ def __init__( self, *args ):
+ fundamental_tester_base.fundamental_tester_base_t.__init__(
+ self
+ , tester_t.EXTENSION_NAME
+ , *args )
+
+ def customize(self, mb ):
+ foo = mb.class_( 'foo' )
+ foo.add_wrapper_code( 'static std::string get_buffer(const foo& x) { return std::string(x.buffer); }' )
+ foo.add_registration_code( 'def("__str__", &foo_wrapper::get_buffer)' )
+ #bar = mb.class_( 'bar' )
+ #bar.var( 'f' ).use_make_functions = True
+
+ def run_tests( self, module):
+ f1 = module.foo()
+ print 'f1.buffer: ', f1.buffer
+ print 'str(f1):', str(f1)
+ b1 = module.bar()
+ print 'b1.f.buffer:', b1.f.buffer
+ print 'b1.f:', b1.f
+ print 'str(b1.f):', str(b1.f)
+
+
+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/templates_tester.py
===================================================================
--- pyplusplus_dev/unittests/templates_tester.py (rev 0)
+++ pyplusplus_dev/unittests/templates_tester.py 2007-11-29 07:02:58 UTC (rev 1181)
@@ -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 sys
+import unittest
+import fundamental_tester_base
+
+class tester_t(fundamental_tester_base.fundamental_tester_base_t):
+ EXTENSION_NAME = 'templates'
+
+ def __init__( self, *args ):
+ fundamental_tester_base.fundamental_tester_base_t.__init__(
+ self
+ , tester_t.EXTENSION_NAME
+ , *args )
+
+ def customize(self, mb ):
+ mb.global_ns.exclude()
+ gcd = mb.free_fun( 'gcd' )
+ gcd.include()
+ c = mb.class_('C')
+ c.include()
+ for f in [gcd, c.mem_fun( 'get_value' )]:
+ f.alias = f.name
+ f.name = f.demangled_name
+ #f.create_with_signature = True
+
+ 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()
Modified: pyplusplus_dev/unittests/test_all.py
===================================================================
--- pyplusplus_dev/unittests/test_all.py 2007-11-29 06:59:58 UTC (rev 1180)
+++ pyplusplus_dev/unittests/test_all.py 2007-11-29 07:02:58 UTC (rev 1181)
@@ -82,6 +82,7 @@
import custom_smart_ptr_classes_tester
import custom_string_tester
import final_classes_tester
+import templates_tester
#gui_tester
#gui_wizard_tester
#
@@ -178,6 +179,7 @@
, unicode_bug
, include_exclude_bug_tester
, vector_with_shared_data_tester
+ , templates_tester
]
class module_runner_t( object ):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-11-29 06:59:53
|
Revision: 1180
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1180&view=rev
Author: roman_yakovenko
Date: 2007-11-28 22:59:58 -0800 (Wed, 28 Nov 2007)
Log Message:
-----------
improving create_with_signature algorithm - fucntion, which are template instantiations will be exposed with signature
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-11-27 20:37:00 UTC (rev 1179)
+++ pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2007-11-29 06:59:58 UTC (rev 1180)
@@ -54,6 +54,10 @@
def _get_create_with_signature(self):
if None is self._create_with_signature:
self._create_with_signature = bool( self.overloads )
+
+ if not self._create_with_signature and declarations.templates.is_instantiation( self.name ):
+ self._create_with_signature = True
+
if not self._create_with_signature and isinstance( self.parent, declarations.class_t ):
for hi in self.parent.recursive_bases:
if hi.access_type == 'private':
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-11-27 20:36:55
|
Revision: 1179
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1179&view=rev
Author: roman_yakovenko
Date: 2007-11-27 12:37:00 -0800 (Tue, 27 Nov 2007)
Log Message:
-----------
small improvement to allow the users to implement precompiled header files
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/file_writers/class_multiple_files.py
pyplusplus_dev/pyplusplus/file_writers/multiple_files.py
Modified: pyplusplus_dev/pyplusplus/file_writers/class_multiple_files.py
===================================================================
--- pyplusplus_dev/pyplusplus/file_writers/class_multiple_files.py 2007-11-27 20:00:35 UTC (rev 1178)
+++ pyplusplus_dev/pyplusplus/file_writers/class_multiple_files.py 2007-11-27 20:37:00 UTC (rev 1179)
@@ -113,7 +113,7 @@
#relevant header file
head_headers = [ self.create_base_fname( class_creator, pattern + self.HEADER_EXT ) ]
- source_code.append( self.create_include_code( creators, head_headers ) )
+ source_code.append( self.create_include_code( creators, tail_headers=head_headers ) )
source_code.append( '' )
source_code.append( self.create_namespaces_code( creators ) )
Modified: pyplusplus_dev/pyplusplus/file_writers/multiple_files.py
===================================================================
--- pyplusplus_dev/pyplusplus/file_writers/multiple_files.py 2007-11-27 20:00:35 UTC (rev 1178)
+++ pyplusplus_dev/pyplusplus/file_writers/multiple_files.py 2007-11-27 20:37:00 UTC (rev 1179)
@@ -227,7 +227,7 @@
answer.append( self.extmodule.license.create() )
head_headers = [ file_name + self.HEADER_EXT ]
- answer.append( self.create_include_code( creators, head_headers ) )
+ answer.append( self.create_include_code( creators, tail_headers=head_headers ) )
answer.append( '' )
answer.append( self.create_namespaces_code( creators ) )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-11-27 20:00:31
|
Revision: 1178
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1178&view=rev
Author: roman_yakovenko
Date: 2007-11-27 12:00:35 -0800 (Tue, 27 Nov 2007)
Log Message:
-----------
adding support for class partial name - name without default template arguments
STL containers will be generated using partial name
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/code_creators/calldef.py
pyplusplus_dev/pyplusplus/code_creators/calldef_utils.py
pyplusplus_dev/pyplusplus/code_creators/class_declaration.py
pyplusplus_dev/pyplusplus/code_creators/declaration_based.py
pyplusplus_dev/pyplusplus/code_creators/global_variable.py
pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py
pyplusplus_dev/pyplusplus/code_creators/member_variable.py
pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py
Modified: pyplusplus_dev/pyplusplus/code_creators/calldef.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/calldef.py 2007-11-27 19:57:39 UTC (rev 1177)
+++ pyplusplus_dev/pyplusplus/code_creators/calldef.py 2007-11-27 20:00:35 UTC (rev 1178)
@@ -126,7 +126,7 @@
if not self.works_on_instance:
#indenting and adding scope
code = ''.join( result )
- result = [ '{ //%s' % declarations.full_name( self.declaration ) ]
+ result = [ '{ //%s' % self.decl_identifier ]
result.append( os.linesep * 2 )
result.append( self.indent( code ) )
result.append( os.linesep * 2 )
@@ -158,7 +158,7 @@
return arg_utils.args_declaration()
def wrapped_class_identifier( self ):
- return algorithm.create_identifier( self, declarations.full_name( self.declaration.parent ) )
+ return algorithm.create_identifier( self, self.declaration.parent.partial_decl_string )
def unoverriden_function_body( self ):
return 'throw std::logic_error("%s");' % self.declaration.non_overridable_reason
@@ -168,7 +168,7 @@
if not self.declaration.exceptions:
return ''
else:
- exceptions = map( lambda exception: algorithm.create_identifier( self, exception.decl_string )
+ exceptions = map( lambda exception: algorithm.create_identifier( self, exception.partial_decl_string )
, self.declaration.exceptions )
return ' throw( ' + self.PARAM_SEPARATOR.join( exceptions ) + ' )'
else:
@@ -192,7 +192,8 @@
return self.def_identifier()
def create_function_type_alias_code( self, exported_class_alias=None ):
- return 'typedef ' + self.declaration.function_type().create_typedef( self.function_type_alias ) + ';'
+ f_type = self.declaration.function_type()
+ return 'typedef ' + f_type.create_typedef( self.function_type_alias, with_defaults=False ) + ';'
def create_function_ref_code(self, use_function_alias=False):
if use_function_alias:
@@ -200,7 +201,7 @@
% ( self.function_type_alias, declarations.full_name( self.declaration ) )
elif self.declaration.create_with_signature:
return '(%s)( &%s )' \
- % ( self.declaration.function_type().decl_string
+ % ( self.declaration.function_type().partial_decl_string
, declarations.full_name( self.declaration ) )
else:
return '&%s' % declarations.full_name( self.declaration )
@@ -212,7 +213,7 @@
def create_function_type_alias_code( self, exported_class_alias=None ):
ftype = self.declaration.function_type()
- return 'typedef %s;' % ftype.create_typedef( self.function_type_alias, exported_class_alias )
+ return 'typedef %s;' % ftype.create_typedef( self.function_type_alias, exported_class_alias, with_defaults=False )
def create_function_ref_code(self, use_function_alias=False):
if use_function_alias:
Modified: pyplusplus_dev/pyplusplus/code_creators/calldef_utils.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/calldef_utils.py 2007-11-27 19:57:39 UTC (rev 1177)
+++ pyplusplus_dev/pyplusplus/code_creators/calldef_utils.py 2007-11-27 20:00:35 UTC (rev 1178)
@@ -57,7 +57,8 @@
if declarations.is_fundamental( arg_type_no_alias ) \
and declarations.is_integral( arg_type_no_alias ) \
and not arg.default_value.startswith( arg_type_no_alias.decl_string ):
- result.append( '=(%s)(%s)' % ( arg_type_no_alias.decl_string, arg.default_value ) )
+ result.append( '=(%s)(%s)' % ( arg_type_no_alias.partial_decl_string
+ , arg.default_value ) )
elif self.__should_use_enum_wa( arg ):
#Work around for bug/missing functionality in boost.python.
#registration order
@@ -79,7 +80,7 @@
def args_declaration( self ):
args = []
for index, arg in enumerate( self.__args ):
- result = arg.type.decl_string + ' ' + self.argument_name(index)
+ result = arg.type.partial_decl_string + ' ' + self.argument_name(index)
if arg.default_value:
result += '=%s' % arg.default_value
args.append( result )
Modified: pyplusplus_dev/pyplusplus/code_creators/class_declaration.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/class_declaration.py 2007-11-27 19:57:39 UTC (rev 1177)
+++ pyplusplus_dev/pyplusplus/code_creators/class_declaration.py 2007-11-27 20:00:35 UTC (rev 1178)
@@ -159,9 +159,9 @@
if base_desc.access != declarations.ACCESS_TYPES.PUBLIC:
continue
if base_creators.has_key( id(base_desc.related_class) ):
- bases.append( algorithm.create_identifier( self, base_desc.related_class.decl_string ) )
+ bases.append( algorithm.create_identifier( self, base_desc.related_class.partial_decl_string ) )
elif base_desc.related_class.already_exposed:
- bases.append( base_desc.related_class.decl_string )
+ bases.append( base_desc.related_class.partial_decl_string )
if not bases:
return None
bases_identifier = algorithm.create_identifier( self, '::boost::python::bases' )
@@ -186,14 +186,14 @@
else:
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.decl_identifier )
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 ) )
+ args.append( self.decl_identifier )
bases = self._generate_bases(base_creators)
if bases:
@@ -308,7 +308,7 @@
code = os.linesep.join( result )
- result = [ '{ //%s' % declarations.full_name( self.declaration ) ]
+ result = [ '{ //%s' % declarations.full_name( self.declaration, with_defaults=False ) ]
result.append( self.indent( code ) )
result.append( '}' )
Modified: pyplusplus_dev/pyplusplus/code_creators/declaration_based.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/declaration_based.py 2007-11-27 19:57:39 UTC (rev 1177)
+++ pyplusplus_dev/pyplusplus/code_creators/declaration_based.py 2007-11-27 20:00:35 UTC (rev 1178)
@@ -43,7 +43,7 @@
@property
def decl_identifier( self ):
- return algorithm.create_identifier( self, self.declaration.decl_string )
+ return algorithm.create_identifier( self, self.declaration.partial_decl_string )
@property
def documentation( self ):
Modified: pyplusplus_dev/pyplusplus/code_creators/global_variable.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/global_variable.py 2007-11-27 19:57:39 UTC (rev 1177)
+++ pyplusplus_dev/pyplusplus/code_creators/global_variable.py 2007-11-27 20:00:35 UTC (rev 1178)
@@ -112,7 +112,8 @@
def _get_wrapper_creator_type(self):
return declarations.free_function_type_t.create_decl_string(
return_type=self.wrapper_type
- , arguments_types=[] )
+ , arguments_types=[]
+ , with_defaults=False)
wrapper_creator_type = property( _get_wrapper_creator_type )
def _get_wrapper_creator_name(self):
Modified: pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py 2007-11-27 19:57:39 UTC (rev 1177)
+++ pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py 2007-11-27 20:00:35 UTC (rev 1178)
@@ -33,7 +33,7 @@
def _create_suite_declaration( self ):
suite_identifier = algorithm.create_identifier( self, self.guess_suite_name() )
- args = [ self.container.decl_string ]
+ args = [ self.container.partial_decl_string ]
try:
no_proxy = str( self.configuration.no_proxy ).lower()
except:
Modified: pyplusplus_dev/pyplusplus/code_creators/member_variable.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/member_variable.py 2007-11-27 19:57:39 UTC (rev 1177)
+++ pyplusplus_dev/pyplusplus/code_creators/member_variable.py 2007-11-27 20:00:35 UTC (rev 1178)
@@ -222,7 +222,8 @@
return declarations.free_function_type_t.create_decl_string(
return_type=self.declaration.type
- , arguments_types=arguments_types )
+ , arguments_types=arguments_types
+ , with_defaults=False)
getter_type = property( _get_getter_type )
def _get_setter_full_name(self):
@@ -237,7 +238,8 @@
return declarations.free_function_type_t.create_decl_string(
return_type=declarations.void_t()
- , arguments_types=arguments_types )
+ , arguments_types=arguments_types
+ , with_defaults=False)
setter_type = property( _get_setter_type )
def _get_has_setter( self ):
@@ -344,7 +346,8 @@
return_type=self.declaration.type
, class_decl_string=self.parent.full_name
, arguments_types=[]
- , has_const=True )
+ , has_const=True
+ , with_defaults=False)
getter_type = property( _get_getter_type )
def _get_setter_full_name(self):
@@ -356,7 +359,8 @@
return_type=declarations.void_t()
, class_decl_string=self.parent.full_name
, arguments_types=[self.declaration.type]
- , has_const=False )
+ , has_const=False
+ , with_defaults=False)
setter_type = property( _get_setter_type )
def _get_has_setter( self ):
Modified: pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py
===================================================================
--- pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py 2007-11-27 19:57:39 UTC (rev 1177)
+++ pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py 2007-11-27 20:00:35 UTC (rev 1178)
@@ -78,9 +78,9 @@
and self.aliases[0].name not in container_aliases:
self._alias = self.aliases[0].name
else:
- self._alias = self._generate_valid_name()
+ self._alias = algorithm.create_valid_name( self.partial_name )
else:
- self._alias = self.name
+ self._alias = self.partial_name
return self._alias
def _set_alias(self, alias):
self._alias = alias
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-11-27 19:57:34
|
Revision: 1177
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1177&view=rev
Author: roman_yakovenko
Date: 2007-11-27 11:57:39 -0800 (Tue, 27 Nov 2007)
Log Message:
-----------
adding support for class partial name - name without default template arguments
Added Paths:
-----------
pygccxml_dev/unittests/data/indexing_suites2.hpp
Added: pygccxml_dev/unittests/data/indexing_suites2.hpp
===================================================================
--- pygccxml_dev/unittests/data/indexing_suites2.hpp (rev 0)
+++ pygccxml_dev/unittests/data/indexing_suites2.hpp 2007-11-27 19:57:39 UTC (rev 1177)
@@ -0,0 +1,88 @@
+// 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 __indexing_suites2_to_be_exported_hpp__
+#define __indexing_suites2_to_be_exported_hpp__
+
+#include <vector>
+#include <string>
+#include <map>
+#include <set>
+
+namespace indexing_suites2 {
+
+typedef std::vector< std::string > strings_t;
+
+inline void do_nothing( const strings_t& ){}
+
+struct item_t{
+ item_t() : value( -1 ){}
+ explicit item_t( int v) : value( v ){}
+
+ bool operator==(item_t const& item) const {
+ return value == item.value;
+ }
+
+ bool operator!=(item_t const& item) const {
+ return value != item.value;
+ }
+
+ int value;
+};
+
+
+typedef std::vector<item_t> items_t;
+
+typedef std::vector<item_t*> items_ptr_t;
+inline items_ptr_t create_items_ptr(){
+ items_ptr_t items;
+ items.push_back( new item_t(0) );
+ items.push_back( new item_t(1) );
+ items.push_back( new item_t(2) );
+ items.push_back( new item_t(3) );
+ items.push_back( new item_t(4) );
+ return items;
+}
+
+inline item_t get_value( const std::vector<item_t>& vec, unsigned int index ){
+ return vec.at(index);
+}
+
+inline void set_value( std::vector<item_t>& vec, unsigned int index, item_t value ){
+ vec.at(index);
+ vec[index] = value;
+}
+
+typedef std::vector<float> fvector;
+fvector empty_fvector(){ return fvector(); }
+
+typedef std::map< std::string, std::string > name2value_t;
+inline std::string get_first_name( name2value_t const * names ){
+ if( !names ){
+ return "";
+ }
+ else{
+ return names->begin()->first;
+ }
+}
+
+
+typedef std::multimap< int, int > multimap_ints_t;
+inline multimap_ints_t create_multimap_ints(){
+ return multimap_ints_t();
+}
+
+typedef std::set< std::string > set_strings_t;
+inline set_strings_t create_set_strings(){
+ return set_strings_t();
+}
+
+}
+
+namespace pyplusplus{ namespace aliases{
+ typedef std::vector<indexing_suites2::item_t*> items_ptr_t;
+}}
+
+#endif//__indexing_suites2_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-11-27 19:56:15
|
Revision: 1176
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1176&view=rev
Author: roman_yakovenko
Date: 2007-11-27 11:56:18 -0800 (Tue, 27 Nov 2007)
Log Message:
-----------
adding support for class partial name - name without default template arguments
Modified Paths:
--------------
pygccxml_dev/unittests/bit_fields_tester.py
pygccxml_dev/unittests/decl_string_tester.py
pygccxml_dev/unittests/find_container_traits_tester.py
pygccxml_dev/unittests/variable_matcher_tester.py
Modified: pygccxml_dev/unittests/bit_fields_tester.py
===================================================================
--- pygccxml_dev/unittests/bit_fields_tester.py 2007-11-27 19:55:42 UTC (rev 1175)
+++ pygccxml_dev/unittests/bit_fields_tester.py 2007-11-27 19:56:18 UTC (rev 1176)
@@ -12,16 +12,18 @@
from pygccxml import declarations
class tester_t( parser_test_case.parser_test_case_t ):
+
+ global_ns = None
+
def __init__(self, *args ):
parser_test_case.parser_test_case_t.__init__( self, *args )
self.header = 'bit_fields.hpp'
- self.global_ns = None
def setUp(self):
- if not self.global_ns:
+ if not tester_t.global_ns:
decls = parser.parse( [self.header], self.config )
- self.global_ns = declarations.get_global_namespace( decls )
- self.global_ns.init_optimizer()
+ tester_t.global_ns = declarations.get_global_namespace( decls )
+ tester_t.global_ns.init_optimizer()
def test( self ):
bf_x = self.global_ns.variable( 'x' )
@@ -32,6 +34,9 @@
mv_z = self.global_ns.variable( 'z' )
self.failUnless( mv_z.bits == None )
+
+ def test2( self ):
+ pass
def create_suite():
suite = unittest.TestSuite()
Modified: pygccxml_dev/unittests/decl_string_tester.py
===================================================================
--- pygccxml_dev/unittests/decl_string_tester.py 2007-11-27 19:55:42 UTC (rev 1175)
+++ pygccxml_dev/unittests/decl_string_tester.py 2007-11-27 19:56:18 UTC (rev 1176)
@@ -3,17 +3,19 @@
# 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
-import pygccxml
-from pygccxml.utils import *
-from pygccxml.parser import *
-from pygccxml.declarations import *
+from pygccxml import utils
+from pygccxml import parser
+from pygccxml import declarations
+
class tester_t( parser_test_case.parser_test_case_t ):
- COMPILATION_MODE = COMPILATION_MODE.ALL_AT_ONCE
+ COMPILATION_MODE = parser.COMPILATION_MODE.ALL_AT_ONCE
+ global_ns = None
def __init__(self, *args ):
parser_test_case.parser_test_case_t.__init__( self, *args )
self.header = os.path.join( autoconfig.data_directory, 'declarations_calldef.hpp' )
@@ -23,18 +25,20 @@
void test_generated_decl_string( %s );
"""
+ def setUp(self):
+ if not tester_t.global_ns:
+ decls = parser.parse( [self.header], self.config )
+ tester_t.global_ns = declarations.get_global_namespace( decls )
+ tester_t.global_ns.init_optimizer()
+
def test_member_function(self):
- declarations = parse( [self.header], self.config )
- member_inline_call = find_declaration( declarations, type=member_function_t, name='member_inline_call' )
- self.failUnless( member_inline_call, "unable to find 'member_inline_call' function" )
- decls = parse_string( self.template % member_inline_call.decl_string, self.config )
+ member_inline_call = self.global_ns.mem_fun( 'member_inline_call' )
+ decls = parser.parse_string( self.template % member_inline_call.decl_string, self.config )
self.failUnless( decls, "Created decl_string for member function containes mistake" )
- def test_free_function(self):
- declarations = parse( [self.header], self.config )
- return_default_args = find_declaration( declarations, type=free_function_t, name='return_default_args' )
- self.failUnless( return_default_args, "unable to find 'return_default_args' function" )
- decls = parse_string( self.template % return_default_args.decl_string, self.config )
+ def test_free_function(self):
+ return_default_args = self.global_ns.free_fun( 'return_default_args' )
+ decls = parser.parse_string( self.template % return_default_args.decl_string, self.config )
self.failUnless( decls, "Created decl_string for global function containes mistake" )
def create_suite():
Modified: pygccxml_dev/unittests/find_container_traits_tester.py
===================================================================
--- pygccxml_dev/unittests/find_container_traits_tester.py 2007-11-27 19:55:42 UTC (rev 1175)
+++ pygccxml_dev/unittests/find_container_traits_tester.py 2007-11-27 19:56:18 UTC (rev 1176)
@@ -15,15 +15,15 @@
global_ns = None
def __init__(self, *args ):
parser_test_case.parser_test_case_t.__init__( self, *args )
- self.header = 'remove_template_defaults.hpp'
+ self.headers = [ 'remove_template_defaults.hpp', 'indexing_suites2.hpp' ]
def setUp(self):
if not tester_t.global_ns:
- decls = parser.parse( [self.header], self.config )
+ decls = parser.parse( self.headers, self.config )
tester_t.global_ns = declarations.get_global_namespace( decls )
tester_t.global_ns.init_optimizer()
- def __cmp_traits( self, typedef, expected ):
+ def __cmp_traits( self, typedef, expected, partial_name ):
if isinstance( typedef, str ):
typedef = self.global_ns.typedef( typedef )
traits = declarations.find_container_traits( typedef )
@@ -33,22 +33,29 @@
% ( str(typedef), expected.__name__, traits.__name__ ) )
cls = declarations.remove_declarated( typedef )
self.failUnless( cls.container_traits is expected )
-
- def test_find_traits( self ):
- self.__cmp_traits( 'v_int', declarations.vector_traits )
- self.__cmp_traits( 'l_int', declarations.list_traits )
- self.__cmp_traits( 'd_v_int', declarations.deque_traits )
- self.__cmp_traits( 'q_int', declarations.queue_traits )
- self.__cmp_traits( 'pq_int', declarations.priority_queue_traits)
- self.__cmp_traits( 's_v_int', declarations.set_traits)
- self.__cmp_traits( 'ms_v_int', declarations.multiset_traits)
- self.__cmp_traits( 'm_i2d', declarations.map_traits )
- self.__cmp_traits( 'mm_i2d', declarations.multimap_traits )
- self.__cmp_traits( 'hs_v_int', declarations.hash_set_traits )
- self.__cmp_traits( 'mhs_v_int', declarations.hash_multiset_traits )
- self.__cmp_traits( 'hm_i2d', declarations.hash_map_traits )
- self.__cmp_traits( 'hmm_i2d', declarations.hash_multimap_traits )
+ self.failUnless( cls.partial_name == partial_name )
+ def test_find_traits( self ):
+ self.__cmp_traits( 'v_int', declarations.vector_traits, "vector< int >" )
+ self.__cmp_traits( 'l_int', declarations.list_traits, "list< int >" )
+ self.__cmp_traits( 'd_v_int', declarations.deque_traits, "deque< std::vector< int > >" )
+ self.__cmp_traits( 'q_int', declarations.queue_traits, "queue< int >" )
+ self.__cmp_traits( 'pq_int', declarations.priority_queue_traits, "priority_queue< int >")
+ self.__cmp_traits( 's_v_int', declarations.set_traits, "set< std::vector< int > >")
+ self.__cmp_traits( 'ms_v_int', declarations.multiset_traits, "multiset< std::vector< int > >")
+ self.__cmp_traits( 'm_i2d', declarations.map_traits, "map< int, double >" )
+ self.__cmp_traits( 'mm_i2d', declarations.multimap_traits, "multimap< int, double >" )
+ self.__cmp_traits( 'hs_v_int', declarations.hash_set_traits, "hash_set< std::vector< int > >" )
+ self.__cmp_traits( 'mhs_v_int', declarations.hash_multiset_traits, "hash_multiset< std::vector< int > >" )
+ self.__cmp_traits( 'hm_i2d', declarations.hash_map_traits, "hash_map< int, double >" )
+ self.__cmp_traits( 'hmm_i2d', declarations.hash_multimap_traits, "hash_multimap< int, double >" )
+
+ def test_multimap( self ):
+ mm = self.global_ns.classes( lambda decl: decl.name.startswith( 'multimap' ) )
+ for m in mm:
+ traits = declarations.find_container_traits( m )
+ print m.partial_name
+
def create_suite():
suite = unittest.TestSuite()
suite.addTest( unittest.makeSuite(tester_t))
Modified: pygccxml_dev/unittests/variable_matcher_tester.py
===================================================================
--- pygccxml_dev/unittests/variable_matcher_tester.py 2007-11-27 19:55:42 UTC (rev 1175)
+++ pygccxml_dev/unittests/variable_matcher_tester.py 2007-11-27 19:56:18 UTC (rev 1176)
@@ -12,8 +12,9 @@
from pygccxml import parser
from pygccxml import declarations
-class tester_t( parser_test_case.parser_test_case_t ):
+class tester_1_t( parser_test_case.parser_test_case_t ):
COMPILATION_MODE = parser.COMPILATION_MODE.ALL_AT_ONCE
+ declarations = None
def __init__(self, *args ):
parser_test_case.parser_test_case_t.__init__( self, *args )
self.header = 'bit_fields.hpp'
@@ -40,9 +41,29 @@
self.failUnless( 'public' == x.access_type )
+class tester_2_t( parser_test_case.parser_test_case_t ):
+ COMPILATION_MODE = parser.COMPILATION_MODE.ALL_AT_ONCE
+ global_ns = None
+ def __init__(self, *args ):
+ parser_test_case.parser_test_case_t.__init__( self, *args )
+ self.header = 'vector_traits.hpp'
+ self.global_ns = None
+
+ def setUp(self):
+ if not self.global_ns:
+ self.global_ns = declarations.get_global_namespace( parser.parse( [self.header], self.config ) )
+
+ def test_no_defaults( self ):
+ vectors = self.global_ns.decls( lambda decl: 'vector<' in decl.name )
+ self.global_ns.decl( 'vector< _0_ >' )
+ self.global_ns.class_( 'vector< std::vector< int > >' )
+ self.global_ns.class_( 'vector< std::string >' )
+ self.global_ns.decl( 'vector< const int >' )
+
def create_suite():
suite = unittest.TestSuite()
- suite.addTest( unittest.makeSuite(tester_t))
+ suite.addTest( unittest.makeSuite(tester_1_t))
+ suite.addTest( unittest.makeSuite(tester_2_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...> - 2007-11-27 19:55:37
|
Revision: 1175
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1175&view=rev
Author: roman_yakovenko
Date: 2007-11-27 11:55:42 -0800 (Tue, 27 Nov 2007)
Log Message:
-----------
adding support for class partial name - name without default template arguments
Modified Paths:
--------------
pygccxml_dev/pygccxml/declarations/algorithm.py
pygccxml_dev/pygccxml/declarations/algorithms_cache.py
pygccxml_dev/pygccxml/declarations/calldef.py
pygccxml_dev/pygccxml/declarations/class_declaration.py
pygccxml_dev/pygccxml/declarations/container_traits.py
pygccxml_dev/pygccxml/declarations/cpptypes.py
pygccxml_dev/pygccxml/declarations/declaration.py
pygccxml_dev/pygccxml/declarations/matchers.py
Modified: pygccxml_dev/pygccxml/declarations/algorithm.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/algorithm.py 2007-11-26 11:32:03 UTC (rev 1174)
+++ pygccxml_dev/pygccxml/declarations/algorithm.py 2007-11-27 19:55:42 UTC (rev 1175)
@@ -7,7 +7,7 @@
import types
-def declaration_path( decl ):
+def declaration_path( decl, with_defaults=True ):
"""
returns a list of parent declarations names
@@ -17,9 +17,6 @@
@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:
@@ -39,6 +36,40 @@
else:
return decl.cache.declaration_path
+def partial_declaration_path( decl ):
+ """
+ returns a list of parent declarations names without template arguments that
+ have default value
+
+ @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
+ contains decl name
+ """
+ #TODO:
+ #If parent declaration cache already has declaration_path, reuse it for
+ #calculation.
+ if not decl:
+ return []
+ if not decl.cache.partial_declaration_path:
+ result = [ decl.partial_name ]
+ parent = decl.parent
+ while parent:
+ if parent.cache.partial_declaration_path:
+ result.reverse()
+ decl.cache.partial_declaration_path \
+ = parent.cache.partial_declaration_path + result
+ return decl.cache.partial_declaration_path
+ else:
+ result.append( parent.partial_name )
+ parent = parent.parent
+ result.reverse()
+ decl.cache.partial_declaration_path = result
+ return result
+ else:
+ return decl.cache.partial_declaration_path
+
def full_name_from_declaration_path( dpath ):
##Here I have lack of knowledge:
##TODO: "What is the full name of declaration declared in unnamed namespace?"
@@ -46,7 +77,7 @@
result = result[0] + '::'.join( result[1:] )
return result
-def full_name( decl ):
+def full_name( decl, with_defaults=True ):
"""
returns full name of the declaration
@param decl: declaration for which full name should be calculated. If decl
@@ -58,10 +89,16 @@
"""
if None is decl:
raise RuntimeError( "Unable to generate full name for None object!" )
- if not decl.cache.full_name:
- decl.cache.full_name = full_name_from_declaration_path( declaration_path( decl ) )
- return decl.cache.full_name
-
+ if with_defaults:
+ if not decl.cache.full_name:
+ decl.cache.full_name = full_name_from_declaration_path( declaration_path( decl ) )
+ return decl.cache.full_name
+ else:
+ if not decl.cache.full_partial_name:
+ decl.cache.full_partial_name \
+ = full_name_from_declaration_path( partial_declaration_path( decl ) )
+ return decl.cache.full_partial_name
+
def make_flatten( decl_or_decls ):
"""
converts tree representation of declarations to flatten one.
Modified: pygccxml_dev/pygccxml/declarations/algorithms_cache.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/algorithms_cache.py 2007-11-26 11:32:03 UTC (rev 1174)
+++ pygccxml_dev/pygccxml/declarations/algorithms_cache.py 2007-11-27 19:55:42 UTC (rev 1175)
@@ -13,9 +13,11 @@
object.__init__( self )
self._enabled = True
self._full_name = None
+ self._full_partial_name = None
self._access_type = None
self._demangled_name = None
self._declaration_path = None
+ self._partial_declaration_path = None
def disable( self ):
self._enabled = False
@@ -37,6 +39,16 @@
full_name = property( _get_full_name, _set_full_name )
+ def _get_full_partial_name( self ):
+ return self._full_partial_name
+
+ def _set_full_partial_name( self, fname ):
+ if not self.enabled:
+ fname = None
+ self._full_partial_name = fname
+
+ full_partial_name = property( _get_full_partial_name, _set_full_partial_name )
+
def _get_access_type( self ):
return self._access_type
@@ -44,7 +56,6 @@
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 ):
@@ -64,19 +75,34 @@
if not self.enabled:
declaration_path = None
self._declaration_path = declaration_path
-
+
declaration_path = property( _get_declaration_path, _set_declaration_path )
+ def _get_partial_declaration_path( self ):
+ return self._partial_declaration_path
+
+ def _set_partial_declaration_path( self, partial_declaration_path ):
+ if not self.enabled:
+ partial_declaration_path = None
+ self._partial_declaration_path = partial_declaration_path
+
+ partial_declaration_path = property( _get_partial_declaration_path
+ , _set_partial_declaration_path )
+
def reset( self ):
self.full_name = None
+ self.full_partial_name = None
self.access_type = None
self.demangled_name = None
self.declaration_path = None
+ self.partial_declaration_path = None
def reset_name_based( self ):
self.full_name = None
+ self.full_partial_name = None
self.demangled_name = None
self.declaration_path = None
+ self.partial_declaration_path = None
def reset_access_type( self ):
self.access_type = None
Modified: pygccxml_dev/pygccxml/declarations/calldef.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/calldef.py 2007-11-26 11:32:03 UTC (rev 1174)
+++ pygccxml_dev/pygccxml/declarations/calldef.py 2007-11-27 19:55:42 UTC (rev 1175)
@@ -391,10 +391,13 @@
, arguments_types=[ arg.type for arg in self.arguments ]
, has_const=self.has_const )
- def _create_decl_string(self):
- return self.function_type().decl_string
+ def create_decl_string(self, with_defaults=True):
+ f_type = self.function_type()
+ if with_defaults:
+ return f_type.decl_string
+ else:
+ return f_type.partial_decl_string
-
class free_calldef_t( calldef_t ):
"""base class for "callable" declarations that defined within C++ namespace"""
def __init__( self, *args, **keywords ):
@@ -430,9 +433,14 @@
return cpptypes.free_function_type_t( return_type=self.return_type
, arguments_types=[ arg.type for arg in self.arguments ] )
- def _create_decl_string(self):
- return self.function_type().decl_string
+ def create_decl_string(self, with_defaults=True):
+ f_type = self.function_type()
+ if with_defaults:
+ return f_type.decl_string
+ else:
+ return f_type.partial_decl_string
+
class operator_t(object):
"""base class for "operator" declarations"""
OPERATOR_WORD_LEN = len( 'operator' )
Modified: pygccxml_dev/pygccxml/declarations/class_declaration.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/class_declaration.py 2007-11-26 11:32:03 UTC (rev 1174)
+++ pygccxml_dev/pygccxml/declarations/class_declaration.py 2007-11-27 19:55:42 UTC (rev 1175)
@@ -107,6 +107,11 @@
self._container_traits = container_traits.find_container_traits( self )
return self._container_traits
+ def _get_partial_name_impl( self ):
+ if not self.container_traits:
+ return self.name
+ return self.container_traits.remove_defaults( self )
+
class class_t( scopedef.scopedef_t ):
"""describes class definition"""
@@ -406,5 +411,10 @@
return trivial[0]
else:
return None
-
+
+ def _get_partial_name_impl( self ):
+ if not self.container_traits:
+ return self.name
+ return self.container_traits.remove_defaults( self )
+
class_types = ( class_t, class_declaration_t )
Modified: pygccxml_dev/pygccxml/declarations/container_traits.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/container_traits.py 2007-11-26 11:32:03 UTC (rev 1174)
+++ pygccxml_dev/pygccxml/declarations/container_traits.py 2007-11-27 19:55:42 UTC (rev 1175)
@@ -145,18 +145,20 @@
return
key_type = c_args[0]
mapped_type = c_args[1]
- tmpl = string.Template( "$container< $key_type, $mapped_type, $compare<$key_type>, $allocator< std::pair< const $key_type, $mapped_type> > >" )
- if key_type.startswith( 'const ' ) or key_type.endswith( ' const' ):
- tmpl = string.Template( "$container< $key_type, $mapped_type, $compare<$key_type>, $allocator< std::pair< $key_type, $mapped_type> > >" )
- tmpl = tmpl.substitute( container=c_name
- , key_type=key_type
- , mapped_type=mapped_type
- , compare=default_compare
- , allocator=default_allocator )
- if defaults_eraser.normalize( cls_name ) == defaults_eraser.normalize( tmpl ):
- return templates.join( c_name
- , [ defaults_eraser.erase_recursive( key_type )
- , defaults_eraser.erase_recursive( mapped_type )] )
+ tmpls = [
+ string.Template( "$container< $key_type, $mapped_type, $compare<$key_type>, $allocator< std::pair< const $key_type, $mapped_type> > >" )
+ , string.Template( "$container< $key_type, $mapped_type, $compare<$key_type>, $allocator< std::pair< $key_type const, $mapped_type> > >" )
+ , string.Template( "$container< $key_type, $mapped_type, $compare<$key_type>, $allocator< std::pair< $key_type, $mapped_type> > >" )]
+ for tmpl in tmpls:
+ tmpl = tmpl.substitute( container=c_name
+ , key_type=key_type
+ , mapped_type=mapped_type
+ , compare=default_compare
+ , allocator=default_allocator )
+ if defaults_eraser.normalize( cls_name ) == defaults_eraser.normalize( tmpl ):
+ return templates.join( c_name
+ , [ defaults_eraser.erase_recursive( key_type )
+ , defaults_eraser.erase_recursive( mapped_type )] )
@staticmethod
Modified: pygccxml_dev/pygccxml/declarations/cpptypes.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/cpptypes.py 2007-11-26 11:32:03 UTC (rev 1174)
+++ pygccxml_dev/pygccxml/declarations/cpptypes.py 2007-11-27 19:55:42 UTC (rev 1175)
@@ -34,12 +34,16 @@
return self.__class__.__name__ < other.__class__.__name__
return self.decl_string < other.decl_string
- def _create_decl_string(self):
+ def build_decl_string(self, with_defaults=True):
raise NotImplementedError()
- def _get_decl_string( self ):
- return self._create_decl_string()
- decl_string = property( _get_decl_string )
+ @property
+ def decl_string( self ):
+ return self.build_decl_string()
+
+ @property
+ def partial_decl_string( self ):
+ return self.build_decl_string( False )
def _clone_impl( self ):
raise NotImplementedError()
@@ -63,7 +67,7 @@
type_t.__init__( self )
self._decl_string = decl_string
- def _create_decl_string(self):
+ def build_decl_string(self, with_defaults=True):
return self._decl_string
def _clone_impl( self ):
@@ -74,7 +78,7 @@
def __init__( self ):
type_t.__init__( self )
- def _create_decl_string(self):
+ def build_decl_string(self, with_defaults=True):
return '?unknown?'
def _clone_impl( self ):
@@ -89,7 +93,7 @@
type_t.__init__( self )
self._name = name
- def _create_decl_string(self):
+ def build_decl_string(self, with_defaults=True):
return self._name
def _clone_impl( self ):
@@ -336,8 +340,8 @@
def __init__( self, base ):
compound_t.__init__( self, base)
- def _create_decl_string(self):
- return 'volatile ' + self.base.decl_string
+ def build_decl_string(self, with_defaults=True):
+ return 'volatile ' + self.base.build_decl_string(with_defaults)
def _clone_impl( self ):
return volatile_t( self.base.clone() )
@@ -357,8 +361,8 @@
def __init__( self, base ):
compound_t.__init__( self, base)
- def _create_decl_string(self):
- return '__restrict__ ' + self.base.decl_string
+ def build_decl_string(self, with_defaults=True):
+ return '__restrict__ ' + self.base.build_decl_string( with_defaults )
def _clone_impl( self ):
return restrict_t( self.base.clone() )
@@ -368,8 +372,8 @@
def __init__( self, base ):
compound_t.__init__( self, base )
- def _create_decl_string(self):
- return self.base.decl_string + ' const'
+ def build_decl_string(self, with_defaults=True):
+ return self.base.build_decl_string(with_defaults) + ' const'
def _clone_impl( self ):
return const_t( self.base.clone() )
@@ -379,8 +383,8 @@
def __init__( self, base ):
compound_t.__init__( self, base )
- def _create_decl_string(self):
- return self.base.decl_string + ' *'
+ def build_decl_string(self, with_defaults=True):
+ return self.base.build_decl_string( with_defaults ) + ' *'
def _clone_impl( self ):
return pointer_t( self.base.clone() )
@@ -390,8 +394,8 @@
def __init__( self, base ):
compound_t.__init__( self, base)
- def _create_decl_string(self):
- return self.base.decl_string + ' &'
+ def build_decl_string(self, with_defaults=True):
+ return self.base.build_decl_string(with_defaults) + ' &'
def _clone_impl( self ):
return reference_t( self.base.clone() )
@@ -411,8 +415,8 @@
size = property( _get_size, _set_size,
doc="returns array size" )
- def _create_decl_string(self):
- return self.base.decl_string + '[%d]' % self.size
+ def build_decl_string(self, with_defaults=True):
+ return self.base.build_decl_string(with_defaults) + '[%d]' % self.size
def _clone_impl( self ):
return array_t( self.base.clone(), self.size )
@@ -449,7 +453,7 @@
calldef_type_t.__init__( self, return_type, arguments_types )
@staticmethod
- def create_decl_string( return_type, arguments_types ):
+ def create_decl_string( return_type, arguments_types, with_defaults=True ):
"""
returns free function type
@@ -461,11 +465,12 @@
@return: L{free_function_type_t}
"""
return free_function_type_t.NAME_TEMPLATE % {
- 'return_type' : return_type.decl_string
- , 'arguments' : ','.join( map( lambda x: x.decl_string, arguments_types ) ) }
+ 'return_type' : return_type.build_decl_string( with_defaults )
+ , 'arguments' : ','.join( map( lambda x: x.build_decl_string( with_defaults )
+ , arguments_types ) ) }
- def _create_decl_string(self):
- return self.create_decl_string( self.return_type, self.arguments_types )
+ def build_decl_string(self, with_defaults=True):
+ return self.create_decl_string( self.return_type, self.arguments_types, with_defaults )
def _clone_impl( self ):
rt_clone = None
@@ -475,7 +480,7 @@
, [ arg.clone() for arg in self.arguments_types ] )
#TODO: create real typedef
- def create_typedef( self, typedef_name, unused=None):
+ def create_typedef( self, typedef_name, unused=None, with_defaults=True):
"""returns string, that contains valid C++ code, that defines typedef to function type
@param name: the desired name of typedef
@@ -483,8 +488,9 @@
#unused argument simplifies user code
return free_function_type_t.TYPEDEF_NAME_TEMPLATE % {
'typedef_name' : typedef_name
- , 'return_type' : self.return_type.decl_string
- , 'arguments' : ','.join( map( lambda x: x.decl_string, self.arguments_types ) ) }
+ , 'return_type' : self.return_type.build_decl_string( with_defaults )
+ , 'arguments' : ','.join( map( lambda x: x.build_decl_string( with_defaults )
+ , self.arguments_types ) ) }
class member_function_type_t( type_t, calldef_type_t ):
"""describes member function type"""
@@ -512,7 +518,7 @@
,doc="reference to parent L{class<declaration_t>}" )
#TODO: create real typedef
- def create_typedef( self, typedef_name, class_alias=None):
+ def create_typedef( self, typedef_name, class_alias=None, with_defaults=True):
"""creates typedef to the function type
@param typedef_name: desired type name
@@ -522,40 +528,46 @@
if self.has_const:
has_const_str = 'const'
if None is class_alias:
- class_alias = self.class_inst.decl_string
+ if with_defaults:
+ class_alias = self.class_inst.decl_string
+ else:
+ class_alias = self.class_inst.partial_decl_string
return member_function_type_t.TYPEDEF_NAME_TEMPLATE % {
'typedef_name' : typedef_name
- , 'return_type' : self.return_type.decl_string
+ , 'return_type' : self.return_type.build_decl_string( with_defaults )
, 'class' : class_alias
- , 'arguments' : ','.join( map( lambda x: x.decl_string, self.arguments_types ) )
+ , 'arguments' : ','.join( map( lambda x: x.build_decl_string(with_defaults)
+ , self.arguments_types ) )
, 'has_const' : has_const_str }
def create(self):
- return self.create_decl_string( self.return_type
+ return self.build_decl_string( self.return_type
, self.class_inst.decl_string
, self.arguments_types
, self.has_const )
@staticmethod
- def create_decl_string(return_type, class_decl_string, arguments_types, has_const):
+ def create_decl_string(return_type, class_decl_string, arguments_types, has_const, with_defaults=True):
has_const_str = ''
if has_const:
has_const_str = 'const'
return_type_decl_string = ''
if return_type:
- return_type_decl_string = return_type.decl_string
+ return_type_decl_string = return_type.build_decl_string( with_defaults )
return member_function_type_t.NAME_TEMPLATE % {
'return_type' : return_type_decl_string
, 'class' : class_decl_string
- , 'arguments' : ','.join( map( lambda x: x.decl_string, arguments_types ) )
+ , 'arguments' : ','.join( map( lambda x: x.build_decl_string(with_defaults)
+ , arguments_types ) )
, 'has_const' : has_const_str }
- def _create_decl_string(self):
+ def build_decl_string(self, with_defaults=True):
return self.create_decl_string( self.return_type
, self.class_inst.decl_string
, self.arguments_types
- , self.has_const )
+ , self.has_const
+ , with_defaults)
def _clone_impl( self ):
rt_clone = None
@@ -582,8 +594,9 @@
variable_type = property( _get_variable_type, _set_variable_type
, doc="describes member variable L{type<type_t>}")
- def _create_decl_string(self):
- return self.NAME_TEMPLATE % { 'type' : self.variable_type.decl_string, 'class' : self.base.decl_string }
+ def build_decl_string(self, with_defaults=True):
+ return self.NAME_TEMPLATE % { 'type' : self.variable_type.build_decl_string(with_defaults)
+ , 'class' : self.base.build_decl_string(with_defaults) }
def _clone_impl( self ):
return member_variable_type_t( class_inst=self.base
@@ -606,8 +619,11 @@
declaration = property( _get_declaration, _set_declaration
, doc="reference to L{declaration<declaration_t>}")
- def _create_decl_string(self):
- return self._declaration.decl_string
+ def build_decl_string(self, with_defaults=True):
+ if with_defaults:
+ return self._declaration.decl_string
+ else:
+ return self._declaration.partial_decl_string
def _clone_impl( self ):
return declarated_t( self._declaration )
Modified: pygccxml_dev/pygccxml/declarations/declaration.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/declaration.py 2007-11-26 11:32:03 UTC (rev 1174)
+++ pygccxml_dev/pygccxml/declarations/declaration.py 2007-11-27 19:55:42 UTC (rev 1175)
@@ -67,6 +67,7 @@
self._parent = None
self._cache = algorithms_cache.declaration_algs_cache_t()
self._compiler = None
+ self._partial_name = None
def __str__(self):
"""Default __str__ method.
@@ -150,6 +151,7 @@
def _set_name( self, new_name ):
previous_name = self._name
self._name = new_name
+ self._partial_name = None
self.cache.reset_name_based()
if previous_name: #the was a rename and not initial "set"
self._on_rename()
@@ -159,6 +161,17 @@
@type: str
""")
+ def _get_partial_name_impl( self ):
+ return self.name
+
+ @property
+ def partial_name( self ):
+ """declaration name, without template default arguments
+ Right now std containers is the only classes that support this functionality"""
+ if None is self._partial_name:
+ self._partial_name = self._get_partial_name_impl()
+ return self._partial_name
+
def _get_parent(self):
return self._parent
def _set_parent(self, new_parent):
@@ -229,17 +242,20 @@
@type: str
""" )
+ def create_decl_string(self, with_defaults=True):
+ return algorithm.full_name( self, with_defaults )
- def _create_decl_string(self):
- return algorithm.full_name( self )
+ @property
+ def decl_string(self):
+ """declaration full name"""
+ return self.create_decl_string()
- def _decl_string(self):
- return self._create_decl_string()
- decl_string = property( _decl_string,
- doc="""Full name of the declaration
- @type: str
- """ )
@property
+ def partial_decl_string(self):
+ """declaration full name"""
+ return self.create_decl_string(with_defaults=False)
+
+ @property
def cache( self ):
"""implementation details
Modified: pygccxml_dev/pygccxml/declarations/matchers.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/matchers.py 2007-11-26 11:32:03 UTC (rev 1174)
+++ pygccxml_dev/pygccxml/declarations/matchers.py 2007-11-27 19:55:42 UTC (rev 1175)
@@ -223,20 +223,21 @@
def check_name( self, decl ):
assert not None is self.name
-
if self.__opt_is_tmpl_inst:
if not self.__opt_is_full_name:
- if self.name != decl.name:
+ if self.name != decl.name and self.name != decl.partial_name:
return False
else:
- if self.name != algorithm.full_name( decl ):
+ if self.name != algorithm.full_name( decl, with_defaults=True ) \
+ and self.name != algorithm.full_name( decl, with_defaults=False ):
return False
else:
if not self.__opt_is_full_name:
- if decl.name != self.name:
+ if self.name != decl.name and self.name != decl.partial_name:
return False
else:
- if self.name != algorithm.full_name( decl ):
+ if self.name != algorithm.full_name( decl, with_defaults=True ) \
+ and self.name != algorithm.full_name( decl, with_defaults=False ):
return False
return True
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-11-26 11:32:02
|
Revision: 1174
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1174&view=rev
Author: roman_yakovenko
Date: 2007-11-26 03:32:03 -0800 (Mon, 26 Nov 2007)
Log Message:
-----------
adding new test case for "has_public_destructor"
Modified Paths:
--------------
pygccxml_dev/unittests/data/type_traits.hpp
Modified: pygccxml_dev/unittests/data/type_traits.hpp
===================================================================
--- pygccxml_dev/unittests/data/type_traits.hpp 2007-11-25 18:30:15 UTC (rev 1173)
+++ pygccxml_dev/unittests/data/type_traits.hpp 2007-11-26 11:32:03 UTC (rev 1174)
@@ -545,6 +545,8 @@
struct x{
x(){}
};
+
+ struct z{int i;};
}
namespace no{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-11-25 18:30:11
|
Revision: 1173
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1173&view=rev
Author: roman_yakovenko
Date: 2007-11-25 10:30:15 -0800 (Sun, 25 Nov 2007)
Log Message:
-----------
removing useless "if"
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/utils/__init__.py
Modified: pyplusplus_dev/pyplusplus/utils/__init__.py
===================================================================
--- pyplusplus_dev/pyplusplus/utils/__init__.py 2007-11-24 20:14:20 UTC (rev 1172)
+++ pyplusplus_dev/pyplusplus/utils/__init__.py 2007-11-25 18:30:15 UTC (rev 1173)
@@ -78,9 +78,7 @@
return str( decl.location.as_tuple() )
elif isinstance( decl, declarations.namespace_t ):
return '' #I don't really care about unnamed namespaces
- elif isinstance( decl, declarations.enumeration_t ):
- return str( decl.values )
- else: #it could be unname struct\class but location should exist
+ else: #this should nevere happen
raise RuntimeError( "Unable to create normalized name for declaration: " + str(decl))
def __init_from_str( self, row ):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-11-24 20:14:24
|
Revision: 1172
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1172&view=rev
Author: roman_yakovenko
Date: 2007-11-24 12:14:20 -0800 (Sat, 24 Nov 2007)
Log Message:
-----------
adding treatment to unnamed declarations
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/utils/__init__.py
pyplusplus_dev/unittests/exposed_decls_db_tester.py
Modified: pyplusplus_dev/pyplusplus/utils/__init__.py
===================================================================
--- pyplusplus_dev/pyplusplus/utils/__init__.py 2007-11-22 21:56:26 UTC (rev 1171)
+++ pyplusplus_dev/pyplusplus/utils/__init__.py 2007-11-24 20:14:20 UTC (rev 1172)
@@ -74,8 +74,14 @@
def find_out_normalized_name( self, decl ):
if decl.name:
return decl.name
- else:#unnamed enums, classes, unions
+ elif decl.location:#unnamed enums, classes, unions
return str( decl.location.as_tuple() )
+ elif isinstance( decl, declarations.namespace_t ):
+ return '' #I don't really care about unnamed namespaces
+ elif isinstance( decl, declarations.enumeration_t ):
+ return str( decl.values )
+ else: #it could be unname struct\class but location should exist
+ raise RuntimeError( "Unable to create normalized name for declaration: " + str(decl))
def __init_from_str( self, row ):
self.exposed_sign, self.key, self.normalized_name, self.signature \
Modified: pyplusplus_dev/unittests/exposed_decls_db_tester.py
===================================================================
--- pyplusplus_dev/unittests/exposed_decls_db_tester.py 2007-11-22 21:56:26 UTC (rev 1171)
+++ pyplusplus_dev/unittests/exposed_decls_db_tester.py 2007-11-24 20:14:20 UTC (rev 1172)
@@ -37,6 +37,20 @@
int fff();
int i;
}
+
+ struct yyy{
+ struct{ int i;};
+ };
+
+ struct zzz{
+ union{
+ int x; float y;
+ };
+ };
+
+ namespace{
+ int xxxx;
+ }
"""
def __init__(self, *args ):
unittest.TestCase.__init__(self, *args)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-11-22 21:56:21
|
Revision: 1171
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1171&view=rev
Author: roman_yakovenko
Date: 2007-11-22 13:56:26 -0800 (Thu, 22 Nov 2007)
Log Message:
-----------
adding new better(user supplied) unittest for copy constructor related type traits
Added Paths:
-----------
pygccxml_dev/unittests/copy_constructor_tester.py
pygccxml_dev/unittests/data/ogre1.4.xml.bz2
Added: pygccxml_dev/unittests/copy_constructor_tester.py
===================================================================
--- pygccxml_dev/unittests/copy_constructor_tester.py (rev 0)
+++ pygccxml_dev/unittests/copy_constructor_tester.py 2007-11-22 21:56:26 UTC (rev 1171)
@@ -0,0 +1,46 @@
+# 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 unittest
+import autoconfig
+import parser_test_case
+
+from pygccxml import utils
+from pygccxml import parser
+from pygccxml import declarations
+
+class tester_t( parser_test_case.parser_test_case_t ):
+ def __init__(self, *args ):
+ parser_test_case.parser_test_case_t.__init__( self, *args )
+ self.global_ns = None
+
+ def setUp(self):
+ if not self.global_ns:
+ xml_file = os.path.join( autoconfig.data_directory, 'ogre1.4.xml' )
+ reader = parser.source_reader_t( autoconfig.cxx_parsers_cfg.gccxml )
+ self.global_ns = declarations.get_global_namespace( reader.read_xml_file(xml_file) )
+ self.global_ns.init_optimizer()
+
+ def test( self ):
+ for x in self.global_ns.typedefs( 'SettingsMultiMap' ):
+ self.failUnless( not declarations.is_noncopyable( x ) )
+
+ for x in self.global_ns.typedefs( 'SettingsIterator' ):
+ self.failUnless( not declarations.is_noncopyable( x ) )
+
+ for x in self.global_ns.typedefs( 'SectionIterator' ):
+ self.failUnless( not declarations.is_noncopyable( x ) )
+
+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: pygccxml_dev/unittests/data/ogre1.4.xml.bz2
===================================================================
(Binary files differ)
Property changes on: pygccxml_dev/unittests/data/ogre1.4.xml.bz2
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-11-22 21:52:41
|
Revision: 1170
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1170&view=rev
Author: roman_yakovenko
Date: 2007-11-22 13:52:44 -0800 (Thu, 22 Nov 2007)
Log Message:
-----------
rename has_trivial_copy with has_copy_constructor to better reflect what function does
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/code_creators/member_variable.py
pyplusplus_dev/pyplusplus/module_creator/call_policies_resolver.py
pyplusplus_dev/pyplusplus/module_creator/creator.py
Modified: pyplusplus_dev/pyplusplus/code_creators/member_variable.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/member_variable.py 2007-11-22 21:51:07 UTC (rev 1169)
+++ pyplusplus_dev/pyplusplus/code_creators/member_variable.py 2007-11-22 21:52:44 UTC (rev 1170)
@@ -621,7 +621,7 @@
return False
if declarations.has_destructor( decl ) and not declarations.has_public_destructor( decl ):
return False
- if not declarations.has_trivial_copy(decl):
+ if not declarations.has_copy_constructor(decl):
return False
return True
has_setter = property( _get_has_setter )
Modified: pyplusplus_dev/pyplusplus/module_creator/call_policies_resolver.py
===================================================================
--- pyplusplus_dev/pyplusplus/module_creator/call_policies_resolver.py 2007-11-22 21:51:07 UTC (rev 1169)
+++ pyplusplus_dev/pyplusplus/module_creator/call_policies_resolver.py 2007-11-22 21:52:44 UTC (rev 1170)
@@ -161,7 +161,7 @@
return None
if declarations.has_destructor( decl ) and not declarations.has_public_destructor( decl ):
return None
- if not declarations.has_trivial_copy(decl):
+ if not declarations.has_copy_constructor(decl):
return None
if hint == 'get':
#if we rich this line, it means that we are able to create an obect using
Modified: pyplusplus_dev/pyplusplus/module_creator/creator.py
===================================================================
--- pyplusplus_dev/pyplusplus/module_creator/creator.py 2007-11-22 21:51:07 UTC (rev 1169)
+++ pyplusplus_dev/pyplusplus/module_creator/creator.py 2007-11-22 21:52:44 UTC (rev 1170)
@@ -572,7 +572,7 @@
if '0.9' in self.curr_decl.compiler:
copy_constr = self.curr_decl.find_copy_constructor()
add_to_wrapper = False
- if declarations.has_trivial_copy( self.curr_decl ):
+ if declarations.has_copy_constructor( self.curr_decl ):
#find out whether user or compiler defined it
if self.curr_decl.noncopyable:
add_to_wrapper = False
@@ -594,7 +594,7 @@
tcons = code_creators.null_constructor_wrapper_t( class_=self.curr_decl )
wrapper.adopt_creator( tcons )
else:
- if declarations.has_trivial_copy( self.curr_decl ):
+ if declarations.has_copy_constructor( self.curr_decl ):
copy_constr = self.curr_decl.find_copy_constructor()
if not self.curr_decl.noncopyable and copy_constr.is_artificial:
cccc = code_creators.copy_constructor_wrapper_t( class_=self.curr_decl)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-11-22 21:51:02
|
Revision: 1169
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1169&view=rev
Author: roman_yakovenko
Date: 2007-11-22 13:51:07 -0800 (Thu, 22 Nov 2007)
Log Message:
-----------
rename has_trivial_copy with has_copy_constructor to better reflect what function does
Modified Paths:
--------------
pygccxml_dev/pygccxml/declarations/__init__.py
pygccxml_dev/pygccxml/declarations/type_traits.py
pygccxml_dev/pygccxml/parser/scanner.py
pygccxml_dev/unittests/data/core_cache.hpp
pygccxml_dev/unittests/data/type_traits.hpp
pygccxml_dev/unittests/test_all.py
pygccxml_dev/unittests/type_traits_tester.py
Modified: pygccxml_dev/pygccxml/declarations/__init__.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/__init__.py 2007-11-22 21:49:28 UTC (rev 1168)
+++ pygccxml_dev/pygccxml/declarations/__init__.py 2007-11-22 21:51:07 UTC (rev 1169)
@@ -156,7 +156,8 @@
from type_traits import has_destructor
from type_traits import has_public_less
-from type_traits import has_trivial_copy
+from type_traits import has_copy_constructor
+has_trivial_copy = has_copy_constructor #backward comp mode will be removed
from type_traits import has_public_equal
from type_traits import has_public_assign
from type_traits import has_public_destructor
Modified: pygccxml_dev/pygccxml/declarations/type_traits.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/type_traits.py 2007-11-22 21:49:28 UTC (rev 1168)
+++ pygccxml_dev/pygccxml/declarations/type_traits.py 2007-11-22 21:51:07 UTC (rev 1169)
@@ -406,25 +406,25 @@
to the term assignment operator.
"""
-def has_trivial_copy( type):
+def has_copy_constructor( class_ ):
"""returns True, if class has public copy constructor, False otherwise"""
- assert isinstance( type, class_declaration.class_t )
- if '0.9' in type.compiler:
- copy_ = type.find_copy_constructor()
+ class_ = class_traits.get_declaration( class_ )
+ if '0.9' in class_.compiler:
+ copy_ = class_.find_copy_constructor()
if copy_:
if copy_.access_type == 'public':
return True
else:
return False
else:
- if type.constructors( recursive=False, allow_empty=True ):
+ if __contains_noncopyable_mem_var( class_ ):
return False
else:
return True
else:
constructors = filter( lambda x: isinstance( x, calldef.constructor_t ) \
and x.is_copy_constructor
- , type.public_members )
+ , class_.public_members )
return bool( constructors )
def has_destructor(type):
@@ -691,7 +691,7 @@
return True
if isinstance( target, cpptypes.declarated_t ):
assert isinstance( target.declaration, class_declaration.class_t )
- if has_trivial_copy( target.declaration ):
+ if has_copy_constructor( target.declaration ):
return True #we have copy constructor
return False
@@ -704,7 +704,7 @@
return True
if isinstance( target, cpptypes.declarated_t ):
assert isinstance( target.declaration, class_declaration.class_t )
- if has_trivial_copy( target.declaration ):
+ if has_copy_constructor( target.declaration ):
return True #we have copy constructor
return False
@@ -717,7 +717,7 @@
return True
if isinstance( target, cpptypes.declarated_t ):
assert isinstance( target.declaration, class_declaration.class_t )
- if has_trivial_copy( target.declaration ):
+ if has_copy_constructor( target.declaration ):
return True #we have copy constructor
return False
@@ -730,7 +730,7 @@
return True
if isinstance( target, cpptypes.declarated_t ):
assert isinstance( target.declaration, class_declaration.class_t )
- if has_trivial_copy( target.declaration ):
+ if has_copy_constructor( target.declaration ):
return True #we have copy constructor
return False
@@ -895,13 +895,13 @@
return True
logger.debug( "__contains_noncopyable_mem_var - %s - false - doesn't contains noncopyable members" % class_.decl_string )
-def __is_noncopyable_single( class_ ):
+def __is_noncopyable_single( class_):
"""implementation details"""
#It is not enough to check base classes, we should also to check
#member variables.
logger = utils.loggers.cxx_parser
- if has_trivial_copy( class_ ) \
+ if has_copy_constructor( class_ ) \
and has_public_constructor( class_ ) \
and has_public_assign( class_ ) \
and has_public_destructor( class_ ):
@@ -947,7 +947,7 @@
if base_desc.related_class.decl_string in ('::boost::noncopyable', '::boost::noncopyable_::noncopyable' ):
logger.debug( true_header + "derives from boost::noncopyable" )
return True
- if not has_trivial_copy( base_desc.related_class ):
+ if not has_copy_constructor( base_desc.related_class ):
base_copy_ = base_desc.related_class.find_copy_constructor()
if base_copy_:
if base_copy_.access_type == 'private':
@@ -961,7 +961,7 @@
logger.debug( true_header + "__is_noncopyable_single returned True" )
return True
- if not has_trivial_copy( class_ ):
+ if not has_copy_constructor( class_ ):
logger.debug( true_header + "does not have trival copy constructor" )
return True
elif not has_public_constructor( class_ ):
Modified: pygccxml_dev/pygccxml/parser/scanner.py
===================================================================
--- pygccxml_dev/pygccxml/parser/scanner.py 2007-11-22 21:49:28 UTC (rev 1168)
+++ pygccxml_dev/pygccxml/parser/scanner.py 2007-11-22 21:51:07 UTC (rev 1169)
@@ -485,11 +485,19 @@
return operator
def __read_version(self, attrs):
+ logger = utils.loggers.cxx_parser
+
version = float( attrs.get(XML_AN_CVS_REVISION, 0.6) )
if version is None:
+ logger.info ( 'GCCXML version - 0.6' )
version = "0.6"
- elif version < 1.117:
+ elif version <= 1.114:
+ logger.info ( 'GCCXML version - 0.7' )
version = "0.7"
+ elif version in ( 1.115, 1.116, 1.117 ):
+ logger.info ( 'GCCXML version - 0.9 BUGGY' )
+ version = "0.9"
else:
+ logger.info ( 'GCCXML version - 0.9' )
version = "0.9"
self.__compiler = "GCC-XML " + version
Modified: pygccxml_dev/unittests/data/core_cache.hpp
===================================================================
--- pygccxml_dev/unittests/data/core_cache.hpp 2007-11-22 21:49:28 UTC (rev 1168)
+++ pygccxml_dev/unittests/data/core_cache.hpp 2007-11-22 21:51:07 UTC (rev 1169)
@@ -22,4 +22,4 @@
#endif//__core_cache_hpp__
-//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch
\ No newline at end of file
+//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch
\ No newline at end of file
Modified: pygccxml_dev/unittests/data/type_traits.hpp
===================================================================
--- pygccxml_dev/unittests/data/type_traits.hpp 2007-11-22 21:49:28 UTC (rev 1168)
+++ pygccxml_dev/unittests/data/type_traits.hpp 2007-11-22 21:51:07 UTC (rev 1169)
@@ -158,6 +158,20 @@
struct const_container{ const const_item items[10]; };
+ enum semantic{ position, normal, binormal };
+ enum element_type{ float_, color, short_ };
+
+ struct vertex{
+ protected:
+ unsigned short source;
+ size_t offset;
+ semantic sem;
+ element_type el_type;
+ public:
+ vertex( int x, int y, int z );
+
+ bool operator==( const vertex& ) const;
+ };
}
namespace yes{
@@ -178,6 +192,7 @@
typedef std::vector< int > vector_of_int_type;
typedef std::set< std::string > string_set_type;
typedef std::multimap< std::string, std::string > s2s_multimap_type;
+ typedef detail::vertex vertex_type;
}
}
@@ -553,11 +568,12 @@
};
} }
-namespace has_trivial_copy{
+namespace has_copy_constructor{
namespace yes{
struct x{
x(const x&){}
};
+ typedef is_noncopyable::detail::vertex vertex_type;
}
namespace no{
Modified: pygccxml_dev/unittests/test_all.py
===================================================================
--- pygccxml_dev/unittests/test_all.py 2007-11-22 21:49:28 UTC (rev 1168)
+++ pygccxml_dev/unittests/test_all.py 2007-11-22 21:51:07 UTC (rev 1169)
@@ -47,6 +47,7 @@
import find_container_traits_tester
import attributes_tester
import type_as_exception_bug_tester
+import copy_constructor_tester
testers = [
decl_string_tester
@@ -90,6 +91,7 @@
, find_container_traits_tester
, attributes_tester
, type_as_exception_bug_tester
+ , copy_constructor_tester
]
def create_suite():
Modified: pygccxml_dev/unittests/type_traits_tester.py
===================================================================
--- pygccxml_dev/unittests/type_traits_tester.py 2007-11-22 21:49:28 UTC (rev 1168)
+++ pygccxml_dev/unittests/type_traits_tester.py 2007-11-22 21:51:07 UTC (rev 1169)
@@ -126,8 +126,8 @@
def test_has_any_non_copyconstructor(self):
self.__test_type_category( 'has_any_non_copyconstructor', declarations.has_any_non_copyconstructor)
- def test_has_trivial_copy(self):
- self.__test_type_category( 'has_trivial_copy', declarations.has_trivial_copy )
+ def test_has_copy_constructor(self):
+ self.__test_type_category( 'has_copy_constructor', declarations.has_copy_constructor )
def test_is_base_and_derived(self):
ns = declarations.find_declaration( self.declarations
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-11-22 21:49:24
|
Revision: 1168
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1168&view=rev
Author: roman_yakovenko
Date: 2007-11-22 13:49:28 -0800 (Thu, 22 Nov 2007)
Log Message:
-----------
adding new test case
Modified Paths:
--------------
pyplusplus_dev/unittests/test_all.py
Modified: pyplusplus_dev/unittests/test_all.py
===================================================================
--- pyplusplus_dev/unittests/test_all.py 2007-11-22 19:42:23 UTC (rev 1167)
+++ pyplusplus_dev/unittests/test_all.py 2007-11-22 21:49:28 UTC (rev 1168)
@@ -93,11 +93,11 @@
import transfer_ownership_tester
import unicode_bug
import include_exclude_bug_tester
+import vector_with_shared_data_tester
-
testers = [
algorithms_tester
, module_body_tester
@@ -177,6 +177,7 @@
, transfer_ownership_tester
, unicode_bug
, include_exclude_bug_tester
+ , vector_with_shared_data_tester
]
class module_runner_t( object ):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-11-22 19:42:18
|
Revision: 1167
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1167&view=rev
Author: roman_yakovenko
Date: 2007-11-22 11:42:23 -0800 (Thu, 22 Nov 2007)
Log Message:
-----------
crea_with_signature algorithm is smarter from now - takes into acount functions defined in base classes
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-11-21 21:07:24 UTC (rev 1166)
+++ pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2007-11-22 19:42:23 UTC (rev 1167)
@@ -30,7 +30,7 @@
self._call_policies = None
self._use_keywords = True
self._use_default_arguments = True
- self._create_with_signature = False
+ self._create_with_signature = None
self._overridable = None
self._non_overridable_reason = None
self._transformations = None
@@ -52,7 +52,21 @@
+"Default value is True.")
def _get_create_with_signature(self):
- return self._create_with_signature or bool( self.overloads )
+ if None is self._create_with_signature:
+ self._create_with_signature = bool( self.overloads )
+ if not self._create_with_signature and isinstance( self.parent, declarations.class_t ):
+ for hi in self.parent.recursive_bases:
+ if hi.access_type == 'private':
+ continue
+ funcs = hi.related_class.calldefs( self.name, recursive=False, allow_empty=True )
+ for f in funcs:
+ if f.argument_types != self.argument_types:
+ self._create_with_signature = True
+ break
+ if self._create_with_signature:
+ break
+ return self._create_with_signature
+
def _set_create_with_signature(self, create_with_signature):
self._create_with_signature = create_with_signature
create_with_signature = property( _get_create_with_signature, _set_create_with_signature
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-11-21 21:07:19
|
Revision: 1166
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1166&view=rev
Author: roman_yakovenko
Date: 2007-11-21 13:07:24 -0800 (Wed, 21 Nov 2007)
Log Message:
-----------
adding new unittest
Added Paths:
-----------
pyplusplus_dev/unittests/data/vector_with_shared_data_to_be_exported.cpp
pyplusplus_dev/unittests/data/vector_with_shared_data_to_be_exported.hpp
pyplusplus_dev/unittests/vector_with_shared_data_tester.py
Added: pyplusplus_dev/unittests/data/vector_with_shared_data_to_be_exported.cpp
===================================================================
--- pyplusplus_dev/unittests/data/vector_with_shared_data_to_be_exported.cpp (rev 0)
+++ pyplusplus_dev/unittests/data/vector_with_shared_data_to_be_exported.cpp 2007-11-21 21:07:24 UTC (rev 1166)
@@ -0,0 +1,12 @@
+#include "vector_with_shared_data_to_be_exported.hpp"
+
+namespace samples{
+
+std::vector< boost::shared_ptr<data> > do_smth(){
+ std::vector< boost::shared_ptr<data> > result;
+ result.push_back( boost::shared_ptr<data>( new data() ) );
+ result.push_back( boost::shared_ptr<data>( new data() ) );
+ return result;
+}
+
+}
Added: pyplusplus_dev/unittests/data/vector_with_shared_data_to_be_exported.hpp
===================================================================
--- pyplusplus_dev/unittests/data/vector_with_shared_data_to_be_exported.hpp (rev 0)
+++ pyplusplus_dev/unittests/data/vector_with_shared_data_to_be_exported.hpp 2007-11-21 21:07:24 UTC (rev 1166)
@@ -0,0 +1,19 @@
+#ifndef __vector_with_shared_data_hpp__
+#define __vector_with_shared_data_hpp__
+
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+namespace samples{
+
+class data{};
+
+std::vector< boost::shared_ptr<data> > do_smth();
+
+}
+
+namespace pyplusplus{ namespace aliases{
+ typedef std::vector< boost::shared_ptr<samples::data> > shared_data_container_t;
+} }
+
+#endif//__vector_with_shared_data_hpp__
Added: pyplusplus_dev/unittests/vector_with_shared_data_tester.py
===================================================================
--- pyplusplus_dev/unittests/vector_with_shared_data_tester.py (rev 0)
+++ pyplusplus_dev/unittests/vector_with_shared_data_tester.py 2007-11-21 21:07:24 UTC (rev 1166)
@@ -0,0 +1,59 @@
+# 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 autoconfig
+from pyplusplus import utils
+import fundamental_tester_base
+from pygccxml import declarations
+from pyplusplus import module_builder
+from pyplusplus.module_builder import call_policies
+
+class tester_t(fundamental_tester_base.fundamental_tester_base_t):
+ EXTENSION_NAME = 'vector_with_shared_data'
+
+ def __init__( self, *args ):
+ fundamental_tester_base.fundamental_tester_base_t.__init__(
+ self
+ , tester_t.EXTENSION_NAME
+ , indexing_suite_version=2
+ , *args )
+ self.files = []
+
+ def customize( self, mb ):
+ mb.global_ns.exclude()
+ mb.namespace( 'samples' ).include()
+ do_smth = mb.free_fun( 'do_smth' )
+ v = declarations.remove_declarated( do_smth.return_type )
+ v.indexing_suite.disable_method( 'sort' )
+ v.indexing_suite.disable_method( 'count' )
+ v.indexing_suite.disable_method( 'index' )
+ v.indexing_suite.disable_method( 'contains' )
+
+ def generate_source_files( self, mb ):
+ files = mb.split_module( autoconfig.build_dir, on_unused_file_found=lambda fpath: fpath )
+ self.files = filter( lambda fname: fname.endswith( 'cpp' ), files )
+ self.files.append( os.path.join( autoconfig.data_directory
+ , self.EXTENSION_NAME + '_to_be_exported.cpp' ) )
+
+ def get_source_files( self ):
+ return self.files
+
+ def run_tests(self, module):
+ x = module.do_smth()
+ self.failUnless( len(x) == 2 )
+
+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()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-11-21 18:47:03
|
Revision: 1165
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1165&view=rev
Author: roman_yakovenko
Date: 2007-11-21 10:47:02 -0800 (Wed, 21 Nov 2007)
Log Message:
-----------
redirecting diagnostics to stderr, instead of stdout
Modified Paths:
--------------
pygccxml_dev/pygccxml/utils/__init__.py
pyplusplus_dev/pyplusplus/_logging_/__init__.py
Modified: pygccxml_dev/pygccxml/utils/__init__.py
===================================================================
--- pygccxml_dev/pygccxml/utils/__init__.py 2007-11-20 21:30:53 UTC (rev 1164)
+++ pygccxml_dev/pygccxml/utils/__init__.py 2007-11-21 18:47:02 UTC (rev 1165)
@@ -16,7 +16,7 @@
def _create_logger_( name ):
"""implementation details"""
logger = logging.getLogger(name)
- handler = logging.StreamHandler(sys.stdout)
+ handler = logging.StreamHandler()
handler.setFormatter( logging.Formatter( os.linesep + '%(levelname)s %(message)s' ) )
logger.addHandler(handler)
logger.setLevel(logging.INFO)
Modified: pyplusplus_dev/pyplusplus/_logging_/__init__.py
===================================================================
--- pyplusplus_dev/pyplusplus/_logging_/__init__.py 2007-11-20 21:30:53 UTC (rev 1164)
+++ pyplusplus_dev/pyplusplus/_logging_/__init__.py 2007-11-21 18:47:02 UTC (rev 1165)
@@ -14,7 +14,7 @@
def _create_logger_( name ):
"""implementation details"""
logger = logging.getLogger(name)
- handler = logging.StreamHandler(sys.stdout)
+ handler = logging.StreamHandler()
handler.setFormatter( multi_line_formatter_t( os.linesep + '%(levelname)s: %(message)s' ) )
logger.addHandler(handler)
logger.setLevel(logging.INFO)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-11-20 21:30:52
|
Revision: 1164
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1164&view=rev
Author: roman_yakovenko
Date: 2007-11-20 13:30:53 -0800 (Tue, 20 Nov 2007)
Log Message:
-----------
improving and fixing unittests
Modified Paths:
--------------
pyplusplus_dev/unittests/already_exposed_tester.py
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
pyplusplus_dev/unittests/data/function_transformations_to_be_exported.hpp
pyplusplus_dev/unittests/exposed_decls_db_tester.py
pyplusplus_dev/unittests/function_transformations_tester.py
pyplusplus_dev/unittests/fundamental_tester_base.py
pyplusplus_dev/unittests/include_exclude_bug_tester.py
pyplusplus_dev/unittests/split_module_tester.py
pyplusplus_dev/unittests/test_all.py
pyplusplus_dev/unittests/transfer_ownership_old_tester.py
Modified: pyplusplus_dev/unittests/already_exposed_tester.py
===================================================================
--- pyplusplus_dev/unittests/already_exposed_tester.py 2007-11-20 21:29:57 UTC (rev 1163)
+++ pyplusplus_dev/unittests/already_exposed_tester.py 2007-11-20 21:30:53 UTC (rev 1164)
@@ -13,17 +13,17 @@
class tester_t( unittest.TestCase ):
def test(self):
+ exposed_db = utils.exposed_decls_db_t()
+
fpath = os.path.join( autoconfig.data_directory, 'already_exposed_to_be_exported.hpp' )
mb = module_builder.module_builder_t( [module_builder.create_source_fc( fpath )]
, gccxml_path=autoconfig.gccxml.executable )
- exposed_db = utils.exposed_decls_db_t()
- ae = mb.namespace( 'already_exposed' )
- map( exposed_db.expose, ae.decls(recursive=True) )
+ mb.global_ns.exclude()
+ mb.namespace( 'already_exposed' ).include()
+ exposed_db.register_decls( mb.global_ns )
exposed_db.save( autoconfig.build_dir )
mb.register_module_dependency( autoconfig.build_dir )
- mb.decls().exclude()
- mb.namespace( 'already_exposed' ).include()
mb.class_( 'ae_derived' ).include()
mb.build_code_creator( 'xxx' )
Modified: pyplusplus_dev/unittests/custom_smart_ptr_classes_tester.py
===================================================================
--- pyplusplus_dev/unittests/custom_smart_ptr_classes_tester.py 2007-11-20 21:29:57 UTC (rev 1163)
+++ pyplusplus_dev/unittests/custom_smart_ptr_classes_tester.py 2007-11-20 21:30:53 UTC (rev 1164)
@@ -15,26 +15,31 @@
# include <boost/python/converter/rvalue_from_python_data.hpp>
# include <boost/python/converter/registered.hpp>
-namespace boost{ namespace python{
+using namespace controllers;
- using namespace controllers;
- using namespace converter;
+namespace smart_ptrs{
+
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();
}
+}
+
+namespace boost{ namespace python{
+
+ using namespace converter;
+
template <>
- struct pointee< my_smart_ptr_t< add_x_t > >{
+ struct pointee< smart_ptrs::my_smart_ptr_t< controller_i > >{
+ typedef controller_i type;
+ };
+
+ template <>
+ struct pointee< smart_ptrs::my_smart_ptr_t< add_x_t > >{
typedef add_x_t type;
};
@@ -44,7 +49,7 @@
{
my_smart_ptr_from_python()
{
- converter::registry::insert(&convertible, &construct, type_id<my_smart_ptr_t<T> >());
+ converter::registry::insert(&convertible, &construct, type_id<smart_ptrs::my_smart_ptr_t<T> >());
}
private:
@@ -58,13 +63,13 @@
static void construct(PyObject* source, rvalue_from_python_stage1_data* data)
{
- void* const storage = ((converter::rvalue_from_python_storage<my_smart_ptr_t<T> >*)data)->storage.bytes;
+ void* const storage = ((converter::rvalue_from_python_storage<smart_ptrs::my_smart_ptr_t<T> >*)data)->storage.bytes;
// Deal with the "None" case.
if (data->convertible == source)
- new (storage) my_smart_ptr_t<T>();
+ new (storage) smart_ptrs::my_smart_ptr_t<T>();
else{
- std::cout << "before new (storage) my_smart_ptr_t<T>( static_cast< T* >(data->convertible) );" << std::endl;
- new (storage) my_smart_ptr_t<T>( static_cast< T* >(data->convertible) );
+ std::cout << "before new (storage) smart_ptrs::my_smart_ptr_t<T>( static_cast< T* >(data->convertible) );" << std::endl;
+ new (storage) smart_ptrs::my_smart_ptr_t<T>( static_cast< T* >(data->convertible) );
}
data->convertible = storage;
}
@@ -72,8 +77,8 @@
template <class T>
struct ptr_to_python {
- static PyObject *convert(my_smart_ptr_t<T> const &p) {
- return incref(object(my_smart_ptr_t<T>(p)).ptr());
+ static PyObject *convert(smart_ptrs::my_smart_ptr_t<T> const &p) {
+ return incref(object(smart_ptrs::my_smart_ptr_t<T>(p)).ptr());
}
};
@@ -86,7 +91,7 @@
template <typename Class>
void visit(Class &c) const {
typedef typename Class::wrapped_type T;
- to_python_converter<my_smart_ptr_t<T>, ptr_to_python<T> >();
+ to_python_converter<smart_ptrs::my_smart_ptr_t<T>, ptr_to_python<T> >();
}
};
@@ -98,11 +103,11 @@
"""
boost::python::my_smart_ptr_from_python<controllers::add_x_t>();
- bp::register_ptr_to_python< my_smart_ptr_t< controllers::controller_i > >();
+ bp::register_ptr_to_python< smart_ptrs::my_smart_ptr_t< controllers::controller_i > >();
- //bp::register_ptr_to_python< my_smart_ptr_t< controllers::add_x_t > >();
+ //bp::register_ptr_to_python< smart_ptrs::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 > >();
+ bp::implicitly_convertible< smart_ptrs::my_smart_ptr_t< controllers::add_x_t >, smart_ptrs::my_smart_ptr_t< controllers::controller_i > >();
"""
@@ -120,7 +125,7 @@
mb.add_declaration_code( MODULE_SPTR_DECL_CODE )
mb.add_registration_code( MODULE_SPTR_REG_CODE )
add_x_t = mb.class_( 'add_x_t' )
- add_x_t.held_type = 'my_smart_ptr_t< controllers::add_x_t >'
+ add_x_t.held_type = 'smart_ptrs::my_smart_ptr_t< controllers::add_x_t >'
add_x_t.add_registration_code( 'def(boost::python::smart_ptr_stuff())' )
mb.build_code_creator( self.EXTENSION_NAME )
@@ -149,6 +154,7 @@
return add_5_value_t( v )
def run_tests(self, module):
+ self.fail( "The test fails with Segmentation fault error." )
add_0 = module.add_x_t( 23 )
print '>',1
self.failUnless( 23 == add_0.get_value() )
Modified: pyplusplus_dev/unittests/data/custom_smart_ptr.h
===================================================================
--- pyplusplus_dev/unittests/data/custom_smart_ptr.h 2007-11-20 21:29:57 UTC (rev 1163)
+++ pyplusplus_dev/unittests/data/custom_smart_ptr.h 2007-11-20 21:30:53 UTC (rev 1164)
@@ -3,6 +3,8 @@
#include <assert.h>
+namespace smart_ptrs{
+
template<class T> class my_smart_ptr_t {
protected:
T* pRep;
@@ -100,6 +102,7 @@
return a.get() != b.get();
}
+}
#endif //__my_smart_ptr_t__
Modified: pyplusplus_dev/unittests/data/custom_smart_ptr_classes_to_be_exported.hpp
===================================================================
--- pyplusplus_dev/unittests/data/custom_smart_ptr_classes_to_be_exported.hpp 2007-11-20 21:29:57 UTC (rev 1163)
+++ pyplusplus_dev/unittests/data/custom_smart_ptr_classes_to_be_exported.hpp 2007-11-20 21:30:53 UTC (rev 1164)
@@ -8,7 +8,7 @@
virtual int get_value(void) const = 0;
};
-typedef my_smart_ptr_t<controller_i> controller_ptr_i;
+typedef smart_ptrs::my_smart_ptr_t<controller_i> controller_ptr_i;
struct multiply_x_t : controller_i{
multiply_x_t( int value )
@@ -27,7 +27,7 @@
int m_value;
};
-typedef my_smart_ptr_t<multiply_x_t> multiply_x_ptr_t;
+typedef smart_ptrs::my_smart_ptr_t<multiply_x_t> multiply_x_ptr_t;
struct add_x_t : controller_i{
add_x_t( int value )
@@ -47,19 +47,19 @@
};
-struct add_x_ptr_t : public my_smart_ptr_t< add_x_t >{
+struct add_x_ptr_t : public smart_ptrs::my_smart_ptr_t< add_x_t >{
explicit add_x_ptr_t(add_x_t* rep)
- : my_smart_ptr_t<add_x_t>(rep)
+ : smart_ptrs::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)
+ : smart_ptrs::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 smart_ptrs::my_smart_ptr_t<resource_t>() const {
+ // return smart_ptrs::my_smart_ptr_t<resource_t>( *this );
//}
/// Operator used to convert a add_x_ptr_t to a add_x_ptr_t
@@ -101,7 +101,7 @@
}
//inline int
-//val_get_value( my_smart_ptr_t< controllers::add_x_t > a ){
+//val_get_value( smart_ptrs::my_smart_ptr_t< controllers::add_x_t > a ){
// return a->get_value();
//}
Modified: pyplusplus_dev/unittests/data/function_transformations_to_be_exported.hpp
===================================================================
--- pyplusplus_dev/unittests/data/function_transformations_to_be_exported.hpp 2007-11-20 21:29:57 UTC (rev 1163)
+++ pyplusplus_dev/unittests/data/function_transformations_to_be_exported.hpp 2007-11-20 21:30:53 UTC (rev 1164)
@@ -245,6 +245,13 @@
}
};
+struct render_queue_listener_t{
+ virtual void
+ render_queue_ended( int group_id
+ , const std::string& invocation
+ , bool& repeat_this_invocation ){};
+};
+
}
#endif//__function_transformations_to_be_exported_hpp__
Modified: pyplusplus_dev/unittests/exposed_decls_db_tester.py
===================================================================
--- pyplusplus_dev/unittests/exposed_decls_db_tester.py 2007-11-20 21:29:57 UTC (rev 1163)
+++ pyplusplus_dev/unittests/exposed_decls_db_tester.py 2007-11-20 21:30:53 UTC (rev 1164)
@@ -9,6 +9,7 @@
import autoconfig
from pygccxml import parser
from pygccxml import declarations
+from pyplusplus import decl_wrappers
from pyplusplus import code_creators
from pyplusplus import module_creator
from pyplusplus import module_builder
@@ -43,15 +44,22 @@
def test(self):
db = pypp_utils.exposed_decls_db_t()
config = parser.config_t( gccxml_path=autoconfig.gccxml.executable )
- global_ns = declarations.get_global_namespace( parser.parse_string( self.CODE, config ) )
+
+ reader = parser.project_reader_t( config, None, decl_wrappers.dwfactory_t() )
+ decls = reader.read_files( [parser.create_text_fc(self.CODE)] )
+
+ global_ns = declarations.get_global_namespace( decls )
ns = global_ns.namespace( 'ns' )
- for d in ns.decls(recursive=True):
- db.expose( d )
+ ns_skip = global_ns.namespace( 'ns_skip' )
+
+ global_ns.exclude()
+ ns.include()
+
+ db.register_decls( global_ns )
for x in ns.decls(recursive=True):
self.failUnless( db.is_exposed( x ) == True )
-
- ns_skip = global_ns.namespace( 'ns_skip' )
+
for x in ns_skip.decls(recursive=True):
self.failUnless( db.is_exposed( x ) == False )
@@ -66,7 +74,6 @@
for x in ns_skip.decls(recursive=True):
self.failUnless( db.is_exposed( x ) == False )
-
def create_suite():
suite = unittest.TestSuite()
suite.addTest( unittest.makeSuite(tester_t))
Modified: pyplusplus_dev/unittests/function_transformations_tester.py
===================================================================
--- pyplusplus_dev/unittests/function_transformations_tester.py 2007-11-20 21:29:57 UTC (rev 1163)
+++ pyplusplus_dev/unittests/function_transformations_tester.py 2007-11-20 21:30:53 UTC (rev 1164)
@@ -91,6 +91,10 @@
tester = transfer_ownership_tester.mem_fun( 'tester' )
tester.add_transformation( ft.transfer_ownership( 0 ) )
+ render_queue_listener_t = mb.class_( 'render_queue_listener_t' )
+ render_queue_ended = render_queue_listener_t.mem_fun( 'render_queue_ended' )
+ render_queue_ended.add_transformation( ft.inout(2) )
+
def run_tests(self, module):
"""Run the actual unit tests.
"""
Modified: pyplusplus_dev/unittests/fundamental_tester_base.py
===================================================================
--- pyplusplus_dev/unittests/fundamental_tester_base.py 2007-11-20 21:29:57 UTC (rev 1163)
+++ pyplusplus_dev/unittests/fundamental_tester_base.py 2007-11-20 21:30:53 UTC (rev 1164)
@@ -55,13 +55,24 @@
, declarations.namespace_t
, declarations.free_operator_t )
for d in mb.decls():
- if d.ignore or not d.exportable or isinstance( d, irrelevant_decl_types ):
+ if not d.exportable:
continue
- if d.parent and not d.parent.name:
- continue #unnamed classes
- self.failUnless( exposed_db.is_exposed( d )
- , '''Declaration "%s" is exposed, but for some reason it isn't marked as such.'''
- % str( d ) )
+ elif isinstance( d, declarations.free_operator_t ):
+ continue
+ elif d.ignore:
+ if exposed_db.is_exposed( d ):
+ i = 0
+ self.failUnless( not exposed_db.is_exposed( d )
+ , '''Declaration "%s" is NOT exposed, but for some reason it is marked as such.'''
+ % str( d ) )
+ #if d.ignore or not d.exportable or isinstance( d, irrelevant_decl_types ):
+ #continue
+ #if d.parent and not d.parent.name:
+ #continue #unnamed classes
+ else:
+ self.failUnless( exposed_db.is_exposed( d )
+ , '''Declaration "%s" is exposed, but for some reason it isn't marked as such.'''
+ % str( d ) )
def customize(self, generator):
pass
Modified: pyplusplus_dev/unittests/include_exclude_bug_tester.py
===================================================================
--- pyplusplus_dev/unittests/include_exclude_bug_tester.py 2007-11-20 21:29:57 UTC (rev 1163)
+++ pyplusplus_dev/unittests/include_exclude_bug_tester.py 2007-11-20 21:30:53 UTC (rev 1164)
@@ -19,7 +19,7 @@
, *args )
def customize(self, mb ):
- pass
+ mb.mem_fun( '::Ogre::Any::swap' ).exclude()
def run_tests( self, module):
pass
Modified: pyplusplus_dev/unittests/split_module_tester.py
===================================================================
--- pyplusplus_dev/unittests/split_module_tester.py 2007-11-20 21:29:57 UTC (rev 1163)
+++ pyplusplus_dev/unittests/split_module_tester.py 2007-11-20 21:30:53 UTC (rev 1164)
@@ -27,8 +27,12 @@
def customize( self, mb ):
mb.global_ns.exclude()
+ nm_t = declarations.remove_declarated( mb.global_ns.typedef( 'naive_matrix_t' ).type )
+ nm_t.include()
+
exposed_db = utils.exposed_decls_db_t()
- exposed_db.expose( declarations.remove_declarated( mb.global_ns.typedef( 'naive_matrix_t' ).type ) )
+
+ exposed_db.register_decls( mb.global_ns )
exposed_db.save( autoconfig.build_dir )
mb.register_module_dependency( autoconfig.build_dir )
Modified: pyplusplus_dev/unittests/test_all.py
===================================================================
--- pyplusplus_dev/unittests/test_all.py 2007-11-20 21:29:57 UTC (rev 1163)
+++ pyplusplus_dev/unittests/test_all.py 2007-11-20 21:30:53 UTC (rev 1164)
@@ -179,58 +179,28 @@
, include_exclude_bug_tester
]
-class process_tester_runner_t( object ):
+class module_runner_t( object ):
+ bottom_line_re = re.compile( 'Ran\s(?P<num_of_tests>\d+)\stests?\sin\s(?P<seconds>\d+\.?\d*)s')
+ test_name_re = re.compile( '(?P<name>.+ \(.+\))\s\.\.\.' )
+ failed_test_re = re.compile( 'FAIL\:\s(?P<name>.+ \(.+\))' )
+ error_test_re = re.compile( 'ERROR\:\s(?P<name>.+ \(.+\))' )
- class module_stat_t( object ):
- bottom_line_re = re.compile( 'Ran\s(?P<num_of_tests>\d+)\stests?\sin\s(?P<seconds>\d+\.?\d*)s')
- test_name_re = re.compile( '(?P<name>.+ \(.+\))\s\.\.\.' )
- failed_test_re = re.compile( 'FAIL\:\s(?P<name>.+ \(.+\))' )
- error_test_re = re.compile( 'ERROR\:\s(?P<name>.+ \(.+\))' )
+ def __init__( self, module ):
+ self.module = module
+ self.output = None
- def __init__( self, module, output, exit_status ):
- self.module = module
- self.output = output
-
- self.test_results = {} #test name : result
- self.num_of_tests = 0
- self.total_run_time = 0
- self.exit_status = exit_status
+ self.test_results = {} #test name : result
+ self.num_of_tests = 0
+ self.total_run_time = 0
+ self.exit_status = None
- self.__update()
-
- def __create_unique_name( self, name ):
- if '__main__.' in name:
- name = name.replace( '__main__', os.path.basename( self.module.__file__)[:-4] )
- return name
-
- def __update( self ):
- match_found = self.bottom_line_re.search( self.output )
- if match_found:
- self.num_of_tests += int( match_found.group( 'num_of_tests' ) )
- self.total_run_time += float( match_found.group( 'seconds' ) )
-
- uname = self.__create_unique_name
- for match_found in self.test_name_re.finditer( self.output ):
- self.test_results[ uname( match_found.group( 'name' ) ) ] = 'ok'
-
- for match_found in self.failed_test_re.finditer( self.output ):
- self.test_results[ uname( match_found.group( 'name' ) ) ] = 'FAIL'
-
- for match_found in self.error_test_re.finditer( self.output ):
- self.test_results[ uname( match_found.group( 'name' ) ) ] = 'ERROR'
-
- assert( self.num_of_tests == len( self.test_results ) )
-
- def __init__( self, modules ):
- self.__modules = modules
- self.__statistics = []
- self.__total_time = 0
-
- def __run_single( self, module ):
- test_file_name = module.__file__[:-1]
+ def __call__( self ):
+ print os.linesep, '<*> start %s tester' % os.path.basename( self.module.__file__)
+
+ test_file_name = self.module.__file__
if test_file_name.endswith( 'pyc' ):
test_file_name = test_file_name[:-1]
- command_line = ' '.join([ sys.executable, test_file_name ]) #pyc -> py
+ command_line = ' '.join([ sys.executable, test_file_name ])
input_, output = os.popen4( command_line )
input_.close()
report = []
@@ -241,15 +211,47 @@
break
else:
print data,
- exit_status = output.close()
- self.__statistics.append( self.module_stat_t( module, ''.join( report ), exit_status ) )
+ self.output = ''.join( report )
+ self.exit_status = output.close()
+ self.__update()
+ print '<***> finish %s tester' % os.path.basename( self.module.__file__)
+
+ def __create_unique_name( self, name ):
+ if '__main__.' in name:
+ name = name.replace( '__main__', os.path.basename( self.module.__file__)[:-4] )
+ return name
+
+ def __update( self ):
+ match_found = self.bottom_line_re.search( self.output )
+ if match_found:
+ self.num_of_tests += int( match_found.group( 'num_of_tests' ) )
+ self.total_run_time += float( match_found.group( 'seconds' ) )
+ uname = self.__create_unique_name
+ for match_found in self.test_name_re.finditer( self.output ):
+ self.test_results[ uname( match_found.group( 'name' ) ) ] = 'ok'
+
+ for match_found in self.failed_test_re.finditer( self.output ):
+ self.test_results[ uname( match_found.group( 'name' ) ) ] = 'FAIL'
+
+ for match_found in self.error_test_re.finditer( self.output ):
+ self.test_results[ uname( match_found.group( 'name' ) ) ] = 'ERROR'
+
+ assert( self.num_of_tests == len( self.test_results ) )
+
+
+class process_tester_runner_t( object ):
+
+ def __init__( self, modules ):
+ self.__m_runners = [ module_runner_t(m) for m in modules ]
+ self.__total_time = 0
+
def __dump_statistics( self ):
num_of_tests = 0
test_results = {}
total_tests_only_run_time = 0
exit_status = 0
- for stat in self.__statistics:
+ for stat in self.__m_runners:
num_of_tests += stat.num_of_tests
total_tests_only_run_time += stat.total_run_time
test_results.update( stat.test_results )
@@ -272,8 +274,7 @@
def __call__( self ):
start_time = time.time()
- for m in self.__modules:
- self.__run_single( m )
+ [ m() for m in self.__m_runners ]
self.__total_time = time.time() - start_time
self.__dump_statistics()
Modified: pyplusplus_dev/unittests/transfer_ownership_old_tester.py
===================================================================
--- pyplusplus_dev/unittests/transfer_ownership_old_tester.py 2007-11-20 21:29:57 UTC (rev 1163)
+++ pyplusplus_dev/unittests/transfer_ownership_old_tester.py 2007-11-20 21:30:53 UTC (rev 1164)
@@ -34,7 +34,7 @@
def customize( self, mb ):
event_clss = mb.classes( lambda cls: cls.name in ( 'event_t', 'do_nothing_t' ) )
for cls in event_clss:
- cls.class_type = cls.CLASS_TYPE.WRAPPER
+ cls.exposed_class_type = cls.EXPOSED_CLASS_TYPE.WRAPPER
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( impl_conv_code % { 'from' : cls.wrapper_alias
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-11-20 21:29:54
|
Revision: 1163
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1163&view=rev
Author: roman_yakovenko
Date: 2007-11-20 13:29:57 -0800 (Tue, 20 Nov 2007)
Log Message:
-----------
switching to new and better implementation of "already exposed" database and algorithms
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/file_writers/writer.py
pyplusplus_dev/pyplusplus/module_builder/builder.py
pyplusplus_dev/pyplusplus/module_creator/creator.py
pyplusplus_dev/pyplusplus/module_creator/dependencies_manager.py
pyplusplus_dev/pyplusplus/utils/__init__.py
Modified: pyplusplus_dev/pyplusplus/file_writers/writer.py
===================================================================
--- pyplusplus_dev/pyplusplus/file_writers/writer.py 2007-11-20 21:25:57 UTC (rev 1162)
+++ pyplusplus_dev/pyplusplus/file_writers/writer.py 2007-11-20 21:29:57 UTC (rev 1163)
@@ -32,7 +32,7 @@
if None is files_sum_repository:
self.__files_sum_repository = md5sum_repository.dummy_repository_t()
self.__exposed_decls_db = utils.exposed_decls_db_t()
- self.__extmodule.register_exposed( self.__exposed_decls_db )
+ self.__exposed_decls_db.register_decls( extmodule.global_ns )
@property
def encoding( self ):
@@ -143,4 +143,4 @@
def save_exposed_decls_db( self, file_path ):
self.__exposed_decls_db.save( file_path )
-
\ No newline at end of file
+
Modified: pyplusplus_dev/pyplusplus/module_builder/builder.py
===================================================================
--- pyplusplus_dev/pyplusplus/module_builder/builder.py 2007-11-20 21:25:57 UTC (rev 1162)
+++ pyplusplus_dev/pyplusplus/module_builder/builder.py 2007-11-20 21:29:57 UTC (rev 1163)
@@ -97,7 +97,6 @@
self.__registrations_code_head = []
self.__registrations_code_tail = []
- self.__already_exposed_modules = []
@property
def global_ns( self ):
@@ -109,7 +108,9 @@
return self.__encoding
def register_module_dependency( self, other_module_generate_code_dir ):
- self.__already_exposed_modules.append( other_module_generate_code_dir )
+ db = utils.exposed_decls_db_t()
+ db.load( other_module_generate_code_dir )
+ db.update_decls( self.global_ns )
def run_query_optimizer(self):
"""
@@ -255,8 +256,7 @@
, types_db
, target_configuration
, enable_indexing_suite
- , doc_extractor
- , self.__already_exposed_modules)
+ , doc_extractor)
self.__code_creator = creator.create()
self.__code_creator.replace_included_headers(self.__parsed_files)
#I think I should ask users, what they expect
@@ -266,11 +266,12 @@
return self.__code_creator
- def _get_module( self ):
+ @property
+ def code_creator( self ):
+ "reference to L{code_creators.module_t} instance"
if not self.__code_creator:
raise RuntimeError( "self.module is equal to None. Did you forget to call build_code_creator function?" )
return self.__code_creator
- code_creator = property( _get_module, doc="reference to L{code_creators.module_t} instance" )
def has_code_creator( self ):
"""
Modified: pyplusplus_dev/pyplusplus/module_creator/creator.py
===================================================================
--- pyplusplus_dev/pyplusplus/module_creator/creator.py 2007-11-20 21:25:57 UTC (rev 1162)
+++ pyplusplus_dev/pyplusplus/module_creator/creator.py 2007-11-20 21:29:57 UTC (rev 1163)
@@ -52,8 +52,7 @@
, types_db=None
, target_configuration=None
, enable_indexing_suite=True
- , doc_extractor=None
- , already_exposed_dbs=None):
+ , doc_extractor=None ):
"""Constructor.
@param decls: Declarations that should be exposed in the final module.
@@ -91,7 +90,7 @@
if not self.__types_db:
self.__types_db = types_database.types_database_t()
- self.__extmodule = code_creators.module_t()
+ self.__extmodule = code_creators.module_t( declarations.get_global_namespace(decls) )
if boost_python_ns_name:
bp_ns_alias = code_creators.namespace_alias_t( alias=boost_python_ns_name
, full_namespace_name='::boost::python' )
@@ -102,7 +101,7 @@
self.__extmodule.adopt_creator( self.__module_body )
self.__opaque_types_manager = opaque_types_manager.manager_t( self.__extmodule )
- self.__dependencies_manager = dependencies_manager.manager_t(self.decl_logger, already_exposed_dbs)
+ self.__dependencies_manager = dependencies_manager.manager_t(self.decl_logger)
prepared_decls = self._prepare_decls( decls, doc_extractor )
self.__decls = sort_algorithms.sort( prepared_decls )
@@ -141,9 +140,8 @@
self.__print_readme( decl )
continue
- if self.__dependencies_manager.is_already_exposed( decl ):
+ if decl.already_exposed:
#check wether this is already exposed in other module
- decl.already_exposed = True
continue
if isinstance( decl.parent, declarations.namespace_t ):
@@ -286,8 +284,7 @@
for cls in used_containers:
self.__print_readme( cls )
- if self.__dependencies_manager.is_already_exposed( cls ):
- cls.already_exposed = True
+ if cls.already_exposed:
continue
cls_creator = create_cls_cc( cls )
Modified: pyplusplus_dev/pyplusplus/module_creator/dependencies_manager.py
===================================================================
--- pyplusplus_dev/pyplusplus/module_creator/dependencies_manager.py 2007-11-20 21:25:57 UTC (rev 1162)
+++ pyplusplus_dev/pyplusplus/module_creator/dependencies_manager.py 2007-11-20 21:29:57 UTC (rev 1163)
@@ -13,20 +13,14 @@
class manager_t( object ):
- def __init__( self, logger, already_exposed=None ):
+ def __init__( self, logger ):
object.__init__( self )
self.__exported_decls = []
self.__logger = logger
- self.__already_exposed_db = utils.exposed_decls_db_t()
- if already_exposed:
- map( self.__already_exposed_db.load, already_exposed )
def add_exported( self, decl ):
self.__exported_decls.append( decl )
- def is_already_exposed( self, decl ):
- return decl.already_exposed or self.__already_exposed_db.is_exposed( decl )
-
def __select_duplicate_aliases( self, decls ):
duplicated = {}
for decl in decls:
@@ -79,7 +73,7 @@
if self.__is_std_decl( decl ):
#TODO add element_type to the list of dependencies
return [] #std declarations should be exported by Py++!
- if self.is_already_exposed( decl ):
+ if decl.already_exposed:
return []
dependencies = decl.i_depend_on_them(recursive=False)
if isinstance( decl, declarations.class_t ):
Modified: pyplusplus_dev/pyplusplus/utils/__init__.py
===================================================================
--- pyplusplus_dev/pyplusplus/utils/__init__.py 2007-11-20 21:25:57 UTC (rev 1162)
+++ pyplusplus_dev/pyplusplus/utils/__init__.py 2007-11-20 21:29:57 UTC (rev 1163)
@@ -55,96 +55,113 @@
class exposed_decls_db_t( object ):
DEFAULT_FILE_NAME = 'exposed_decl.pypp.txt'
- class row_creator_t( declarations.decl_visitor_t ):
- def __init__( self, field_delimiter ):
- self.__decl = None
- self.__formatted = None
- self.__field_delimiter = field_delimiter
+ class row_t( declarations.decl_visitor_t ):
+ FIELD_DELIMITER = '@'
+ EXPOSED_DECL_SIGN = '+'
+ UNEXPOSED_DECL_SIGN = '~'
+ CALLDEF_SIGNATURE_DELIMITER = '#'
+
+ def __init__( self, decl_or_string ):
+ self.key = ''
+ self.signature = ''
+ self.exposed_sign = ''
+ self.normalized_name = ''
+ if isinstance( decl_or_string, declarations.declaration_t ):
+ self.__init_from_decl( decl_or_string )
+ else:
+ self.__init_from_str( decl_or_string )
- def get_full_name(self):
- return declarations.full_name( self.__decl )
+ def find_out_normalized_name( self, decl ):
+ if decl.name:
+ return decl.name
+ else:#unnamed enums, classes, unions
+ return str( decl.location.as_tuple() )
- def __call__( self, decl ):
- self.__decl = decl
- self.__formatted = None
- try:
- declarations.apply_visitor( self, decl )
- except NotImplementedError:
- pass
- return self.__formatted
+ def __init_from_str( self, row ):
+ self.exposed_sign, self.key, self.normalized_name, self.signature \
+ = row.split( self.FIELD_DELIMITER )
- def visit_free_function( self ):
- self.__formatted = '%s%s%s' % ( self.get_full_name()
- , self.__field_delimiter
- , self.__decl.function_type().decl_string )
-
- def visit_class_declaration(self ):
- self.__formatted = self.get_full_name()
+ def __init_from_decl( self, decl ):
+ if decl.ignore:
+ self.exposed_sign = self.UNEXPOSED_DECL_SIGN
+ else:
+ self.exposed_sign = self.EXPOSED_DECL_SIGN
+ self.key = decl.__class__.__name__
+ self.signature = decl.decl_string
+ if isinstance( decl, declarations.calldef_t ):
+ self.signature = self.signature + decl.function_type().decl_string
+ self.normalized_name = self.find_out_normalized_name( decl )
- def visit_class(self ):
- self.__formatted = self.get_full_name()
-
- def visit_enumeration(self ):
- self.__formatted = self.get_full_name()
-
- def visit_variable(self ):
- self.__formatted = self.get_full_name()
+ def __str__( self ):
+ return self.FIELD_DELIMITER.join([ self.exposed_sign
+ , self.key
+ , self.normalized_name
+ , self.signature])
+ def does_refer_same_decl( self, other ):
+ return self.key == other.key \
+ and self.signature == other.signature \
+ and self.normalized_name == other.normalized_name
+
def __init__( self ):
- self.__exposed = {}
- self.__row_creator = self.row_creator_t(field_delimiter='@')
- self.__key_delimiter = '?'
+ self.__registry = {} # key : { name : set(row) }
self.__row_delimiter = os.linesep
def save( self, fpath ):
if os.path.isdir( fpath ):
fpath = os.path.join( fpath, self.DEFAULT_FILE_NAME )
f = file( fpath, 'w+b' )
- for key, items in self.__exposed.iteritems():
- for item in items:
- f.write( '%s%s%s%s' % ( key, self.__key_delimiter, item, self.__row_delimiter ) )
+ for name2rows in self.__registry.itervalues():
+ for rows in name2rows.itervalues():
+ for row in rows:
+ f.write( '%s%s' % ( str(row), self.__row_delimiter ) )
f.close()
-
+
def load( self, fpath ):
if os.path.isdir( fpath ):
fpath = os.path.join( fpath, self.DEFAULT_FILE_NAME )
f = file( fpath, 'r+b' )
for line in f:
- key, row = line.split( self.__key_delimiter)
- row = row.replace( self.__row_delimiter, '' )
- if not self.__exposed.has_key( key ):
- self.__exposed[ key ] = set()
- self.__exposed[ key ].add( row )
-
- def __create_key( self, decl ):
- return decl.__class__.__name__
+ row = self.row_t( line.replace( self.__row_delimiter, '' ) )
+ self.__update_registry( row )
- def expose( self, decl ):
- if not isinstance( decl.parent, declarations.namespace_t ):
- return None #we don't want to dump class internal declarations
- row = self.__row_creator( decl )
- if row is None:
+ def __update_registry( self, row ):
+ if not self.__registry.has_key( row.key ):
+ self.__registry[ row.key ] = { row.normalized_name : [row] }
+ else:
+ if not self.__registry[ row.key ].has_key( row.normalized_name ):
+ self.__registry[ row.key ][row.normalized_name] = [row]
+ else:
+ self.__registry[ row.key ][row.normalized_name].append(row)
+
+ def __find_in_registry( self, decl ):
+ row = self.row_t( decl )
+ try:
+ decls = filter( lambda rrow: rrow.does_refer_same_decl( row )
+ , self.__registry[ row.key ][ row.normalized_name ] )
+ if decls:
+ return decls[0]
+ else:
+ return None
+ except KeyError:
return None
- key = self.__create_key( decl )
- if not self.__exposed.has_key( key ):
- self.__exposed[ key ] = set()
- self.__exposed[ key ].add( row )
-
- def __get_under_ns_decl( self, decl ):
- while True:
- if isinstance( decl.parent, declarations.namespace_t ):
- return decl
+
+ def is_exposed( self, decl ):
+ row = self.__find_in_registry( decl)
+ return row and self.row_t.EXPOSED_DECL_SIGN == row.exposed_sign
+
+ def update_decls( self, global_ns ):
+ for decl in global_ns.decls():
+ row = self.__find_in_registry( decl )
+ if not row:
+ continue
+ if self.row_t.EXPOSED_DECL_SIGN == row.exposed_sign:
+ decl.ignore = False
+ decl.already_exposed = True
else:
- decl = decl.parent
+ decl.ignore = True
+ decl.already_exposed = False
- def is_exposed( self, decl_ ):
- if isinstance( decl_, declarations.namespace_t ):
- return False#namespaces are always exposed
- decl = self.__get_under_ns_decl( decl_ )
- key = self.__create_key( decl )
- if not self.__exposed.has_key( key ):
- return False
- row = self.__row_creator( decl )
- return row in self.__exposed[ key ]
-
-
+ def register_decls( self, global_ns ):
+ for decl in global_ns.decls():
+ self.__update_registry( self.row_t( decl ) )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-11-20 21:25:52
|
Revision: 1162
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1162&view=rev
Author: roman_yakovenko
Date: 2007-11-20 13:25:57 -0800 (Tue, 20 Nov 2007)
Log Message:
-----------
remove_register_exposed functionality
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/code_creators/calldef.py
pyplusplus_dev/pyplusplus/code_creators/class_declaration.py
pyplusplus_dev/pyplusplus/code_creators/code_creator.py
pyplusplus_dev/pyplusplus/code_creators/compound.py
pyplusplus_dev/pyplusplus/code_creators/enum.py
pyplusplus_dev/pyplusplus/code_creators/exception_translator.py
pyplusplus_dev/pyplusplus/code_creators/global_variable.py
pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py
pyplusplus_dev/pyplusplus/code_creators/member_variable.py
pyplusplus_dev/pyplusplus/code_creators/module.py
pyplusplus_dev/pyplusplus/code_creators/opaque_type_registrator.py
pyplusplus_dev/pyplusplus/code_creators/scoped.py
pyplusplus_dev/pyplusplus/code_creators/smart_pointers.py
pyplusplus_dev/pyplusplus/code_creators/unnamed_enum.py
Modified: pyplusplus_dev/pyplusplus/code_creators/calldef.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/calldef.py 2007-11-20 21:25:05 UTC (rev 1161)
+++ pyplusplus_dev/pyplusplus/code_creators/calldef.py 2007-11-20 21:25:57 UTC (rev 1162)
@@ -140,11 +140,6 @@
files.append( self.declaration.call_policies.header_file )
return files
- def register_exposed( self, exposed_db ):
- """Register exposed declaration in L{exposed data base<utils.exposed_decls_db_t>}"""
- exposed_db.expose( self.declaration )
-
-
class calldef_wrapper_t( code_creator.code_creator_t
, declaration_based.declaration_based_t):
def __init__(self, function ):
@@ -188,11 +183,6 @@
files.append( self.declaration.call_policies.header_file )
return files
- def register_exposed( self, exposed_db ):
- """Register exposed declaration in L{exposed data base<utils.exposed_decls_db_t>}"""
- exposed_db.expose( self.declaration )
-
-
class free_function_t( calldef_t ):
def __init__( self, function ):
calldef_t.__init__( self, function=function )
@@ -1080,10 +1070,6 @@
def _get_system_headers_impl( self ):
return []
- def register_exposed( self, exposed_db ):
- """Register exposed declaration in L{exposed data base<utils.exposed_decls_db_t>}"""
- exposed_db.expose( self.declaration )
-
class casting_operator_t( registration_based.registration_based_t
, declaration_based.declaration_based_t ):
"""
@@ -1108,11 +1094,6 @@
def _get_system_headers_impl( self ):
return []
- def register_exposed( self, exposed_db ):
- """Register exposed declaration in L{exposed data base<utils.exposed_decls_db_t>}"""
- exposed_db.expose( self.declaration )
-
-
class casting_member_operator_t( registration_based.registration_based_t
, declaration_based.declaration_based_t ):
"""
@@ -1151,12 +1132,6 @@
def _get_system_headers_impl( self ):
return []
- def register_exposed( self, exposed_db ):
- """Register exposed declaration in L{exposed data base<utils.exposed_decls_db_t>}"""
- exposed_db.expose( self.declaration )
-
-
-
class casting_constructor_t( registration_based.registration_based_t
, declaration_based.declaration_based_t ):
"""
@@ -1235,11 +1210,6 @@
def name( self ):
return '%s_%s_overloads' % ( self.parent_decl.alias, self.alias )
- def register_exposed( self, exposed_db ):
- """Register exposed declaration in L{exposed data base<utils.exposed_decls_db_t>}"""
- for f in self.functions:
- exposed_db.expose( f )
-
class mem_fun_overloads_class_t( calldef_overloads_class_t ):
def __init__( self, mem_funs ):
#precondition: all member functions belong to same class and
Modified: pyplusplus_dev/pyplusplus/code_creators/class_declaration.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/class_declaration.py 2007-11-20 21:25:05 UTC (rev 1161)
+++ pyplusplus_dev/pyplusplus/code_creators/class_declaration.py 2007-11-20 21:25:57 UTC (rev 1162)
@@ -404,13 +404,3 @@
def _get_system_headers_impl( self ):
return []
-
- def register_exposed( self, exposed_db ):
- """Register exposed declaration in L{exposed data base<utils.exposed_decls_db_t>}"""
- exposed_db.expose( self.declaration )
-
-
-
-
-
-
Modified: pyplusplus_dev/pyplusplus/code_creators/code_creator.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/code_creator.py 2007-11-20 21:25:05 UTC (rev 1161)
+++ pyplusplus_dev/pyplusplus/code_creators/code_creator.py 2007-11-20 21:25:57 UTC (rev 1162)
@@ -178,12 +178,4 @@
assert isinstance( line, types.StringTypes )
l = line.lstrip()
return l.startswith( '//' ) or l.startswith( '/*' )
-
- def register_exposed( self, exposed_db ):
- """Register exposed declaration in L{exposed data base<utils.exposed_decls_db_t>}
-
- The default implementation of the function does nothing.
- """
- pass
-
\ No newline at end of file
Modified: pyplusplus_dev/pyplusplus/code_creators/compound.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/compound.py 2007-11-20 21:25:05 UTC (rev 1161)
+++ pyplusplus_dev/pyplusplus/code_creators/compound.py 2007-11-20 21:25:57 UTC (rev 1162)
@@ -86,11 +86,4 @@
if unique:
files = self.unique_headers( files )
return files
-
- def register_exposed( self, exposed_db ):
- """Register exposed declaration in L{exposed data base<utils.exposed_decls_db_t>}
-
- The default implementation of the function does nothing.
- """
- map( lambda creator: creator.register_exposed( exposed_db )
- , self._creators )
+
\ No newline at end of file
Modified: pyplusplus_dev/pyplusplus/code_creators/enum.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/enum.py 2007-11-20 21:25:05 UTC (rev 1161)
+++ pyplusplus_dev/pyplusplus/code_creators/enum.py 2007-11-20 21:25:57 UTC (rev 1162)
@@ -66,7 +66,3 @@
def _get_system_headers_impl( self ):
return []
-
- def register_exposed( self, exposed_db ):
- """Register exposed declaration in L{exposed data base<utils.exposed_decls_db_t>}"""
- exposed_db.expose( self.declaration )
Modified: pyplusplus_dev/pyplusplus/code_creators/exception_translator.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/exception_translator.py 2007-11-20 21:25:05 UTC (rev 1161)
+++ pyplusplus_dev/pyplusplus/code_creators/exception_translator.py 2007-11-20 21:25:57 UTC (rev 1162)
@@ -35,11 +35,7 @@
def _get_system_headers_impl( self ):
return []
- def register_exposed( self, exposed_db ):
- """Register exposed declaration in L{exposed data base<utils.exposed_decls_db_t>}"""
- exposed_db.expose( self.declaration )
-
class exception_translator_register_t( registration_based.registration_based_t
, declaration_based.declaration_based_t ):
def __init__(self, exception_class, exception_translator):
@@ -59,8 +55,4 @@
def _get_system_headers_impl( self ):
return []
-
- def register_exposed( self, exposed_db ):
- """Register exposed declaration in L{exposed data base<utils.exposed_decls_db_t>}"""
- exposed_db.expose( self.declaration )
-
+
\ No newline at end of file
Modified: pyplusplus_dev/pyplusplus/code_creators/global_variable.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/global_variable.py 2007-11-20 21:25:05 UTC (rev 1161)
+++ pyplusplus_dev/pyplusplus/code_creators/global_variable.py 2007-11-20 21:25:57 UTC (rev 1162)
@@ -33,11 +33,6 @@
def _get_system_headers_impl( self ):
return []
- def register_exposed( self, exposed_db ):
- """Register exposed declaration in L{exposed data base<utils.exposed_decls_db_t>}"""
- exposed_db.expose( self.declaration )
-
-
class global_variable_t( global_variable_base_t ):
"""
Creates boost.python code that exposes global variable.
Modified: pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py 2007-11-20 21:25:05 UTC (rev 1161)
+++ pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py 2007-11-20 21:25:57 UTC (rev 1162)
@@ -52,11 +52,6 @@
def _get_system_headers_impl( self ):
return self.configuration.include_files
- def register_exposed( self, exposed_db ):
- """Register exposed declaration in L{exposed data base<utils.exposed_decls_db_t>}"""
- exposed_db.expose( self.declaration )
-
-
class indexing_suite2_t( registration_based.registration_based_t
, declaration_based.declaration_based_t ):
def __init__(self, container ):
@@ -126,11 +121,6 @@
def _get_system_headers_impl( self ):
return self.declaration.indexing_suite.include_files
- def register_exposed( self, exposed_db ):
- """Register exposed declaration in L{exposed data base<utils.exposed_decls_db_t>}"""
- exposed_db.expose( self.declaration )
-
-
class value_traits_t( code_creator.code_creator_t
, declaration_based.declaration_based_t ):
def __init__( self, value_class ):
@@ -188,8 +178,4 @@
def _get_system_headers_impl( self ):
return ['boost/python/suite/indexing/value_traits.hpp']
-
- def register_exposed( self, exposed_db ):
- """Register exposed declaration in L{exposed data base<utils.exposed_decls_db_t>}"""
- exposed_db.expose( self.declaration )
-
+
\ No newline at end of file
Modified: pyplusplus_dev/pyplusplus/code_creators/member_variable.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/member_variable.py 2007-11-20 21:25:05 UTC (rev 1161)
+++ pyplusplus_dev/pyplusplus/code_creators/member_variable.py 2007-11-20 21:25:57 UTC (rev 1162)
@@ -39,11 +39,6 @@
files.append( self.declaration.setter_call_policies.header_file )
return files
- def register_exposed( self, exposed_db ):
- """Register exposed declaration in L{exposed data base<utils.exposed_decls_db_t>}"""
- exposed_db.expose( self.declaration )
-
-
class member_variable_t( member_variable_base_t ):
"""
Creates boost.python code that exposes member variable.
Modified: pyplusplus_dev/pyplusplus/code_creators/module.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/module.py 2007-11-20 21:25:05 UTC (rev 1161)
+++ pyplusplus_dev/pyplusplus/code_creators/module.py 2007-11-20 21:25:57 UTC (rev 1162)
@@ -18,11 +18,17 @@
The root of the code creator tree is always a module_t object.
"""
- def __init__(self):
+ def __init__(self, global_ns):
"""Constructor.
"""
compound.compound_t.__init__(self)
self.__body = None
+ self.__global_ns = global_ns
+
+ @property
+ def global_ns(self):
+ "reference to global_ns ( namespace_t ) declaration"
+ return self.__global_ns
def _get_include_dirs(self):
include_dirs = algorithm.creator_finder.find_by_class_instance(
Modified: pyplusplus_dev/pyplusplus/code_creators/opaque_type_registrator.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/opaque_type_registrator.py 2007-11-20 21:25:05 UTC (rev 1161)
+++ pyplusplus_dev/pyplusplus/code_creators/opaque_type_registrator.py 2007-11-20 21:25:57 UTC (rev 1162)
@@ -22,8 +22,3 @@
def _get_system_headers_impl( self ):
return []
-
- def register_exposed( self, exposed_db ):
- """Register exposed declaration in L{exposed data base<utils.exposed_decls_db_t>}"""
- exposed_db.expose( self.declaration )
-
Modified: pyplusplus_dev/pyplusplus/code_creators/scoped.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/scoped.py 2007-11-20 21:25:05 UTC (rev 1161)
+++ pyplusplus_dev/pyplusplus/code_creators/scoped.py 2007-11-20 21:25:57 UTC (rev 1162)
@@ -16,9 +16,3 @@
#template method pattern should be used.
raise NotImplementedError()
- def register_exposed( self, exposed_db ):
- """Register exposed declaration in L{exposed data base<utils.exposed_decls_db_t>}"""
- exposed_db.expose( self.declaration )
- map( lambda creator: creator.register_exposed( exposed_db )
- , self._creators )
-
Modified: pyplusplus_dev/pyplusplus/code_creators/smart_pointers.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/smart_pointers.py 2007-11-20 21:25:05 UTC (rev 1161)
+++ pyplusplus_dev/pyplusplus/code_creators/smart_pointers.py 2007-11-20 21:25:57 UTC (rev 1162)
@@ -76,11 +76,6 @@
def _get_system_headers_impl( self ):
return []
-
- def register_exposed( self, exposed_db ):
- """Register exposed declaration in L{exposed data base<utils.exposed_decls_db_t>}"""
- exposed_db.expose( self.declaration )
-
class smart_pointers_converter_t( registration_based.registration_based_t
, declaration_based.declaration_based_t ):
@@ -122,8 +117,4 @@
def _get_system_headers_impl( self ):
return []
-
- def register_exposed( self, exposed_db ):
- """Register exposed declaration in L{exposed data base<utils.exposed_decls_db_t>}"""
- exposed_db.expose( self.declaration )
-
+
\ No newline at end of file
Modified: pyplusplus_dev/pyplusplus/code_creators/unnamed_enum.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/unnamed_enum.py 2007-11-20 21:25:05 UTC (rev 1161)
+++ pyplusplus_dev/pyplusplus/code_creators/unnamed_enum.py 2007-11-20 21:25:57 UTC (rev 1162)
@@ -36,8 +36,4 @@
def _get_system_headers_impl( self ):
return []
-
- def register_exposed( self, exposed_db ):
- """Register exposed declaration in L{exposed data base<utils.exposed_decls_db_t>}"""
- exposed_db.expose( self.declaration )
-
+
\ 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...> - 2007-11-20 21:25:00
|
Revision: 1161
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1161&view=rev
Author: roman_yakovenko
Date: 2007-11-20 13:25:05 -0800 (Tue, 20 Nov 2007)
Log Message:
-----------
small bug fix - allow query to be empty
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py
Modified: pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py
===================================================================
--- pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py 2007-11-20 13:34:25 UTC (rev 1160)
+++ pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py 2007-11-20 21:25:05 UTC (rev 1161)
@@ -325,7 +325,9 @@
def set_constructors_body( self, body ):
"""Sets the body for all constructors"""
- self.constructors().body = body
+ constrs = self.constructors(allow_empty=True, recursive=False)
+ if constrs:
+ constrs.body = body
self.null_constructor_body = body
self.copy_constructor_body = body
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2007-11-20 13:34:21
|
Revision: 1160
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1160&view=rev
Author: roman_yakovenko
Date: 2007-11-20 05:34:25 -0800 (Tue, 20 Nov 2007)
Log Message:
-----------
adding new test case
Modified Paths:
--------------
pygccxml_dev/unittests/data/type_traits.hpp
Modified: pygccxml_dev/unittests/data/type_traits.hpp
===================================================================
--- pygccxml_dev/unittests/data/type_traits.hpp 2007-11-20 07:12:25 UTC (rev 1159)
+++ pygccxml_dev/unittests/data/type_traits.hpp 2007-11-20 13:34:25 UTC (rev 1160)
@@ -11,6 +11,7 @@
#include <iostream>
#include <vector>
#include <set>
+#include <map>
#include "noncopyable.hpp"
#define TYPE_PERMUTATION( BASE, NAME ) \
@@ -82,11 +83,12 @@
struct instantiate_tmpls{
instantiate_tmpls()
- : v(), s()
+ : v(), s(), ms()
{}
std::vector< int > v;
std::set< std::string > s;
+ std::multimap< std::string, std::string > ms;
};
@@ -175,6 +177,7 @@
typedef detail::y_type y_type;
typedef std::vector< int > vector_of_int_type;
typedef std::set< std::string > string_set_type;
+ typedef std::multimap< std::string, std::string > s2s_multimap_type;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|