pygccxml-commit Mailing List for C++ Python language bindings (Page 23)
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...> - 2008-04-09 17:09:59
|
Revision: 1307
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1307&view=rev
Author: roman_yakovenko
Date: 2008-04-09 10:10:03 -0700 (Wed, 09 Apr 2008)
Log Message:
-----------
adding private enums
Modified Paths:
--------------
pygccxml_dev/unittests/data/declarations_enums.hpp
Modified: pygccxml_dev/unittests/data/declarations_enums.hpp
===================================================================
--- pygccxml_dev/unittests/data/declarations_enums.hpp 2008-04-08 18:34:31 UTC (rev 1306)
+++ pygccxml_dev/unittests/data/declarations_enums.hpp 2008-04-09 17:10:03 UTC (rev 1307)
@@ -13,6 +13,10 @@
class data{
public:
enum EColor{ red, green, blue, black, white };
+private:
+ enum EPrivColor{ priv_red, priv_green, priv_blue, priv_black, priv_white };
+
+ void do_smth(EPrivColor x){}
};
} }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-04-08 18:34:38
|
Revision: 1306
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1306&view=rev
Author: roman_yakovenko
Date: 2008-04-08 11:34:31 -0700 (Tue, 08 Apr 2008)
Log Message:
-----------
update history
Modified Paths:
--------------
pyplusplus_dev/docs/history/history.rest
Modified: pyplusplus_dev/docs/history/history.rest
===================================================================
--- pyplusplus_dev/docs/history/history.rest 2008-04-08 18:27:32 UTC (rev 1305)
+++ pyplusplus_dev/docs/history/history.rest 2008-04-08 18:34:31 UTC (rev 1306)
@@ -21,6 +21,7 @@
* Martin Preisler
* Meghana Haridev
* Julian Scheid
+* Oliver Schweitzer
-----------
Version SVN
@@ -133,7 +134,10 @@
and I will introduce such configuration option.
Sorry for inconvenience.
-
+
+2. Few bugs, related to Indeing Suite 2, were fixed. Many thanks to Oliver Schweitzer
+ for reporting them.
+
-------------
Version 0.9.5
-------------
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-04-08 18:27:32
|
Revision: 1305
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1305&view=rev
Author: roman_yakovenko
Date: 2008-04-08 11:27:32 -0700 (Tue, 08 Apr 2008)
Log Message:
-----------
updating docs
Modified Paths:
--------------
pyplusplus_dev/docs/quotes.rest
Modified: pyplusplus_dev/docs/quotes.rest
===================================================================
--- pyplusplus_dev/docs/quotes.rest 2008-04-08 18:01:56 UTC (rev 1304)
+++ pyplusplus_dev/docs/quotes.rest 2008-04-08 18:27:32 UTC (rev 1305)
@@ -51,6 +51,14 @@
David Carpman
+"... I started a few months ago to develop a set of Python bindings for
+OpenCascade modeling/visualization library. After a quick tour to evaluate
+different solutions, my choice lead me to Py++, which is a very convenient
+tool : I was able to achieve the first release of my project only two weeks after
+the project start !"
+
+ Paviot Thomas
+
------------------
Who is using Py++?
------------------
@@ -120,6 +128,12 @@
.. _`Apple Shake API` : http://www.apple.com/shake/
.. _`PyShake` : http://open.rsp.com.au/projects/pyshake
+* Paviot Thomas, the author of `pythonOCC`_ project, is using `Py++`_ to create
+ Python bindings for `OpenCascade`_, a 3D modeling & numerical simulation library.
+
+ .. _`pythonOCC` : http://www.minerva-plm.org/pythonOCC/
+ .. _`OpenCascade` : http://www.opencascade.org/
+
* I am :-). I created Python bindings for next libraries:
* `Boost.Date_Time`_
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-04-08 18:02:02
|
Revision: 1304
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1304&view=rev
Author: roman_yakovenko
Date: 2008-04-08 11:01:56 -0700 (Tue, 08 Apr 2008)
Log Message:
-----------
an attempt to add new test case for implicitly_convertible
Modified Paths:
--------------
pyplusplus_dev/unittests/data/casting_to_be_exported.hpp
Modified: pyplusplus_dev/unittests/data/casting_to_be_exported.hpp
===================================================================
--- pyplusplus_dev/unittests/data/casting_to_be_exported.hpp 2008-04-08 17:56:47 UTC (rev 1303)
+++ pyplusplus_dev/unittests/data/casting_to_be_exported.hpp 2008-04-08 18:01:56 UTC (rev 1304)
@@ -30,6 +30,9 @@
int value;
};
+struct zzzz{
+ operator y const() const { return y(); }
+};
int identity( int z ){ return z; }
@@ -54,4 +57,4 @@
}
}
-#endif//__casting_to_be_exported_hpp__
\ No newline at end of file
+#endif//__casting_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...> - 2008-04-08 17:56:56
|
Revision: 1303
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1303&view=rev
Author: roman_yakovenko
Date: 2008-04-08 10:56:47 -0700 (Tue, 08 Apr 2008)
Log Message:
-----------
bug fix: implicitly_convertible functionality belongs to boost::python namespace and not to the boost::python::class_
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/code_creators/calldef.py
Modified: pyplusplus_dev/pyplusplus/code_creators/calldef.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/calldef.py 2008-04-07 21:45:15 UTC (rev 1302)
+++ pyplusplus_dev/pyplusplus/code_creators/calldef.py 2008-04-08 17:56:47 UTC (rev 1303)
@@ -1078,6 +1078,7 @@
def __init__( self, operator ):
registration_based.registration_based_t.__init__( self )
declaration_based.declaration_based_t.__init__( self, declaration=operator )
+ self.works_on_instance = False
def _create_impl(self):
#TODO add comment in case of non const operator
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-04-07 21:45:08
|
Revision: 1302
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1302&view=rev
Author: roman_yakovenko
Date: 2008-04-07 14:45:15 -0700 (Mon, 07 Apr 2008)
Log Message:
-----------
adding new test case
Modified Paths:
--------------
pyplusplus_dev/unittests/test_all.py
Added Paths:
-----------
pyplusplus_dev/unittests/data/split_module_indexing_suite_bug_to_be_exported.hpp
pyplusplus_dev/unittests/split_module_indexing_suite_bug_tester.py
Added: pyplusplus_dev/unittests/data/split_module_indexing_suite_bug_to_be_exported.hpp
===================================================================
--- pyplusplus_dev/unittests/data/split_module_indexing_suite_bug_to_be_exported.hpp (rev 0)
+++ pyplusplus_dev/unittests/data/split_module_indexing_suite_bug_to_be_exported.hpp 2008-04-07 21:45:15 UTC (rev 1302)
@@ -0,0 +1,30 @@
+// 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 __split_module_indexing_suite_bug_to_be_exported_hpp__
+#define __split_module_indexing_suite_bug_to_be_exported_hpp__
+
+#include <string>
+#include <boost/any.hpp>
+#include <map>
+#include <vector>
+
+
+struct generic_string_map_t
+{
+public:
+ generic_string_map_t() {};
+
+ std::vector<std::string> get_value(std::string key) const{
+ return std::vector<std::string>();
+ }
+
+private:
+ std::map<std::string, boost::any> m_fields;
+
+};
+
+
+#endif//__split_module_indexing_suite_bug_to_be_exported_hpp__
Added: pyplusplus_dev/unittests/split_module_indexing_suite_bug_tester.py
===================================================================
--- pyplusplus_dev/unittests/split_module_indexing_suite_bug_tester.py (rev 0)
+++ pyplusplus_dev/unittests/split_module_indexing_suite_bug_tester.py 2008-04-07 21:45:15 UTC (rev 1302)
@@ -0,0 +1,56 @@
+# 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
+import fundamental_tester_base
+
+from pyplusplus import module_builder
+from pyplusplus.module_builder import call_policies
+
+class tester_t(fundamental_tester_base.fundamental_tester_base_t):
+ EXTENSION_NAME = 'split_module_indexing_suite_bug'
+
+ 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 ):
+ #~ find out what does happen here
+ #string = mb.class_( lambda cls: cls.partial_name.startswith( 'basic_string<' )
+ # and 'wchar_t' not in cls.partial_name )
+ #string.alias = 'string'
+ pass
+
+ 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
+
+ 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 2008-04-07 21:41:50 UTC (rev 1301)
+++ pyplusplus_dev/unittests/test_all.py 2008-04-07 21:45:15 UTC (rev 1302)
@@ -101,6 +101,7 @@
import precompiled_header_tester
import balanced_files_tester
import ft_inout_tester
+import split_module_indexing_suite_bug_tester
testers = [
algorithms_tester
@@ -189,6 +190,7 @@
, ft_inout_tester
, deepcopy_tester
, override_bug_tester
+ , split_module_indexing_suite_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...> - 2008-04-07 21:41:43
|
Revision: 1301
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1301&view=rev
Author: roman_yakovenko
Date: 2008-04-07 14:41:50 -0700 (Mon, 07 Apr 2008)
Log Message:
-----------
bug fix: don't create _xxx_value_traits.pypp.hpp file ( and class ) if the class has both "=" and "<" available operators
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/file_writers/multiple_files.py
pyplusplus_dev/pyplusplus/module_creator/creator.py
Modified: pyplusplus_dev/pyplusplus/file_writers/multiple_files.py
===================================================================
--- pyplusplus_dev/pyplusplus/file_writers/multiple_files.py 2008-04-07 21:38:11 UTC (rev 1300)
+++ pyplusplus_dev/pyplusplus/file_writers/multiple_files.py 2008-04-07 21:41:50 UTC (rev 1301)
@@ -149,6 +149,9 @@
if not class_traits.is_my_case( element_type ):
return None
value_class = class_traits.get_declaration( element_type )
+ if value_class.less_than_comparable and value_class.equality_comparable:
+ return None #Py++ doesn't create value traits for class that has
+ # = and < operators available
return self.create_value_traits_header_name( value_class )
except RuntimeError, error:
decls_logger = _logging_.loggers.declarations
Modified: pyplusplus_dev/pyplusplus/module_creator/creator.py
===================================================================
--- pyplusplus_dev/pyplusplus/module_creator/creator.py 2008-04-07 21:38:11 UTC (rev 1300)
+++ pyplusplus_dev/pyplusplus/module_creator/creator.py 2008-04-07 21:41:50 UTC (rev 1301)
@@ -305,7 +305,9 @@
class_traits = declarations.class_traits
if not ( None is element_type ) and class_traits.is_my_case( element_type ):
value_cls = class_traits.get_declaration( element_type )
- if value_cls not in created_value_traits:
+ has_prerequisits = value_cls.less_than_comparable \
+ and value_cls.equality_comparable
+ if ( not has_prerequisits ) and ( value_cls not in created_value_traits ):
created_value_traits.add( value_cls )
element_type_cc = code_creators.value_traits_t( value_cls )
self.__extmodule.adopt_declaration_creator( element_type_cc )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-04-07 21:38:05
|
Revision: 1300
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1300&view=rev
Author: roman_yakovenko
Date: 2008-04-07 14:38:11 -0700 (Mon, 07 Apr 2008)
Log Message:
-----------
bug fix: class wrapper alias should be created on first use and not always
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 2008-04-07 21:36:54 UTC (rev 1299)
+++ pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py 2008-04-07 21:38:11 UTC (rev 1300)
@@ -177,7 +177,7 @@
self._redefine_operators = False
self._held_type = None
self._noncopyable = None
- self._wrapper_alias = self._generate_valid_name(self.partial_name) + "_wrapper"
+ self._wrapper_alias = None
self._registration_code = []
self._declaration_code = []
self._wrapper_code = []
@@ -224,6 +224,8 @@
+"Default value is calculated, based on information presented in the declarations tree" )
def _get_wrapper_alias( self ):
+ if None is self._wrapper_alias:
+ self._wrapper_alias = self._generate_valid_name(self.partial_name) + "_wrapper"
return self._wrapper_alias
def _set_wrapper_alias( self, walias ):
self._wrapper_alias = walias
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-04-07 21:36:48
|
Revision: 1299
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1299&view=rev
Author: roman_yakovenko
Date: 2008-04-07 14:36:54 -0700 (Mon, 07 Apr 2008)
Log Message:
-----------
bug fix: alias for class should be always valid python name
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py
Modified: pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py
===================================================================
--- pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py 2008-04-07 21:32:23 UTC (rev 1298)
+++ pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py 2008-04-07 21:36:54 UTC (rev 1299)
@@ -80,7 +80,10 @@
else:
self._alias = algorithm.create_valid_name( self.partial_name )
else:
- self._alias = self.partial_name
+ if declarations.is_class( self ) or declarations.is_class_declaration( self ):
+ self._alias = algorithm.create_valid_name( self.partial_name )
+ else:
+ 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...> - 2008-04-07 21:32:16
|
Revision: 1298
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1298&view=rev
Author: roman_yakovenko
Date: 2008-04-07 14:32:23 -0700 (Mon, 07 Apr 2008)
Log Message:
-----------
updating unit tests - don't run msvc specific tests on Linux
Modified Paths:
--------------
pygccxml_dev/unittests/autoconfig.py
pygccxml_dev/unittests/declarations_tester.py
Modified: pygccxml_dev/unittests/autoconfig.py
===================================================================
--- pygccxml_dev/unittests/autoconfig.py 2008-04-07 21:31:33 UTC (rev 1297)
+++ pygccxml_dev/unittests/autoconfig.py 2008-04-07 21:32:23 UTC (rev 1298)
@@ -50,7 +50,7 @@
@staticmethod
def get_pdb_loader():
- if not cxx_parsers_cfg.pdb_loader:
+ if not cxx_parsers_cfg.pdb_loader and sys.platform == 'win32':
from pygccxml.msvc import pdb
pdb_file = os.path.join( data_directory, 'msvc_build', 'Debug', 'msvc_build.pdb' )
cxx_parsers_cfg.pdb_loader = pdb.decl_loader_t( pdb_file )
Modified: pygccxml_dev/unittests/declarations_tester.py
===================================================================
--- pygccxml_dev/unittests/declarations_tester.py 2008-04-07 21:31:33 UTC (rev 1297)
+++ pygccxml_dev/unittests/declarations_tester.py 2008-04-07 21:32:23 UTC (rev 1298)
@@ -3,6 +3,7 @@
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
+import sys
import pprint
import unittest
import autoconfig
@@ -192,9 +193,10 @@
def create_suite():
suite = unittest.TestSuite()
- #~ suite.addTest( unittest.makeSuite(file_by_file_tester_t))
- #~ suite.addTest( unittest.makeSuite(all_at_once_tester_t))
- suite.addTest( unittest.makeSuite(pdb_based_tester_t))
+ suite.addTest( unittest.makeSuite(file_by_file_tester_t))
+ suite.addTest( unittest.makeSuite(all_at_once_tester_t))
+ if sys.platform == 'win32':
+ suite.addTest( unittest.makeSuite(pdb_based_tester_t))
return suite
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-04-07 21:31:27
|
Revision: 1297
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1297&view=rev
Author: roman_yakovenko
Date: 2008-04-07 14:31:33 -0700 (Mon, 07 Apr 2008)
Log Message:
-----------
two bug fixes:
* if class is template instantiation and demangled name doesn't contain '<' char, than something wrong with the demangled name and class should use the normal name
* added support for partial name for std::string and std::wstring classes
Modified Paths:
--------------
pygccxml_dev/pygccxml/declarations/class_declaration.py
Modified: pygccxml_dev/pygccxml/declarations/class_declaration.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/class_declaration.py 2008-04-05 06:42:06 UTC (rev 1296)
+++ pygccxml_dev/pygccxml/declarations/class_declaration.py 2008-04-07 21:31:33 UTC (rev 1297)
@@ -161,8 +161,16 @@
tmp = self.demangled[ len( fname ): ] #demangled::name
if tmp.startswith( '::' ):
tmp = tmp[2:]
- self.cache.demangled_name = tmp
- return tmp
+ if '<' not in tmp and '<' in self._name:
+ #we have template class, but for some reason demangled
+ #name doesn't contain any template
+ #This happens for std::string class, but this breaks
+ #other cases, because this behaviour is not consistent
+ self.cache.demangled_name = self._name
+ return self.cache.demangled_name
+ else:
+ self.cache.demangled_name = tmp
+ return tmp
else:
self.cache.demangled_name = self._name
return self._name
@@ -442,6 +450,12 @@
return None
def _get_partial_name_impl( self ):
- return get_partial_name( self.name )
+ import type_traits #prevent cyclic dependencies
+ if type_traits.is_std_string( self ):
+ return 'string'
+ elif type_traits.is_std_wstring( self ):
+ return 'wstring'
+ else:
+ return get_partial_name( self.name )
class_types = ( class_t, class_declaration_t )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: Roman Y. <rom...@gm...> - 2008-04-07 06:21:20
|
On Mon, Apr 7, 2008 at 9:00 AM, Johnson Lu <joh...@op...> wrote:
> Hi:
>
> I am extending an embedded python using PY++ (a great product, along with
> Boost, IMHO),
Thanks
> my problem is that the C++ function being called from Python
> takes a (wstring) or wchar argument, but the corresponding function
> signature assigned to Python seems to take a regular str. So when I try to
> make a call I get…
>
>
>
> ClassificationOutput.setApplicationName(ClassificationOutput, str)
>
> did not match C++ signature:
>
> setApplicationName(struct ClassificationOutput_wrapper {lvalue}, class
> std::basic_string<unsigne
>
> d short,struct std::char_traits<unsigned short>,class
> std::allocator<unsigned short> > applicationNa
>
> me)
>
> setApplicationName(class ClassificationOutput {lvalue}, class
> std::basic_string<unsigned short,s
>
> truct std::char_traits<unsigned short>,class std::allocator<unsigned short>
> > applicationName)
>
>
>
> And obviously that doesn't work. The funny thing is while python can't pass
> a string into C++, C++ can pass that wchar to Python just fine. This
> simple string exchange seems such common place that it must have been solved
> multiple times before, but I just can't get a handle on how to deal with it.
Can you post small C++ and & Python code that reproduce the problem.
Also what compiler/STL do you use?
Another question: why your string is defined using unsigned short,
instead of wchar_t?
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
|
|
From: Johnson L. <joh...@op...> - 2008-04-07 06:00:58
|
Hi:
I am extending an embedded python using PY++ (a great product, along
with Boost, IMHO), my problem is that the C++ function being called from
Python takes a (wstring) or wchar argument, but the corresponding
function signature assigned to Python seems to take a regular str. So
when I try to make a call I get...
ClassificationOutput.setApplicationName(ClassificationOutput, str)
did not match C++ signature:
setApplicationName(struct ClassificationOutput_wrapper {lvalue},
class std::basic_string<unsigne
d short,struct std::char_traits<unsigned short>,class
std::allocator<unsigned short> > applicationNa
me)
setApplicationName(class ClassificationOutput {lvalue}, class
std::basic_string<unsigned short,s
truct std::char_traits<unsigned short>,class std::allocator<unsigned
short> > applicationName)
And obviously that doesn't work. The funny thing is while python can't
pass a string into C++, C++ can pass that wchar to Python just fine.
This simple string exchange seems such common place that it must have
been solved multiple times before, but I just can't get a handle on how
to deal with it.
Any help is greatly appreciated.
|
|
From: <rom...@us...> - 2008-04-05 06:42:02
|
Revision: 1296
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1296&view=rev
Author: roman_yakovenko
Date: 2008-04-04 23:42:06 -0700 (Fri, 04 Apr 2008)
Log Message:
-----------
another set of improvements to PDB module
Modified Paths:
--------------
pygccxml_dev/pygccxml/msvc/common_utils.py
pygccxml_dev/pygccxml/msvc/pdb/loader.py
pygccxml_dev/unittests/autoconfig.py
pygccxml_dev/unittests/data/msvc_build/all.cpp
pygccxml_dev/unittests/data/msvc_build/msvc_build.vcproj
pygccxml_dev/unittests/declarations_tester.py
pygccxml_dev/unittests/pdb_tester.py
Modified: pygccxml_dev/pygccxml/msvc/common_utils.py
===================================================================
--- pygccxml_dev/pygccxml/msvc/common_utils.py 2008-04-04 19:35:03 UTC (rev 1295)
+++ pygccxml_dev/pygccxml/msvc/common_utils.py 2008-04-05 06:42:06 UTC (rev 1296)
@@ -24,6 +24,17 @@
UNDNAME_NO_IDENT_CHAR_CHECK = 0x10000 #Suppresses check for valid identifier characters.
UNDNAME_NO_PTR64 = 0x20000 #Does not include ptr64 in output.
+ UNDNAME_SCOPES_ONLY = UNDNAME_NO_LEADING_UNDERSCORES \
+ | UNDNAME_NO_MS_KEYWORDS \
+ | UNDNAME_NO_FUNCTION_RETURNS \
+ | UNDNAME_NO_ALLOCATION_MODEL \
+ | UNDNAME_NO_ALLOCATION_LANGUAGE \
+ | UNDNAME_NO_ACCESS_SPECIFIERS \
+ | UNDNAME_NO_THROW_SIGNATURES \
+ | UNDNAME_NO_MEMBER_TYPE \
+ | UNDNAME_NO_ECSU \
+ | UNDNAME_NO_IDENT_CHAR_CHECK
+
#__unDName definition was taken from:
#http://www.tech-archive.net/Archive/VC/microsoft.public.vc.language/2006-02/msg00754.html
msvcrxx = ctypes.CDLL( msvc_cfg.msvcr_path, mode=ctypes.RTLD_GLOBAL)
@@ -44,6 +55,8 @@
def undecorate_name( name, options=None ):
+ if not name:
+ return ''
if options is None:
options = UNDECORATE_NAME_OPTIONS.UNDNAME_NO_ECSU
buffer_size = 1024 * 32
Modified: pygccxml_dev/pygccxml/msvc/pdb/loader.py
===================================================================
--- pygccxml_dev/pygccxml/msvc/pdb/loader.py 2008-04-04 19:35:03 UTC (rev 1295)
+++ pygccxml_dev/pygccxml/msvc/pdb/loader.py 2008-04-05 06:42:06 UTC (rev 1296)
@@ -78,20 +78,9 @@
@utils.cached
def symbols(self):
- def get_name( smbl ):
- if not smbl.name:
- return
- else:
- return msvc_utils.undecorate_name( smbl.name )
- #~ for ch in '@?$':
- #~ if ch in smbl.name:
- #~ return impl_details.undecorate_name( smbl.name )
- #~ else:
- #~ return smbl.name
-
smbls = {}
for smbl in itertools.imap( as_symbol, as_enum_variant( self.symbols_table._NewEnum ) ):
- smbl.uname = get_name( smbl )
+ smbl.uname = msvc_utils.undecorate_name( smbl.name, msvc_utils.UNDECORATE_NAME_OPTIONS.UNDNAME_SCOPES_ONLY )
smbls[ smbl.symIndexId ] = smbl
return smbls
@@ -148,7 +137,11 @@
if index and ( index % 10000 == 0 ):
self.logger.debug( '%d symbols scanned', index )
name_splitter = impl_details.get_name_splitter( smbl.uname )
- names.update( name_splitter.scope_names )
+ for sn in name_splitter.scope_names:
+ if '<' in sn:
+ break
+ else:
+ names.add( sn )
names = list( names )
names.sort()
self.logger.debug( 'looking for scopes - done' )
@@ -157,37 +150,58 @@
self.logger.debug( 'building namespace objects' )
for ns_name in itertools.ifilterfalse( self.__find_udt, names ):
+ self.logger.debug( 'inserting ns "%s" into declarations tree', ns_name )
name_splitter = impl_details.get_name_splitter( ns_name )
if not name_splitter.scope_names:
parent_ns = self.global_ns
else:
- parent_ns = nss[ name_splitter.scope_names[-1] ]
+ parent_ns = nss.get( name_splitter.scope_names[-1], None )
+ if not parent_ns:
+ continue #in this case the parent scope is UDT
ns_decl = declarations.namespace_t( name_splitter.name )
parent_ns.adopt_declaration( ns_decl )
nss[ ns_name ] = ns_decl
+ self.logger.debug( 'inserting ns "%s" into declarations tree - done', ns_name )
self.logger.debug( 'building namespace objects - done' )
self.logger.debug( 'scanning symbols table - done' )
- def __add_class( self, parent, class_decl ):
- class_smbl = class_decl.dia_symbols[0]
- already_added = parent.classes( class_decl.name, recursive=False, allow_empty=True )
+ def __update_decls_tree( self, decl ):
+ smbl = decl.dia_symbols[0]
+ name_splitter = impl_details.get_name_splitter( smbl.uname )
+ if not name_splitter.scope_names:
+ self.__adopt_declaration( self.global_ns, decl )
+ else:
+ parent_name = '::' + name_splitter.scope_names[-1]
+ try:
+ parent = self.global_ns.decl( parent_name )
+ except:
+ declarations.print_declarations( self.global_ns )
+ print 'identifiers:'
+ for index, identifier in enumerate(name_splitter.identifiers):
+ print index, ':', identifier
+ raise
+ self.__adopt_declaration( parent, decl )
+
+ def __adopt_declaration( self, parent, decl ):
+ smbl = decl.dia_symbols[0]
+ already_added = parent.decls( decl.name, decl_type=decl.__class__, recursive=False, allow_empty=True )
if not already_added:
if isinstance( parent, declarations.namespace_t ):
- parent.adopt_declaration( class_decl )
+ parent.adopt_declaration( decl )
else:
- parent.adopt_declaration( class_decl, declarations.ACCESS_TYPES.PUBLIC )
+ parent.adopt_declaration( decl, declarations.ACCESS_TYPES.PUBLIC )
else:
- for decl in already_added:
- for smbl in decl.dia_symbols:
- if self.__are_symbols_equivalent( smbl, class_smbl ):
- decl.dia_symbols.append( class_smbl )
+ for other_decl in already_added:
+ for other_smbl in other_decl.dia_symbols:
+ if self.__are_symbols_equivalent( other_smbl, smbl ):
+ other_decl.dia_symbols.append( smbl )
return
else:
if isinstance( parent, declarations.namespace_t ):
- parent.adopt_declaration( class_decl )
+ parent.adopt_declaration( decl )
else:
- parent.adopt_declaration( class_decl, declarations.ACCESS_TYPES.PUBLIC )
+ parent.adopt_declaration( decl, declarations.ACCESS_TYPES.PUBLIC )
def __load_classes( self ):
classes = {}#unique symbol id : class decl
@@ -211,33 +225,25 @@
, allow_empty=True
, recursive=True )
return bool( found )
-
self.logger.info( 'integrating udt objects with namespaces' )
while classes:
+ to_be_integrated = len( classes )
self.logger.info( 'there are %d classes to go', len( classes ) )
to_be_deleted = filter( does_parent_exist_in_decls_tree, classes.itervalues() )
- for ns_class in to_be_deleted:
- udt_smbl = ns_class.dia_symbols[0]
- name_splitter = impl_details.get_name_splitter( udt_smbl.uname )
- if not name_splitter.scope_names:
- self.__add_class( self.global_ns, ns_class )
- else:
- parent_name = '::' + name_splitter.scope_names[-1]
- try:
- parent = self.global_ns.decl( parent_name )
- except:
- declarations.print_declarations( self.global_ns )
- print 'identifiers:'
- for index, identifier in enumerate(name_splitter.identifiers):
- print index, ':', identifier
- raise
- self.__add_class( parent, ns_class )
- del classes[ ns_class.dia_symbols[0].symIndexId ]
+ map( self.__update_decls_tree, to_be_deleted )
+ map( lambda decl: classes.pop( decl.dia_symbols[0].symIndexId )
+ , to_be_deleted )
+ integrated = to_be_integrated - len( classes )
+ if not integrated:
+ for cls in classes.itervalues():
+ self.logger.debug( 'unable to integrate class "%s"', cls.dia_symbols[0].uname )
+ break
self.logger.info( 'integrating udt objects with namespaces - done' )
def read(self):
self.__load_nss()
self.__load_classes()
+ self.__load_enums()
@property
def dia_global_scope(self):
@@ -277,12 +283,29 @@
self.logger.debug( 'name( "%s" ) is **NOT** UDT symbol' % name )
return None
+ def __load_enums( self ):
+ is_enum = lambda smbl: smbl.symTag == msdia.SymTagEnum
+ self.logger.info( 'building enum objects' )
+ enums_count = 0
+ for enum_smbl in itertools.ifilter( is_enum, self.symbols.itervalues() ):
+ enum_decl = self.__create_enum(enum_smbl)
+ if not enum_decl:
+ continue
+ enums_count += 1
+ self.__update_decls_tree( enum_decl )
+ self.logger.info( 'building enum objects(%d) - done', enums_count )
+ def __update_decl_binary_names( self, decl, smbl ):
+ decl.mangled = iif( smbl.name, smbl.name, '' )
+ decl.demangled = iif( smbl.uname, smbl.uname, '' )
+
def __create_enum( self, enum_smbl ):
- name_splitter = impl_details.get_name_splitter( enum_smbl.name )
+ name_splitter = impl_details.get_name_splitter( enum_smbl.uname )
+ self.logger.debug( 'working on enum %s', enum_smbl.uname )
enum_decl = declarations.enumeration_t( name_splitter.name )
- enum_decl.dia_symbols = [ enum_smbl.symIndexId ]
+ enum_decl.dia_symbols = [ enum_smbl ]
enum_decl.byte_size = enum_smbl.length
+ self.__update_decl_binary_names( enum_decl, enum_smbl )
values = enum_smbl.findChildren( msdia.SymTagData, None, 0 )
for v in itertools.imap(as_symbol, values):
if v.classParent.symIndexId != enum_smbl.symIndexId:
@@ -309,6 +332,5 @@
class_decl.dia_symbols = [class_smbl]
class_decl.class_type = impl_details.guess_class_type(class_smbl.udtKind)
class_decl.byte_size = class_smbl.length
- class_decl.mangled = iif( class_smbl.name, class_smbl.name, '' )
- class_decl.demangled = iif( class_smbl.uname, class_smbl.uname, '' )
+ self.__update_decl_binary_names( class_decl, class_smbl )
return class_decl
Modified: pygccxml_dev/unittests/autoconfig.py
===================================================================
--- pygccxml_dev/unittests/autoconfig.py 2008-04-04 19:35:03 UTC (rev 1295)
+++ pygccxml_dev/unittests/autoconfig.py 2008-04-05 06:42:06 UTC (rev 1296)
@@ -46,6 +46,22 @@
, define_symbols=[ gccxml_version ]
, compiler=compiler )
+ pdb_loader = None
+
+ @staticmethod
+ def get_pdb_loader():
+ if not cxx_parsers_cfg.pdb_loader:
+ from pygccxml.msvc import pdb
+ pdb_file = os.path.join( data_directory, 'msvc_build', 'Debug', 'msvc_build.pdb' )
+ cxx_parsers_cfg.pdb_loader = pdb.decl_loader_t( pdb_file )
+ cxx_parsers_cfg.pdb_loader.read()
+ return cxx_parsers_cfg.pdb_loader
+
+
+def get_pdb_global_ns():
+ return cxx_parsers_cfg.get_pdb_loader().global_ns
+
+
#~ try:
#~ import pydsc
#~ pydsc.include( r'D:\pygccxml_sources\sources\pygccxml_dev' )
Modified: pygccxml_dev/unittests/data/msvc_build/all.cpp
===================================================================
--- pygccxml_dev/unittests/data/msvc_build/all.cpp 2008-04-04 19:35:03 UTC (rev 1295)
+++ pygccxml_dev/unittests/data/msvc_build/all.cpp 2008-04-05 06:42:06 UTC (rev 1296)
@@ -41,3 +41,7 @@
#include "unnamed_ns_bug.hpp"
#include "vector_traits.hpp"
+void use_decls(){
+ declarations::enums::ENumbers enumbers;
+ declarations::enums::data::EColor ecolor;
+}
\ No newline at end of file
Modified: pygccxml_dev/unittests/data/msvc_build/msvc_build.vcproj
===================================================================
--- pygccxml_dev/unittests/data/msvc_build/msvc_build.vcproj 2008-04-04 19:35:03 UTC (rev 1295)
+++ pygccxml_dev/unittests/data/msvc_build/msvc_build.vcproj 2008-04-05 06:42:06 UTC (rev 1296)
@@ -20,7 +20,7 @@
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="4"
+ ConfigurationType="2"
CharacterSet="1"
>
<Tool
@@ -41,6 +41,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
+ InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
MinimalRebuild="true"
@@ -63,12 +64,18 @@
Name="VCPreLinkEventTool"
/>
<Tool
- Name="VCLibrarianTool"
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ GenerateMapFile="true"
+ MapExports="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
+ Name="VCManifestTool"
+ />
+ <Tool
Name="VCXDCMakeTool"
ValidateIntelliSense="true"
/>
@@ -79,6 +86,9 @@
Name="VCFxCopTool"
/>
<Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
Modified: pygccxml_dev/unittests/declarations_tester.py
===================================================================
--- pygccxml_dev/unittests/declarations_tester.py 2008-04-04 19:35:03 UTC (rev 1295)
+++ pygccxml_dev/unittests/declarations_tester.py 2008-04-05 06:42:06 UTC (rev 1296)
@@ -3,7 +3,7 @@
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
-import pprint
+import pprint
import unittest
import autoconfig
import parser_test_case
@@ -13,22 +13,11 @@
from pygccxml.parser import *
from pygccxml.declarations import *
+
class declarations_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.test_files = [ 'declarations_enums.hpp'
- , 'declarations_variables.hpp'
- , 'declarations_calldef.hpp'
- ]
self.global_ns = None
-
- def setUp(self):
- if not declarations_t.global_ns:
- decls = parse( self.test_files, self.config, self.COMPILATION_MODE )
- declarations_t.global_ns = get_global_namespace( decls )
- if not self.global_ns:
- self.global_ns = declarations_t.global_ns
def test_enumeration_t(self):
enum = self.global_ns.enum( 'ENumbers' )
@@ -47,13 +36,13 @@
def test_variables(self):
variables = self.global_ns.namespace( 'variables' )
initialized = self.global_ns.variable( name='initialized' )
-
+
expected_value = None
if '0.9' in initialized.compiler:
expected_value = '10122004ul'
else:
expected_value = '10122004'
-
+
self.failUnless( initialized.value == expected_value
, "there is a difference between expected value( %s ) and real value(%s) of 'initialized' variable" \
% ( expected_value, initialized.value ) )
@@ -147,7 +136,7 @@
#there is nothing to check about constructors - I know the implementation of parser
#In this case it doesn't different from any other function
- def test_operator_symbol(self):
+ def test_operator_symbol(self):
calldefs_operators = ['=', '==' ]
calldefs_cast_operators = ['char *', 'double']
struct_calldefs = self.global_ns.class_( 'calldefs_t')
@@ -168,22 +157,45 @@
self.failUnless( do_smth.has_ellipsis )
do_smth_else = ns.free_fun( 'do_smth_else' )
self.failUnless( do_smth_else.has_ellipsis )
-
-class all_at_once_tester_t( declarations_t ):
+class gccxml_declarations_t( declarations_t ):
+ global_ns = None
+ def __init__(self, *args ):
+ declarations_t.__init__( self, *args )
+ self.test_files = [ 'declarations_enums.hpp'
+ , 'declarations_variables.hpp'
+ , 'declarations_calldef.hpp'
+ ]
+ self.global_ns = None
+
+ def setUp(self):
+ if not gccxml_declarations_t.global_ns:
+ decls = parse( self.test_files, self.config, self.COMPILATION_MODE )
+ gccxml_declarations_t.global_ns = get_global_namespace( decls )
+ if not self.global_ns:
+ self.global_ns = gccxml_declarations_t.global_ns
+
+class all_at_once_tester_t( gccxml_declarations_t ):
COMPILATION_MODE = COMPILATION_MODE.ALL_AT_ONCE
def __init__(self, *args):
- declarations_t.__init__(self, *args)
+ gccxml_declarations_t.__init__(self, *args)
-class file_by_file_tester_t( declarations_t ):
+class file_by_file_tester_t( gccxml_declarations_t ):
COMPILATION_MODE = COMPILATION_MODE.FILE_BY_FILE
def __init__(self, *args):
- declarations_t.__init__(self, *args)
+ gccxml_declarations_t.__init__(self, *args)
+class pdb_based_tester_t( declarations_t ):
+ def __init__(self, *args ):
+ declarations_t.__init__( self, *args )
+ self.global_ns = autoconfig.get_pdb_global_ns()
+
def create_suite():
- suite = unittest.TestSuite()
- suite.addTest( unittest.makeSuite(file_by_file_tester_t))
- suite.addTest( unittest.makeSuite(all_at_once_tester_t))
+ suite = unittest.TestSuite()
+ #~ suite.addTest( unittest.makeSuite(file_by_file_tester_t))
+ #~ suite.addTest( unittest.makeSuite(all_at_once_tester_t))
+ suite.addTest( unittest.makeSuite(pdb_based_tester_t))
+
return suite
def run_suite():
Modified: pygccxml_dev/unittests/pdb_tester.py
===================================================================
--- pygccxml_dev/unittests/pdb_tester.py 2008-04-04 19:35:03 UTC (rev 1295)
+++ pygccxml_dev/unittests/pdb_tester.py 2008-04-05 06:42:06 UTC (rev 1296)
@@ -4,6 +4,7 @@
from pygccxml.msvc import pdb
from pygccxml import declarations
+from pygccxml.msvc import common_utils as msvc_utils
class tester_t( unittest.TestCase ):
def __init__(self, *args):
@@ -38,13 +39,14 @@
print reader.symbols_table.name
reader.read()
#f = file( 'decls.cpp', 'w+' )
- #declarations.print_declarations( reader.global_ns )#, writer=f.write )
- names = []
- for d in reader.global_ns.classes():
- names.append( '{%s}<=====>{%s}' %( d.demangled, d.mangled ) )
- names.sort()
- for name in names:
- print name
+ declarations.print_declarations( reader.global_ns )#, writer=f.write )
+
+ #~ names = []
+ #~ for d in reader.global_ns.classes():
+ #~ names.append( '{%s}<=====>{%s}' %( d.demangled, d.mangled ) )
+ #~ names.sort()
+ #~ f6or name in names:
+ #~ print name
#f.close()
def test_undecorate_name(self):
@@ -62,7 +64,7 @@
for decorated, undecorated in data:
#~ print '\n', pdb.impl_details.undecorate_name( decorated )
#~ print undecorated
- self.failUnless( pdb.impl_details.undecorate_name( decorated ) == undecorated )
+ self.failUnless( msvc_utils.undecorate_name( decorated ) == undecorated )
def create_suite():
suite = unittest.TestSuite()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-04-04 19:35:01
|
Revision: 1295
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1295&view=rev
Author: roman_yakovenko
Date: 2008-04-04 12:35:03 -0700 (Fri, 04 Apr 2008)
Log Message:
-----------
implementing work around for BPL bug
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 2008-04-01 19:05:50 UTC (rev 1294)
+++ pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py 2008-04-04 19:35:03 UTC (rev 1295)
@@ -481,8 +481,43 @@
or all_pure_virtual( f )
, list( not_reimplemented_funcs ) )
+
+ #Boost.Python is not able to call for non-virtual function, from the base
+ #class if there is a virtual function with the same within base class
+ #See override_bug tester for more information
+
+ def buggy_bpl_filter( f ):
+ if f.parent is self:
+ return False
+ if f.access_type != ACCESS_TYPES.PUBLIC:
+ return False
+ if f.virtuality != VIRTUALITY_TYPES.NOT_VIRTUAL:
+ return False
+ #we need to check that we don't have "same" function in this class
+ this_funs = self.decls( name=f.name
+ , decl_type=declarations.calldef_t
+ , recursive=False
+ , allow_empty=True )
+ for this_f in this_funs:
+ if is_same_function( this_f, f ):
+ #there is already the function in the class, so no need to redefined it
+ return False
+ else:
+ return True
+
+ tmp = {} # id : f
+ for redefined_f in functions:
+ #redefined is virtual, I am not interested in virtual functions
+ for rfo in redefined_f.overloads:
+ if id(rfo) in tmp:
+ continue
+ if buggy_bpl_filter( rfo ):
+ tmp[ id(rfo) ] = rfo
+ functions.extend( tmp.values() )
+
functions.sort( cmp=lambda f1, f2: cmp( ( f1.name, f1.location.as_tuple() )
, ( f2.name, f2.location.as_tuple() ) ) )
+
self._redefined_funcs = functions
return self._redefined_funcs
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-04-01 19:05:44
|
Revision: 1294
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1294&view=rev
Author: roman_yakovenko
Date: 2008-04-01 12:05:50 -0700 (Tue, 01 Apr 2008)
Log Message:
-----------
adding new test cases
Modified Paths:
--------------
pyplusplus_dev/unittests/data/override_bug_to_be_exported.hpp
pyplusplus_dev/unittests/override_bug_tester.py
Modified: pyplusplus_dev/unittests/data/override_bug_to_be_exported.hpp
===================================================================
--- pyplusplus_dev/unittests/data/override_bug_to_be_exported.hpp 2008-03-31 16:18:12 UTC (rev 1293)
+++ pyplusplus_dev/unittests/data/override_bug_to_be_exported.hpp 2008-04-01 19:05:50 UTC (rev 1294)
@@ -13,8 +13,11 @@
class A
{
public:
+
virtual int foo() const {return int('a');}
int foo( int a, int b ) { return a + b;}
+
+ int ddd(){ return 111;}
virtual ~A(){}
};
@@ -22,6 +25,12 @@
{
};
+class D: public B
+{
+public:
+ int foo( int a, int b ){ return a*b; }
+};
+
inline int invoke_foo( const A& a ){
return a.foo();
};
@@ -88,7 +97,7 @@
void do_nothing() {}
};
-}
+}
#endif//__final_classes_to_be_exported_hpp__
Modified: pyplusplus_dev/unittests/override_bug_tester.py
===================================================================
--- pyplusplus_dev/unittests/override_bug_tester.py 2008-03-31 16:18:12 UTC (rev 1293)
+++ pyplusplus_dev/unittests/override_bug_tester.py 2008-04-01 19:05:50 UTC (rev 1294)
@@ -11,9 +11,9 @@
class tester_t(fundamental_tester_base.fundamental_tester_base_t):
EXTENSION_NAME = 'override_bug'
-
+
def __init__( self, *args ):
- fundamental_tester_base.fundamental_tester_base_t.__init__(
+ fundamental_tester_base.fundamental_tester_base_t.__init__(
self
, tester_t.EXTENSION_NAME
, *args )
@@ -26,15 +26,15 @@
do_smth = mb.mem_fun( '::override_bug::BB::do_smth' )
do_smth.add_transformation( FT.output(0), FT.output(1), alias='do_smth_b' )
mb.class_( 'XX' ).mem_fun( 'do_smth' ).exclude()
-
- def run_tests(self, module):
+
+ def run_tests(self, module):
class C( module.B ):
def __init__( self ):
module.B.__init__( self )
def foo( self ):
return ord( 'c' )
self.failUnless( ord('c') == module.invoke_foo( C() ) )
-
+
class Derived4(module.Derived3):
def __init__( self ):
module.Derived3.__init__( self )
@@ -42,14 +42,14 @@
return 3
def eval_c(self):
return 300 # ignored because eval_c excluded
-
+
self.failUnless( 22223 == module.eval( Derived4() ) )
-
+
bb = module.BB()
print dir( bb )
x = bb.do_smth_b()
self.failUnless( x[0] == x[1] == ord( 'b' ) )
-
+
# Notes:
# would return 22222 before any patch, since Derived3 wouldn't have a wrapper
# would return 22123 with my original "ignore" handling and a list
@@ -58,9 +58,15 @@
# would return ????3 (1s in some locations and 2s in others because of
# hashing) if set wouldn't be replaced by a list
# would return 11113 if protected virtual methods wouldn't be included
+
+ b = module.B()
+ self.failUnless( 7 == b.foo( 3,4))
+ d = module.D()
+ self.failUnless( 12 == d.foo(3,4) )
+
def create_suite():
- suite = unittest.TestSuite()
+ suite = unittest.TestSuite()
suite.addTest( unittest.makeSuite(tester_t))
return suite
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-03-31 16:18:07
|
Revision: 1293
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1293&view=rev
Author: roman_yakovenko
Date: 2008-03-31 09:18:12 -0700 (Mon, 31 Mar 2008)
Log Message:
-----------
adding new test case
Modified Paths:
--------------
pyplusplus_dev/unittests/data/override_bug_to_be_exported.hpp
Modified: pyplusplus_dev/unittests/data/override_bug_to_be_exported.hpp
===================================================================
--- pyplusplus_dev/unittests/data/override_bug_to_be_exported.hpp 2008-03-26 20:36:42 UTC (rev 1292)
+++ pyplusplus_dev/unittests/data/override_bug_to_be_exported.hpp 2008-03-31 16:18:12 UTC (rev 1293)
@@ -14,6 +14,7 @@
{
public:
virtual int foo() const {return int('a');}
+ int foo( int a, int b ) { return a + b;}
virtual ~A(){}
};
@@ -79,7 +80,7 @@
class YY : public XX{
public:
- virtual int do_smth() {};
+ virtual void do_smth() {};
};
class ZZ : private YY{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-03-26 20:36:40
|
Revision: 1292
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1292&view=rev
Author: roman_yakovenko
Date: 2008-03-26 13:36:42 -0700 (Wed, 26 Mar 2008)
Log Message:
-----------
another set of changes - sync bsc & pdb outputs
Modified Paths:
--------------
pygccxml_dev/pygccxml/declarations/class_declaration.py
pygccxml_dev/pygccxml/msvc/bsc/__init__.py
pygccxml_dev/pygccxml/msvc/pdb/enums.py
pygccxml_dev/pygccxml/msvc/pdb/impl_details.py
pygccxml_dev/pygccxml/msvc/pdb/loader.py
pygccxml_dev/unittests/bsc_tester.py
pygccxml_dev/unittests/pdb_tester.py
Added Paths:
-----------
pygccxml_dev/pygccxml/msvc/common_utils.py
Modified: pygccxml_dev/pygccxml/declarations/class_declaration.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/class_declaration.py 2008-03-25 21:34:35 UTC (rev 1291)
+++ pygccxml_dev/pygccxml/declarations/class_declaration.py 2008-03-26 20:36:42 UTC (rev 1292)
@@ -34,7 +34,7 @@
def get_partial_name( name ):
import templates
import container_traits #prevent cyclic dependencies
- ct = container_traits.find_container_traits( name )
+ ct = container_traits.find_container_traits( name )
if ct:
return ct.remove_defaults( name )
elif templates.is_instantiation( name ):
@@ -44,8 +44,8 @@
return templates.join( tmpl_name, args )
else:
return name
-
+
class hierarchy_info_t( object ):
"""describes class relationship"""
def __init__(self, related_class=None, access=None ):
@@ -98,14 +98,14 @@
self._aliases = []
self._container_traits = None
self._container_traits_set = False
-
+
def _get__cmp__items(self):
"""implementation details"""
return []
-
+
def i_depend_on_them( self, recursive=True ):
return []
-
+
def _get_aliases(self):
return self._aliases
def _set_aliases( self, new_aliases ):
@@ -119,12 +119,12 @@
if self._container_traits_set == False:
import container_traits #prevent cyclic dependencies
self._container_traits_set = True
- self._container_traits = container_traits.find_container_traits( self )
+ self._container_traits = container_traits.find_container_traits( self )
return self._container_traits
-
+
def _get_partial_name_impl( self ):
return get_partial_name( self.name )
-
+
class class_t( scopedef.scopedef_t ):
"""describes class definition"""
@@ -143,7 +143,7 @@
self._protected_members = []
self._aliases = []
self._byte_size = 0
- self._byte_align = 0
+ self._byte_align = 0
self._container_traits = None
self._container_traits_set = False
self._recursive_bases = None
@@ -152,7 +152,7 @@
def _get_name_impl( self ):
if not self._name: #class with empty name
return self._name
- elif class_t.USE_DEMANGLED_AS_NAME and self.demangled:
+ elif class_t.USE_DEMANGLED_AS_NAME and self.demangled and 'GCC' in self.compiler:
if not self.cache.demangled_name:
fname = algorithm.full_name( self.parent )
if fname.startswith( '::' ) and not self.demangled.startswith( '::' ):
@@ -408,14 +408,14 @@
def i_depend_on_them( self, recursive=True ):
report_dependency = lambda *args: dependencies.dependency_info_t( self, *args )
answer = []
-
+
map( lambda base: answer.append( report_dependency( base.related_class, base.access_type ) )
, self.bases )
-
+
if recursive:
map( lambda access_type: answer.extend( self.__find_out_member_dependencies( access_type ) )
, ACCESS_TYPES.ALL )
-
+
return answer
@property
@@ -424,7 +424,7 @@
if self._container_traits_set == False:
import container_traits #prevent cyclic dependencies
self._container_traits_set = True
- self._container_traits = container_traits.find_container_traits( self )
+ self._container_traits = container_traits.find_container_traits( self )
return self._container_traits
def find_copy_constructor( self ):
@@ -433,7 +433,7 @@
return copy_[0]
else:
return None
-
+
def find_trivial_constructor( self ):
trivial = self.constructors( lambda x: x.is_trivial_constructor, recursive=False, allow_empty=True )
if trivial:
Modified: pygccxml_dev/pygccxml/msvc/bsc/__init__.py
===================================================================
--- pygccxml_dev/pygccxml/msvc/bsc/__init__.py 2008-03-25 21:34:35 UTC (rev 1291)
+++ pygccxml_dev/pygccxml/msvc/bsc/__init__.py 2008-03-26 20:36:42 UTC (rev 1292)
@@ -1,8 +1,8 @@
import os
import sys
import logging
-
from c_wrapper import *
+from .. import common_utils as msvc_utils
class definition_t(object):
#represents some other symbol
@@ -13,7 +13,7 @@
@property
def def_id(self):
return self.__def_id
-
+
@utils.cached
def location( self ):
module = STRING()
@@ -21,18 +21,18 @@
if not BSCIdefInfo( self.__bsc, self.def_id, byref( module ), byref( line ) ):
raise RuntimeError( "Unable to load information about instance(%s)" % str( self.__def_id ) )
return (module, line)
-
- @utils.cached
+
+ @utils.cached
def file_name(self):
return self.location[0].value
- @utils.cached
+ @utils.cached
def line(self):
return self.location[1].value
-
- def __str__( self ):
+
+ def __str__( self ):
return self.file_name + ': %d' % self.line + ' name: %s' % self.as_instance.name
-
+
@utils.cached
def as_instance(self):
return self.__bsc.create_instance( BSCIinstFrIdef( self.__bsc, self.def_id) )
@@ -46,7 +46,7 @@
@property
def inst_id(self):
return self.__inst_id
-
+
@utils.cached
def name_type_attribute_mangled_name( self ):
name = STRING()
@@ -54,135 +54,143 @@
attribute = ATR()
if not BSCIinstInfo( self.__bsc, self.inst_id, byref( name ), byref( typ ), byref( attribute ) ):
raise RuntimeError( "Unable to load information about instance(%s)" % str( self.__inst_id ) )
- undecorated_name = BSCFormatDname( self.__bsc, name )
+ undecorated_name = msvc_utils.undecorate_name( name.value )
+ if undecorated_name.startswith( ' ?? ' ):
+ undecorated_name = undecorated_name[4:]
+ #BSCFormatDname( self.__bsc, name )
return undecorated_name, typ, attribute, name.value
-
-
- @utils.cached
+
+ @utils.cached
def mangled_name(self):
return self.name_type_attribute_mangled_name[3]
-
- @utils.cached
+
+ @utils.cached
def name(self):
return self.name_type_attribute_mangled_name[0]
- @utils.cached
+ @utils.cached
def type(self):
return self.name_type_attribute_mangled_name[1].value
- @utils.cached
+ @utils.cached
def attribute(self):
return self.name_type_attribute_mangled_name[2].value
-
- def __str__( self ):
+
+ @utils.cached
+ def is_class(self):
+ return self.type in [ enums.TYPES.STRUCNAM
+ , enums.TYPES.UNIONNAM
+ , enums.TYPES.CLASSNAM ]
+
+ def __str__( self ):
tmp = []
if enums.TYPES.has_value( self.type ):
tmp.append( 'type( "%s" )' % enums.TYPES.name_of( self.type ) )
if enums.ATTRIBUTES.has_value( self.attribute ):
- tmp.append( 'attribute( "%s" )' % enums.ATTRIBUTES.name_of( self.attribute ) )
- tmp.append( 'name( "%s" )' % self.name )
- tmp.append( 'mangled name( "%s" )' % self.mangled_name )
+ tmp.append( 'attribute( "%s" )' % enums.ATTRIBUTES.name_of( self.attribute ) )
+ tmp.append( 'name( "%s" )' % self.name )
+ tmp.append( 'mangled name( "%s" )' % self.mangled_name )
return ', '.join( tmp )
-
-
+
+
@utils.cached
def definitions( self ):
- definitions_len = ULONG(0)
+ definitions_len = ULONG(0)
definitions_ids = pointer( IDEF() )
-
+
if not BSCGetDefArray( self.__bsc, self.inst_id, byref( definitions_ids ), byref( definitions_len ) ):
raise RuntimeError( "Unable to call BSCGetDefArray" )
-
+
definitions = map( lambda i: definition_t( definitions_ids[i], self.__bsc )
, range( definitions_len.value ) )
-
- BSCDisposeArray( self.__bsc, definitions_ids )
+
+ BSCDisposeArray( self.__bsc, definitions_ids )
return definitions
-
+
@utils.cached
def members( self ):
- instances_len = ULONG(0)
+ instances_len = ULONG(0)
instances_ids = pointer( IINST() )
-
+
if not BSCGetMembersArray( self.__bsc, self.inst_id, enums.MBF.ALL, byref( instances_ids ), byref( instances_len ) ):
raise RuntimeError( "Unable to call BSCGetMembersArray" )
-
+
instances = map( lambda i: self.__bsc.create_instance( instances_ids[i] )
, range( instances_len.value ) )
-
- BSCDisposeArray( self.__bsc, instances_ids )
+
+ BSCDisposeArray( self.__bsc, instances_ids )
return instances
@utils.cached
def used_symbols(self):
- instances_len = ULONG(0)
+ instances_len = ULONG(0)
instances_ids = pointer( IINST() )
if not BSCGetUsesArray( self.__bsc, self.inst_id, enums.MBF.ALL, byref( instances_ids ), byref( instances_len ) ):
raise RuntimeError( "Unable to call BSCGetUsesArray" )
-
+
instances = map( lambda i: self.__bsc.create_instance( instances_ids[i] )
, range( instances_len.value ) )
-
- BSCDisposeArray( self.__bsc, instances_ids )
+
+ BSCDisposeArray( self.__bsc, instances_ids )
return instances
@utils.cached
def base_classes(self):
- instances_len = ULONG(0)
+ instances_len = ULONG(0)
instances_ids = pointer( IINST() )
if not BSCGetBaseArray( self.__bsc, self.inst_id, byref( instances_ids ), byref( instances_len ) ):
raise RuntimeError( "Unable to call BSCGetBaseArray" )
-
+
instances = map( lambda i: self.__bsc.create_instance( instances_ids[i] )
, range( instances_len.value ) )
-
- BSCDisposeArray( self.__bsc, instances_ids )
+
+ BSCDisposeArray( self.__bsc, instances_ids )
return instances
@utils.cached
def derived_classes(self):
- instances_len = ULONG(0)
+ instances_len = ULONG(0)
instances_ids = pointer( IINST() )
if not BSCGetDervArray( self.__bsc, self.inst_id, byref( instances_ids ), byref( instances_len ) ):
raise RuntimeError( "Unable to call BSCGetDervArray" )
-
+
instances = map( lambda i: self.__bsc.create_instance( instances_ids[i] )
, range( instances_len.value ) )
-
- BSCDisposeArray( self.__bsc, instances_ids )
+
+ BSCDisposeArray( self.__bsc, instances_ids )
return instances
class module_t(object):
- #represents file
+ #represents file
def __init__( self, mod_id, bsc ):
self.__bsc = bsc
self.__mod_id = mod_id
-
+
@property
def mod_id( self ):
- return self.__mod_id
-
+ return self.__mod_id
+
@utils.cached
def path( self ):
name = STRING()
BSCImodInfo(self.__bsc, self.__mod_id, byref(name))
return name.value
-
+
@utils.cached
- def instances( self ):
- instances_len = ULONG(0)
+ def instances( self ):
+ instances_len = ULONG(0)
instances_ids = pointer( IINST() )
-
+
if not BSCGetModuleContents( self.__bsc, self.mod_id, enums.MBF.ALL, byref( instances_ids ), byref( instances_len ) ):
raise RuntimeError( "Unable to call BSCGetModuleContents" )
-
+
instances = map( lambda i: self.__bsc.create_instance( instances_ids[i] )
, range( instances_len.value ) )
-
- BSCDisposeArray( self.__bsc, instances_ids )
+
+ BSCDisposeArray( self.__bsc, instances_ids )
return instances
class reader_t( object ):
@@ -190,14 +198,18 @@
self.logger = utils.loggers.pdb_reader
self.logger.setLevel(logging.INFO)
- self.__bsc_file = bsc_file
+ self.__bsc_file = bsc_file
self.__bsc = pointer( Bsc() )
if not BSCOpen( self.__bsc_file, byref( self.__bsc ) ):
raise RuntimeError( "Unable to open bsc file '%s'" % self.__bsc_file )
-
+
self.__instances_cache = {} #inst id : instance_t
self.__bsc.create_instance = lambda inst_id: self.__create_instance( inst_id )
-
+
+ @utils.cached
+ def instances(self):
+ return self.__instances_cache.values()
+
def __create_instance( self, inst_id ):
try:
return self.__instances_cache[ inst_id ]
@@ -205,9 +217,9 @@
inst = instance_t( inst_id, self.__bsc )
self.__instances_cache[ inst_id ] = inst
return inst
-
+
def load_instances( self ):
- instances_len = ULONG(0)
+ instances_len = ULONG(0)
instances_ids = pointer( IINST() )
if not BSCGetAllGlobalsArray( self.__bsc, enums.MBF.ALL, byref( instances_ids ), byref( instances_len ) ):
@@ -215,35 +227,35 @@
for i in range( instances_len.value ):
self.__create_instance( instances_ids[i] )
-
- BSCDisposeArray( self.__bsc, instances_ids )
-
+
+ BSCDisposeArray( self.__bsc, instances_ids )
+
@utils.cached
def is_case_sensitive( self ):
return bool( BSCFCaseSensitive( self.__bsc ) )
-
+
@utils.cached
def files(self):
- module_ids = pointer( IMOD() )
+ module_ids = pointer( IMOD() )
module_len = ULONG()
bs = BSC_STAT()
-
+
if not BSCGetAllModulesArray( self.__bsc, module_ids, byref(module_len) ):
- raise RuntimeError( "Unable to load all modules" )
-
+ raise RuntimeError( "Unable to load all modules" )
+
modules = map( lambda i: module_t( module_ids[i], self.__bsc )
, range( module_len.value ) )
BSCDisposeArray( self.__bsc, module_ids )
-
+
return modules
-
+
def print_stat( self ):
stat = BSC_STAT()
BSCGetStatistics( self.__bsc, byref( stat ) )
for f, t in stat._fields_:
print '%s: %s' % ( f, str( getattr( stat, f) ) )
-
+
def print_classes(self, file_name=None):
for m in self.files:
if file_name and m.path != file_name:
@@ -273,7 +285,7 @@
print '\t\t\tDerived classes:'
for derived_class in inst.derived_classes:
print '\t\t\t\t', str( derived_class )
-
+
def __del__( self ):
if self.__bsc:
BSCClose( self.__bsc )
Added: pygccxml_dev/pygccxml/msvc/common_utils.py
===================================================================
--- pygccxml_dev/pygccxml/msvc/common_utils.py (rev 0)
+++ pygccxml_dev/pygccxml/msvc/common_utils.py 2008-03-26 20:36:42 UTC (rev 1292)
@@ -0,0 +1,57 @@
+import ctypes
+import ctypes.wintypes
+import config as msvc_cfg
+
+class UNDECORATE_NAME_OPTIONS:
+ UNDNAME_COMPLETE = 0x0000 #Enables full undecoration.
+ UNDNAME_NO_LEADING_UNDERSCORES = 0x0001 #Removes leading underscores from Microsoft extended keywords.
+ UNDNAME_NO_MS_KEYWORDS = 0x0002 #Disables expansion of Microsoft extended keywords.
+ UNDNAME_NO_FUNCTION_RETURNS = 0x0004 #Disables expansion of return type for primary declaration.
+ UNDNAME_NO_ALLOCATION_MODEL = 0x0008 #Disables expansion of the declaration model.
+ UNDNAME_NO_ALLOCATION_LANGUAGE = 0x0010 #Disables expansion of the declaration language specifier.
+ UNDNAME_RESERVED1 = 0x0020 #RESERVED.
+ UNDNAME_RESERVED2 = 0x0040 #RESERVED.
+ UNDNAME_NO_THISTYPE = 0x0060 #Disables all modifiers on the this type.
+ UNDNAME_NO_ACCESS_SPECIFIERS = 0x0080 #Disables expansion of access specifiers for members.
+ UNDNAME_NO_THROW_SIGNATURES = 0x0100 #Disables expansion of "throw-signatures" for functions and pointers to functions.
+ UNDNAME_NO_MEMBER_TYPE = 0x0200 #Disables expansion of static or virtual members.
+ UNDNAME_NO_RETURN_UDT_MODEL = 0x0400 #Disables expansion of the Microsoft model for UDT returns.
+ UNDNAME_32_BIT_DECODE = 0x0800 #Undecorates 32-bit decorated names.
+ UNDNAME_NAME_ONLY = 0x1000 #Gets only the name for primary declaration; returns just [scope::]name. Expands template params.
+ UNDNAME_TYPE_ONLY = 0x2000 #Input is just a type encoding; composes an abstract declarator.
+ UNDNAME_HAVE_PARAMETERS = 0x4000 #The real template parameters are available.
+ UNDNAME_NO_ECSU = 0x8000 #Suppresses enum/class/struct/union.
+ UNDNAME_NO_IDENT_CHAR_CHECK = 0x10000 #Suppresses check for valid identifier characters.
+ UNDNAME_NO_PTR64 = 0x20000 #Does not include ptr64 in output.
+
+#__unDName definition was taken from:
+#http://www.tech-archive.net/Archive/VC/microsoft.public.vc.language/2006-02/msg00754.html
+msvcrxx = ctypes.CDLL( msvc_cfg.msvcr_path, mode=ctypes.RTLD_GLOBAL)
+
+free_type = ctypes.CFUNCTYPE( None, ctypes.c_void_p ) #free type
+malloc_type = ctypes.CFUNCTYPE( ctypes.c_void_p, ctypes.c_uint ) #malloc type
+
+
+__unDName = msvcrxx.__unDName
+__unDName.argtypes = [ ctypes.c_char_p #undecorated name
+ , ctypes.c_char_p #decorated name
+ , ctypes.c_int #sizeof undecorated name
+ , malloc_type
+ , free_type
+ , ctypes.c_ushort #flags
+ ]
+__unDName.restype = ctypes.c_char_p
+
+
+def undecorate_name( name, options=None ):
+ if options is None:
+ options = UNDECORATE_NAME_OPTIONS.UNDNAME_NO_ECSU
+ buffer_size = 1024 * 32
+ undecorated_name = ctypes.create_string_buffer('\0' * buffer_size) #should be enouph for any symbol
+ __unDName( undecorated_name
+ , name
+ , buffer_size
+ , malloc_type( msvcrxx.malloc )
+ , free_type( msvcrxx.free )
+ , options )
+ return undecorated_name.value
Modified: pygccxml_dev/pygccxml/msvc/pdb/enums.py
===================================================================
--- pygccxml_dev/pygccxml/msvc/pdb/enums.py 2008-03-25 21:34:35 UTC (rev 1291)
+++ pygccxml_dev/pygccxml/msvc/pdb/enums.py 2008-03-26 20:36:42 UTC (rev 1292)
@@ -20,27 +20,3 @@
nsRegularExpression = nsfRegularExpression | nsfCaseSensitive
nsCaseInRegularExpression = nsfRegularExpression | nsfCaseInsensitive
-
-class UndecorateNameOptions:
- UNDNAME_COMPLETE = 0x0000 #Enables full undecoration.
- UNDNAME_NO_LEADING_UNDERSCORES = 0x0001 #Removes leading underscores from Microsoft extended keywords.
- UNDNAME_NO_MS_KEYWORDS = 0x0002 #Disables expansion of Microsoft extended keywords.
- UNDNAME_NO_FUNCTION_RETURNS = 0x0004 #Disables expansion of return type for primary declaration.
- UNDNAME_NO_ALLOCATION_MODEL = 0x0008 #Disables expansion of the declaration model.
- UNDNAME_NO_ALLOCATION_LANGUAGE = 0x0010 #Disables expansion of the declaration language specifier.
- UNDNAME_RESERVED1 = 0x0020 #RESERVED.
- UNDNAME_RESERVED2 = 0x0040 #RESERVED.
- UNDNAME_NO_THISTYPE = 0x0060 #Disables all modifiers on the this type.
- UNDNAME_NO_ACCESS_SPECIFIERS = 0x0080 #Disables expansion of access specifiers for members.
- UNDNAME_NO_THROW_SIGNATURES = 0x0100 #Disables expansion of "throw-signatures" for functions and pointers to functions.
- UNDNAME_NO_MEMBER_TYPE = 0x0200 #Disables expansion of static or virtual members.
- UNDNAME_NO_RETURN_UDT_MODEL = 0x0400 #Disables expansion of the Microsoft model for UDT returns.
- UNDNAME_32_BIT_DECODE = 0x0800 #Undecorates 32-bit decorated names.
- UNDNAME_NAME_ONLY = 0x1000 #Gets only the name for primary declaration; returns just [scope::]name. Expands template params.
- UNDNAME_TYPE_ONLY = 0x2000 #Input is just a type encoding; composes an abstract declarator.
- UNDNAME_HAVE_PARAMETERS = 0x4000 #The real template parameters are available.
- UNDNAME_NO_ECSU = 0x8000 #Suppresses enum/class/struct/union.
- UNDNAME_NO_IDENT_CHAR_CHECK = 0x10000 #Suppresses check for valid identifier characters.
- UNDNAME_NO_PTR64 = 0x20000 #Does not include ptr64 in output.
-
-
Modified: pygccxml_dev/pygccxml/msvc/pdb/impl_details.py
===================================================================
--- pygccxml_dev/pygccxml/msvc/pdb/impl_details.py 2008-03-25 21:34:35 UTC (rev 1291)
+++ pygccxml_dev/pygccxml/msvc/pdb/impl_details.py 2008-03-26 20:36:42 UTC (rev 1292)
@@ -1,7 +1,4 @@
-import ctypes
from . import enums
-import ctypes.wintypes
-from .. import config as msvc_cfg
from pygccxml import declarations
def guess_class_type( udt_kind ):
@@ -73,40 +70,6 @@
__name_splitters[full_name] = splitter
return splitter
-
-#__unDName definition was taken from:
-#http://www.tech-archive.net/Archive/VC/microsoft.public.vc.language/2006-02/msg00754.html
-msvcrxx = ctypes.CDLL( msvc_cfg.msvcr_path, mode=ctypes.RTLD_GLOBAL)
-
-free_type = ctypes.CFUNCTYPE( None, ctypes.c_void_p ) #free type
-malloc_type = ctypes.CFUNCTYPE( ctypes.c_void_p, ctypes.c_uint ) #malloc type
-
-
-__unDName = msvcrxx.__unDName
-__unDName.argtypes = [ ctypes.c_char_p #undecorated name
- , ctypes.c_char_p #decorated name
- , ctypes.c_int #sizeof undecorated name
- , malloc_type
- , free_type
- , ctypes.c_ushort #flags
- ]
-__unDName.restype = ctypes.c_char_p
-
-
-def undecorate_name( name, options=None ):
- if options is None:
- options = enums.UndecorateNameOptions.UNDNAME_NO_ECSU
- buffer_size = 1024 * 32
- undecorated_name = ctypes.create_string_buffer('\0' * buffer_size) #should be enouph for any symbol
- __unDName( undecorated_name
- , name
- , buffer_size
- , malloc_type( msvcrxx.malloc )
- , free_type( msvcrxx.free )
- , options )
- return undecorated_name.value
-
-
if '__main__' == __name__:
name = "boost::detail::is_base_and_derived_impl2<engine_objects::universal_base_t,engine_objects::erroneous_transactions_file_configuration_t>::Host"
fnsp = full_name_splitter_t( name )
Modified: pygccxml_dev/pygccxml/msvc/pdb/loader.py
===================================================================
--- pygccxml_dev/pygccxml/msvc/pdb/loader.py 2008-03-25 21:34:35 UTC (rev 1291)
+++ pygccxml_dev/pygccxml/msvc/pdb/loader.py 2008-03-26 20:36:42 UTC (rev 1292)
@@ -13,12 +13,19 @@
from ... import utils
from ... import declarations
from .. import config as msvc_cfg
+from .. import common_utils as msvc_utils
msdia = comtypes.client.GetModule( msvc_cfg.msdia_path )
SymTagEnum = 12
msdia.SymTagEnum = 12
+def iif( condition, true_value, false_value ):
+ if condition:
+ return true_value
+ else:
+ return false_value
+
def as_symbol( x ):
return ctypes.cast( x, ctypes.POINTER( msdia.IDiaSymbol ) )
@@ -38,6 +45,7 @@
print 'File: ', f.fileName
class decl_loader_t(object):
+ COMPILER = 'MSVC PDB'
def __init__(self, pdb_file_path ):
self.logger = utils.loggers.pdb_reader
self.logger.setLevel(logging.INFO)
@@ -74,7 +82,7 @@
if not smbl.name:
return
else:
- return impl_details.undecorate_name( smbl.name )
+ return msvc_utils.undecorate_name( smbl.name )
#~ for ch in '@?$':
#~ if ch in smbl.name:
#~ return impl_details.undecorate_name( smbl.name )
@@ -297,7 +305,10 @@
def __create_class( self, class_smbl ):
name_splitter = impl_details.get_name_splitter( class_smbl.uname )
class_decl = declarations.class_t( name_splitter.name )
+ class_decl.compiler = self.COMPILER
+ class_decl.dia_symbols = [class_smbl]
class_decl.class_type = impl_details.guess_class_type(class_smbl.udtKind)
- class_decl.dia_symbols = [class_smbl]
class_decl.byte_size = class_smbl.length
+ class_decl.mangled = iif( class_smbl.name, class_smbl.name, '' )
+ class_decl.demangled = iif( class_smbl.uname, class_smbl.uname, '' )
return class_decl
Modified: pygccxml_dev/unittests/bsc_tester.py
===================================================================
--- pygccxml_dev/unittests/bsc_tester.py 2008-03-25 21:34:35 UTC (rev 1291)
+++ pygccxml_dev/unittests/bsc_tester.py 2008-03-26 20:36:42 UTC (rev 1292)
@@ -7,20 +7,27 @@
class tester_t( unittest.TestCase ):
def __init__(self, *args):
unittest.TestCase.__init__(self, *args)
+ self.bsc_file = os.path.join( autoconfig.data_directory
+ , 'msvc_build'
+ , 'Debug'
+ , 'msvc_build.bsc' )
def test(self):
- control_bsc = os.path.join( autoconfig.data_directory, r'xxx.bsc' )
- reader = bsc.reader_t( control_bsc )
+ reader = bsc.reader_t( self.bsc_file )
reader.print_stat()
print 'is_case_sensitive', reader.is_case_sensitive
reader.load_instances()
- print 'done'
- #reader.files
+ #reader.files
#reader.print_classes( )#r'c:\dev\produce_pdb\produce_pdb.cpp')
+ names = []
+ for inst in reader.instances:
+ names.append( '{%s}<=====>{%s}' % ( inst.name, inst.mangled_name ) )
+ names.sort()
+ for name in names:
+ print name
-
def create_suite():
- suite = unittest.TestSuite()
+ suite = unittest.TestSuite()
suite.addTest( unittest.makeSuite(tester_t))
return suite
@@ -28,4 +35,4 @@
unittest.TextTestRunner(verbosity=2).run( create_suite() )
if __name__ == "__main__":
- run_suite()
\ No newline at end of file
+ run_suite()
Modified: pygccxml_dev/unittests/pdb_tester.py
===================================================================
--- pygccxml_dev/unittests/pdb_tester.py 2008-03-25 21:34:35 UTC (rev 1291)
+++ pygccxml_dev/unittests/pdb_tester.py 2008-03-26 20:36:42 UTC (rev 1292)
@@ -39,6 +39,12 @@
reader.read()
#f = file( 'decls.cpp', 'w+' )
#declarations.print_declarations( reader.global_ns )#, writer=f.write )
+ names = []
+ for d in reader.global_ns.classes():
+ names.append( '{%s}<=====>{%s}' %( d.demangled, d.mangled ) )
+ names.sort()
+ for name in names:
+ print name
#f.close()
def test_undecorate_name(self):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-03-25 21:34:35
|
Revision: 1291
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1291&view=rev
Author: roman_yakovenko
Date: 2008-03-25 14:34:35 -0700 (Tue, 25 Mar 2008)
Log Message:
-----------
milestone - classes and namespaces could be loaded from pdb
Modified Paths:
--------------
pygccxml_dev/pygccxml/msvc/pdb/loader.py
pygccxml_dev/unittests/pdb_tester.py
Modified: pygccxml_dev/pygccxml/msvc/pdb/loader.py
===================================================================
--- pygccxml_dev/pygccxml/msvc/pdb/loader.py 2008-03-24 21:18:46 UTC (rev 1290)
+++ pygccxml_dev/pygccxml/msvc/pdb/loader.py 2008-03-25 21:34:35 UTC (rev 1291)
@@ -73,11 +73,13 @@
def get_name( smbl ):
if not smbl.name:
return
- for ch in '@?$':
- if ch in smbl.name and smbl.undecoratedName:
- return smbl.undecoratedName
else:
- return smbl.name
+ return impl_details.undecorate_name( smbl.name )
+ #~ for ch in '@?$':
+ #~ if ch in smbl.name:
+ #~ return impl_details.undecorate_name( smbl.name )
+ #~ else:
+ #~ return smbl.name
smbls = {}
for smbl in itertools.imap( as_symbol, as_enum_variant( self.symbols_table._NewEnum ) ):
@@ -87,6 +89,7 @@
def __load_nss(self):
def ns_filter( smbl ):
+ self.logger.debug( '__load_ns.ns_filter, %s', smbl.uname )
tags = ( msdia.SymTagFunction
, msdia.SymTagBlock
#I should skipp data, because it requier different treatment
@@ -105,21 +108,29 @@
, msdia.SymTagFunctionArgType
, msdia.SymTagUsingNamespace )
if smbl.symTag not in tags:
+ self.logger.debug( 'smbl.symTag not in tags, %s', smbl.uname )
return False
elif not smbl.name:
+ self.logger.debug( 'not smbl.name, %s', smbl.uname )
return False
+ #~ elif '-' in smbl.name:
+ #~ self.logger.debug( '"-" in smbl.name, %s', smbl.uname )
+ #~ return False
elif smbl.classParent:
- if smbl.classParent.name:
- return False
- parent_smbl = smbl.classParent
+ parent_smbl = self.symbols[ smbl.classParentId ]
while parent_smbl:
if parent_smbl.symTag == msdia.SymTagUDT:
- return False
+ if parent_smbl.uname in smbl.uname:
+ #for some reason std::map is reported as parent of std::_Tree, in source code
+ #std::map derives from std::_Tree. In logical sense parent name is a subset of the child name
+ self.logger.debug( 'parent_smbl.symTag == msdia.SymTagUDT, %s', parent_smbl.uname )
+ return False
+ else:
+ return True
else:
- parent_smbl = parent_smbl.classParent
- elif smbl.name.endswith( '__unnamed' ):
- return False
- return True
+ parent_smbl = self.symbols[ parent_smbl.classParentId ]
+ else:
+ return True
self.logger.debug( 'scanning symbols table' )
@@ -128,9 +139,7 @@
for index, smbl in enumerate( itertools.ifilter( ns_filter, self.symbols.itervalues() ) ):
if index and ( index % 10000 == 0 ):
self.logger.debug( '%d symbols scanned', index )
- if '_Facetptr<std::ctype<char> >' in smbl.name:
- i = 0
- name_splitter = impl_details.get_name_splitter( smbl.name )
+ name_splitter = impl_details.get_name_splitter( smbl.uname )
names.update( name_splitter.scope_names )
names = list( names )
names.sort()
@@ -152,35 +161,69 @@
self.logger.debug( 'scanning symbols table - done' )
+ def __add_class( self, parent, class_decl ):
+ class_smbl = class_decl.dia_symbols[0]
+ already_added = parent.classes( class_decl.name, recursive=False, allow_empty=True )
+ if not already_added:
+ if isinstance( parent, declarations.namespace_t ):
+ parent.adopt_declaration( class_decl )
+ else:
+ parent.adopt_declaration( class_decl, declarations.ACCESS_TYPES.PUBLIC )
+ else:
+ for decl in already_added:
+ for smbl in decl.dia_symbols:
+ if self.__are_symbols_equivalent( smbl, class_smbl ):
+ decl.dia_symbols.append( class_smbl )
+ return
+ else:
+ if isinstance( parent, declarations.namespace_t ):
+ parent.adopt_declaration( class_decl )
+ else:
+ parent.adopt_declaration( class_decl, declarations.ACCESS_TYPES.PUBLIC )
+
def __load_classes( self ):
- classes = {}#unique symbold id : class decl
+ classes = {}#unique symbol id : class decl
is_udt = lambda smbl: smbl.symTag == msdia.SymTagUDT
self.logger.info( 'building udt objects' )
for udt_smbl in itertools.ifilter( is_udt, self.symbols.itervalues() ):
classes[udt_smbl.symIndexId] = self.__create_class(udt_smbl)
self.logger.info( 'building udt objects(%d) - done', len(classes) )
- does_parent_exist = lambda cls_decl: not classes.has_key( cls_decl.dia_symbols[0].classParentId )
+ def does_parent_exist_in_decls_tree( class_decl ):
+ class_smbl = class_decl.dia_symbols[0]
+ if classes.has_key( class_smbl.classParentId ):
+ return False
+ name_splitter = impl_details.get_name_splitter( class_smbl.uname )
+ if not name_splitter.scope_names:
+ return True #global namespace
+ else:
+ parent_name = '::' + name_splitter.scope_names[-1]
+ found = self.global_ns.decls( parent_name
+ , decl_type=declarations.scopedef_t
+ , allow_empty=True
+ , recursive=True )
+ return bool( found )
+
self.logger.info( 'integrating udt objects with namespaces' )
while classes:
self.logger.info( 'there are %d classes to go', len( classes ) )
- to_be_deleted = filter( does_parent_exist, classes.itervalues() )
+ to_be_deleted = filter( does_parent_exist_in_decls_tree, classes.itervalues() )
for ns_class in to_be_deleted:
udt_smbl = ns_class.dia_symbols[0]
- name_splitter = impl_details.get_name_splitter( udt_smbl.name )
+ name_splitter = impl_details.get_name_splitter( udt_smbl.uname )
if not name_splitter.scope_names:
- self.global_ns.adopt_declaration( ns_class )
+ self.__add_class( self.global_ns, ns_class )
else:
parent_name = '::' + name_splitter.scope_names[-1]
- parent = self.global_ns.decls( parent_name, allow_empty=True )
- if not parent:
- self.logger.debug( 'unable to find parent for class %s', udt_smbl.name )
- continue
- parent = parent[0]
- if isinstance( parent, declarations.namespace_t ):
- parent.adopt_declaration( ns_class )
- else:
- parent.adopt_declaration( ns_class, declarations.ACCESS_TYPES.PUBLIC )
+ try:
+ parent = self.global_ns.decl( parent_name )
+ except:
+ declarations.print_declarations( self.global_ns )
+ print 'identifiers:'
+ for index, identifier in enumerate(name_splitter.identifiers):
+ print index, ':', identifier
+ raise
+ self.__add_class( parent, ns_class )
del classes[ ns_class.dia_symbols[0].symIndexId ]
self.logger.info( 'integrating udt objects with namespaces - done' )
@@ -196,15 +239,15 @@
def global_ns(self):
return self.__global_ns
- def __are_symbols_equivalent( self, smbl1_id, smbl2_id ):
- smbl1 = self.__dia_session.symbolById(smbl1_id)
- smbl2 = self.__dia_session.symbolById(smbl2_id)
- result = self.__dia_session.symsAreEquiv( smbl1, smbl2 )
+ def __are_symbols_equivalent( self, smbl1, smbl2 ):
+ result = smbl1.symTag == smbl2.symTag and smbl1.uname == smbl2.uname
+ if not result:
+ result = self.__dia_session.symsAreEquiv( smbl1, smbl2 )
if result:
msg = 'Symbols "%s(%d)" and "%s(%d)" are equivalent.'
else:
msg = 'Symbols "%s(%d)" and "%s(%d)" are NOT equivalent.'
- self.logger.debug( msg, smbl1.name, smbl1_id, smbl2.name, smbl2_id )
+ self.logger.debug( msg, smbl1.uname, smbl1.symIndexId, smbl2.uname, smbl2.symIndexId )
return result
def __find_udt( self, name ):
Modified: pygccxml_dev/unittests/pdb_tester.py
===================================================================
--- pygccxml_dev/unittests/pdb_tester.py 2008-03-24 21:18:46 UTC (rev 1290)
+++ pygccxml_dev/unittests/pdb_tester.py 2008-03-25 21:34:35 UTC (rev 1291)
@@ -33,13 +33,13 @@
]
self.__test_splitter_impl( name, expected_result )
- def __test_create_nss(self):
+ def test_create_nss(self):
reader = pdb.decl_loader_t( self.pdb_file )
print reader.symbols_table.name
reader.read()
- f = file( 'decls.cpp', 'w+' )
- declarations.print_declarations( reader.global_ns )#, writer=f.write )
- f.close()
+ #f = file( 'decls.cpp', 'w+' )
+ #declarations.print_declarations( reader.global_ns )#, writer=f.write )
+ #f.close()
def test_undecorate_name(self):
#basic test, that verify that function wrapper works as expected
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-03-24 21:18:41
|
Revision: 1290
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1290&view=rev
Author: roman_yakovenko
Date: 2008-03-24 14:18:46 -0700 (Mon, 24 Mar 2008)
Log Message:
-----------
adding demangle name functionality
Modified Paths:
--------------
pygccxml_dev/unittests/pdb_tester.py
Modified: pygccxml_dev/unittests/pdb_tester.py
===================================================================
--- pygccxml_dev/unittests/pdb_tester.py 2008-03-24 21:18:29 UTC (rev 1289)
+++ pygccxml_dev/unittests/pdb_tester.py 2008-03-24 21:18:46 UTC (rev 1290)
@@ -33,7 +33,7 @@
]
self.__test_splitter_impl( name, expected_result )
- def test_create_nss(self):
+ def __test_create_nss(self):
reader = pdb.decl_loader_t( self.pdb_file )
print reader.symbols_table.name
reader.read()
@@ -41,6 +41,23 @@
declarations.print_declarations( reader.global_ns )#, writer=f.write )
f.close()
+ def test_undecorate_name(self):
+ #basic test, that verify that function wrapper works as expected
+ data = [
+ # mangled, unmangled
+ ( '?$rebind@D', 'rebind<char>' )
+ , ( '?$rebind@PAU_Node@?$_Tree_nod@V?$_Tmap_traits@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@std@@@2@$0A@@std@@@std@@'
+ , 'rebind<std::_Tree_nod<std::_Tmap_traits<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >,0> >::_Node *>' )
+ , ( '?$rebind@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@'
+ , 'rebind<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >' )
+ , ( '?$rebind@U_Node@?$_Tree_nod@V?$_Tmap_traits@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@std@@@2@$00@std@@@std@@'
+ , 'rebind<std::_Tree_nod<std::_Tmap_traits<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >,1> >::_Node>' )
+ ]
+ for decorated, undecorated in data:
+ #~ print '\n', pdb.impl_details.undecorate_name( decorated )
+ #~ print undecorated
+ self.failUnless( pdb.impl_details.undecorate_name( decorated ) == undecorated )
+
def create_suite():
suite = unittest.TestSuite()
suite.addTest( unittest.makeSuite(tester_t))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-03-24 21:18:23
|
Revision: 1289
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1289&view=rev
Author: roman_yakovenko
Date: 2008-03-24 14:18:29 -0700 (Mon, 24 Mar 2008)
Log Message:
-----------
adding demangle name functionality
Modified Paths:
--------------
pygccxml_dev/pygccxml/msvc/config.py
Modified: pygccxml_dev/pygccxml/msvc/config.py
===================================================================
--- pygccxml_dev/pygccxml/msvc/config.py 2008-03-24 21:17:24 UTC (rev 1288)
+++ pygccxml_dev/pygccxml/msvc/config.py 2008-03-24 21:18:29 UTC (rev 1289)
@@ -5,18 +5,24 @@
import _winreg as win_registry
from distutils import msvccompiler
-class binaries_searcher_t:
-
+class binaries_searcher_t:
+
def get_msbsc_path( self ):
relative_path = os.path.dirname( sys.modules[__name__].__file__)
absolute_path = os.path.abspath (relative_path)
return os.path.join( absolute_path, 'msbsc70.dll' )
-
- def get_msvcr_path( self ):
+
+ def get_msvcr70_path( self ):
relative_path = os.path.dirname( sys.modules[__name__].__file__)
absolute_path = os.path.abspath (relative_path)
return os.path.join( absolute_path, 'msvcr70.dll' )
-
+
+
+ def get_msvcr_path( self ):
+ vss_installed = self.__get_installed_vs_dirs()
+ #TODO: better algorithm to find the path
+ return os.path.join( vss_installed[0], 'vc', 'redist', 'x86', 'microsoft.vc90.crt', 'MSVCR90.DLL' )
+
def get_msdia_path( self ):
vss_installed = self.__get_installed_vs_dirs()
msdia_dlls = self.__get_msdia_dll_paths( vss_installed )
@@ -25,9 +31,9 @@
else:
#TODO find the highest version and use it.
pass
-
+
def __get_msdia_dll_paths( self, vss_installed ):
- msdia_dlls = []
+ msdia_dlls = []
for vs in vss_installed:
debug_dir = os.path.join( vs, 'Common7', 'Packages', 'Debugger' )
files = filter( lambda f: f.startswith( 'msdia' ) and f.endswith( '.dll' )
@@ -38,12 +44,12 @@
if not msdia_dlls:
raise RuntimeError( 'pygccxml unable to find out msdiaXX.dll location' )
return msdia_dlls
-
+
def __get_installed_vs_dirs( self ):
vs_reg_path = 'Software\Microsoft\VisualStudio\SxS\VS7'
values = self.read_values( win_registry.HKEY_LOCAL_MACHINE, vs_reg_path )
return [ values.values()[0] ]
-
+
def read_keys(self, base, key):
return msvccompiler.read_keys(base, key)
@@ -52,10 +58,10 @@
bs = binaries_searcher_t()
-msdia_path = bs.get_msdia_path()
+msdia_path = bs.get_msdia_path()
print 'msdia path: ', msdia_path
-msbsc_path = bs.get_msbsc_path()
+msbsc_path = bs.get_msbsc_path()
print 'msbsc path: ', msbsc_path
msvcr_path = bs.get_msvcr_path()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-03-24 21:17:19
|
Revision: 1288
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1288&view=rev
Author: roman_yakovenko
Date: 2008-03-24 14:17:24 -0700 (Mon, 24 Mar 2008)
Log Message:
-----------
adding demangle name functionality
Modified Paths:
--------------
pygccxml_dev/pygccxml/msvc/pdb/enums.py
pygccxml_dev/pygccxml/msvc/pdb/impl_details.py
pygccxml_dev/pygccxml/msvc/pdb/loader.py
Modified: pygccxml_dev/pygccxml/msvc/pdb/enums.py
===================================================================
--- pygccxml_dev/pygccxml/msvc/pdb/enums.py 2008-03-24 21:15:05 UTC (rev 1287)
+++ pygccxml_dev/pygccxml/msvc/pdb/enums.py 2008-03-24 21:17:24 UTC (rev 1288)
@@ -19,3 +19,28 @@
nsFNameExt = nsfFNameExt
nsRegularExpression = nsfRegularExpression | nsfCaseSensitive
nsCaseInRegularExpression = nsfRegularExpression | nsfCaseInsensitive
+
+
+class UndecorateNameOptions:
+ UNDNAME_COMPLETE = 0x0000 #Enables full undecoration.
+ UNDNAME_NO_LEADING_UNDERSCORES = 0x0001 #Removes leading underscores from Microsoft extended keywords.
+ UNDNAME_NO_MS_KEYWORDS = 0x0002 #Disables expansion of Microsoft extended keywords.
+ UNDNAME_NO_FUNCTION_RETURNS = 0x0004 #Disables expansion of return type for primary declaration.
+ UNDNAME_NO_ALLOCATION_MODEL = 0x0008 #Disables expansion of the declaration model.
+ UNDNAME_NO_ALLOCATION_LANGUAGE = 0x0010 #Disables expansion of the declaration language specifier.
+ UNDNAME_RESERVED1 = 0x0020 #RESERVED.
+ UNDNAME_RESERVED2 = 0x0040 #RESERVED.
+ UNDNAME_NO_THISTYPE = 0x0060 #Disables all modifiers on the this type.
+ UNDNAME_NO_ACCESS_SPECIFIERS = 0x0080 #Disables expansion of access specifiers for members.
+ UNDNAME_NO_THROW_SIGNATURES = 0x0100 #Disables expansion of "throw-signatures" for functions and pointers to functions.
+ UNDNAME_NO_MEMBER_TYPE = 0x0200 #Disables expansion of static or virtual members.
+ UNDNAME_NO_RETURN_UDT_MODEL = 0x0400 #Disables expansion of the Microsoft model for UDT returns.
+ UNDNAME_32_BIT_DECODE = 0x0800 #Undecorates 32-bit decorated names.
+ UNDNAME_NAME_ONLY = 0x1000 #Gets only the name for primary declaration; returns just [scope::]name. Expands template params.
+ UNDNAME_TYPE_ONLY = 0x2000 #Input is just a type encoding; composes an abstract declarator.
+ UNDNAME_HAVE_PARAMETERS = 0x4000 #The real template parameters are available.
+ UNDNAME_NO_ECSU = 0x8000 #Suppresses enum/class/struct/union.
+ UNDNAME_NO_IDENT_CHAR_CHECK = 0x10000 #Suppresses check for valid identifier characters.
+ UNDNAME_NO_PTR64 = 0x20000 #Does not include ptr64 in output.
+
+
Modified: pygccxml_dev/pygccxml/msvc/pdb/impl_details.py
===================================================================
--- pygccxml_dev/pygccxml/msvc/pdb/impl_details.py 2008-03-24 21:15:05 UTC (rev 1287)
+++ pygccxml_dev/pygccxml/msvc/pdb/impl_details.py 2008-03-24 21:17:24 UTC (rev 1288)
@@ -1,5 +1,7 @@
-
+import ctypes
from . import enums
+import ctypes.wintypes
+from .. import config as msvc_cfg
from pygccxml import declarations
def guess_class_type( udt_kind ):
@@ -17,7 +19,7 @@
return declarations.ACCESS_TYPES.PROTECTED
else:
return declarations.ACCESS_TYPES.PUBLIC
-
+
class full_name_splitter_t( object ):
def __init__( self, full_name ):
self.__full_name = full_name
@@ -27,7 +29,7 @@
@property
def name( self ):
return self.__identifiers[-1]
-
+
@property
def scope_names( self ):
if None is self.__scope_identifiers:
@@ -54,14 +56,14 @@
next_token = tmp.pop()
token = token + '::' + next_token
less_count += next_token.count( '<' )
- greater_count += next_token.count( '>' )
- result.append( token )
+ greater_count += next_token.count( '>' )
+ result.append( token )
return result
except Exception, err:
msg = 'Unable to split scope for identifiers. The full scope name is: "%s". Error: %s'
msg = msg % ( self.__full_name, str(err) )
raise RuntimeError( msg )
-
+
__name_splitters = {}
def get_name_splitter( full_name ):
try:
@@ -72,6 +74,39 @@
return splitter
+#__unDName definition was taken from:
+#http://www.tech-archive.net/Archive/VC/microsoft.public.vc.language/2006-02/msg00754.html
+msvcrxx = ctypes.CDLL( msvc_cfg.msvcr_path, mode=ctypes.RTLD_GLOBAL)
+
+free_type = ctypes.CFUNCTYPE( None, ctypes.c_void_p ) #free type
+malloc_type = ctypes.CFUNCTYPE( ctypes.c_void_p, ctypes.c_uint ) #malloc type
+
+
+__unDName = msvcrxx.__unDName
+__unDName.argtypes = [ ctypes.c_char_p #undecorated name
+ , ctypes.c_char_p #decorated name
+ , ctypes.c_int #sizeof undecorated name
+ , malloc_type
+ , free_type
+ , ctypes.c_ushort #flags
+ ]
+__unDName.restype = ctypes.c_char_p
+
+
+def undecorate_name( name, options=None ):
+ if options is None:
+ options = enums.UndecorateNameOptions.UNDNAME_NO_ECSU
+ buffer_size = 1024 * 32
+ undecorated_name = ctypes.create_string_buffer('\0' * buffer_size) #should be enouph for any symbol
+ __unDName( undecorated_name
+ , name
+ , buffer_size
+ , malloc_type( msvcrxx.malloc )
+ , free_type( msvcrxx.free )
+ , options )
+ return undecorated_name.value
+
+
if '__main__' == __name__:
name = "boost::detail::is_base_and_derived_impl2<engine_objects::universal_base_t,engine_objects::erroneous_transactions_file_configuration_t>::Host"
fnsp = full_name_splitter_t( name )
Modified: pygccxml_dev/pygccxml/msvc/pdb/loader.py
===================================================================
--- pygccxml_dev/pygccxml/msvc/pdb/loader.py 2008-03-24 21:15:05 UTC (rev 1287)
+++ pygccxml_dev/pygccxml/msvc/pdb/loader.py 2008-03-24 21:17:24 UTC (rev 1288)
@@ -40,7 +40,7 @@
class decl_loader_t(object):
def __init__(self, pdb_file_path ):
self.logger = utils.loggers.pdb_reader
- self.logger.setLevel(logging.DEBUG)
+ self.logger.setLevel(logging.INFO)
self.logger.debug( 'creating DiaSource object' )
self.__dia_source = comtypes.client.CreateObject( msdia.DiaSource )
self.logger.debug( 'loading pdb file: %s' % pdb_file_path )
@@ -70,8 +70,18 @@
@utils.cached
def symbols(self):
+ def get_name( smbl ):
+ if not smbl.name:
+ return
+ for ch in '@?$':
+ if ch in smbl.name and smbl.undecoratedName:
+ return smbl.undecoratedName
+ else:
+ return smbl.name
+
smbls = {}
for smbl in itertools.imap( as_symbol, as_enum_variant( self.symbols_table._NewEnum ) ):
+ smbl.uname = get_name( smbl )
smbls[ smbl.symIndexId ] = smbl
return smbls
@@ -166,10 +176,11 @@
if not parent:
self.logger.debug( 'unable to find parent for class %s', udt_smbl.name )
continue
- if isinstance( parent[0], declarations.namespace_t ):
+ parent = parent[0]
+ if isinstance( parent, declarations.namespace_t ):
parent.adopt_declaration( ns_class )
else:
- parent[0].adopt_declaration( ns_class, declarations.ACCESS_TYPES.PUBLIC )
+ parent.adopt_declaration( ns_class, declarations.ACCESS_TYPES.PUBLIC )
del classes[ ns_class.dia_symbols[0].symIndexId ]
self.logger.info( 'integrating udt objects with namespaces - done' )
@@ -234,7 +245,6 @@
#between those cases
return None
-
def __create_typedef( self, typedef_smbl ):
name_splitter = impl_details.get_name_splitter( typedef_smbl.name )
typedef_decl = declarations.typedef_t( name_splitter.name )
@@ -242,7 +252,7 @@
return typedef_decl
def __create_class( self, class_smbl ):
- name_splitter = impl_details.get_name_splitter( class_smbl.name )
+ name_splitter = impl_details.get_name_splitter( class_smbl.uname )
class_decl = declarations.class_t( name_splitter.name )
class_decl.class_type = impl_details.guess_class_type(class_smbl.udtKind)
class_decl.dia_symbols = [class_smbl]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-03-24 21:15:11
|
Revision: 1287
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1287&view=rev
Author: roman_yakovenko
Date: 2008-03-24 14:15:05 -0700 (Mon, 24 Mar 2008)
Log Message:
-----------
Modified Paths:
--------------
pygccxml_dev/pygccxml/msvc/bsc/c_wrapper.py
Modified: pygccxml_dev/pygccxml/msvc/bsc/c_wrapper.py
===================================================================
--- pygccxml_dev/pygccxml/msvc/bsc/c_wrapper.py 2008-03-22 22:14:36 UTC (rev 1286)
+++ pygccxml_dev/pygccxml/msvc/bsc/c_wrapper.py 2008-03-24 21:15:05 UTC (rev 1287)
@@ -11,7 +11,7 @@
from ctypes.wintypes import WORD
from ctypes.wintypes import UINT
-from .. import config as msvc_cfg#
+from .. import config as msvc_cfg
from ... import utils #import utils from pygccxml package
STRING = c_char_p
@@ -233,7 +233,7 @@
LszNameFrBob.argtypes = [BOB]
CLS = USHORT
-class enums:
+class enums:
class MBF(utils.enum):
NIL = 0x000
VARS = 0x001
@@ -249,7 +249,7 @@
TEMPLATE = 0x400
NAMESPACE = 0x800
ALL = 0xFFF
-
+
class TYPES(utils.enum):
FUNCTION = 0x01
LABEL = 0x02
@@ -271,14 +271,14 @@
class ATTRIBUTES(utils.enum):
LOCAL = 0x001
- STATIC = 0x002
+ STATIC = 0x002
SHARED = 0x004
NEAR = 0x008
- COMMON = 0x010
+ COMMON = 0x010
DECL_ONLY = 0x020
- PUBLIC = 0x040
- NAMED = 0x080
- MODULE = 0x100
- VIRTUAL = 0x200
+ PUBLIC = 0x040
+ NAMED = 0x080
+ MODULE = 0x100
+ VIRTUAL = 0x200
PRIVATE = 0x400
- PROTECT = 0x800
+ PROTECT = 0x800
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-03-22 22:14:33
|
Revision: 1286
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1286&view=rev
Author: roman_yakovenko
Date: 2008-03-22 15:14:36 -0700 (Sat, 22 Mar 2008)
Log Message:
-----------
adding new functionality
Modified Paths:
--------------
pygccxml_dev/pygccxml/msvc/pdb/__init__.py
pygccxml_dev/pygccxml/msvc/pdb/loader.py
pygccxml_dev/unittests/pdb_tester.py
Removed Paths:
-------------
pygccxml_dev/unittests/pdb_reader.py
Modified: pygccxml_dev/pygccxml/msvc/pdb/__init__.py
===================================================================
--- pygccxml_dev/pygccxml/msvc/pdb/__init__.py 2008-03-22 22:14:05 UTC (rev 1285)
+++ pygccxml_dev/pygccxml/msvc/pdb/__init__.py 2008-03-22 22:14:36 UTC (rev 1286)
@@ -19,4 +19,5 @@
finally:
comtypes.client.gen_dir = comtypes_client_gen_dir
-from loader import decl_loader_t
\ No newline at end of file
+from loader import decl_loader_t
+
Modified: pygccxml_dev/pygccxml/msvc/pdb/loader.py
===================================================================
--- pygccxml_dev/pygccxml/msvc/pdb/loader.py 2008-03-22 22:14:05 UTC (rev 1285)
+++ pygccxml_dev/pygccxml/msvc/pdb/loader.py 2008-03-22 22:14:36 UTC (rev 1286)
@@ -26,8 +26,8 @@
return ctypes.cast( x, ctypes.POINTER( msdia.IDiaTable ) )
def as_enum_symbols( x ):
- return ctypes.cast( x, ctypes.POINTER( msdia.IDiaEnumSymbols ) )
-
+ return ctypes.cast( x, ctypes.POINTER( msdia.IDiaEnumSymbols ) )
+
def as_enum_variant( x ):
return ctypes.cast( x, ctypes.POINTER( comtypes.automation.IEnumVARIANT ) )
@@ -110,9 +110,9 @@
elif smbl.name.endswith( '__unnamed' ):
return False
return True
-
+
self.logger.debug( 'scanning symbols table' )
-
+
self.logger.debug( 'looking for scopes' )
names = set()
for index, smbl in enumerate( itertools.ifilter( ns_filter, self.symbols.itervalues() ) ):
@@ -120,14 +120,14 @@
self.logger.debug( '%d symbols scanned', index )
if '_Facetptr<std::ctype<char> >' in smbl.name:
i = 0
- name_splitter = impl_details.get_name_splitter( smbl.name )
+ name_splitter = impl_details.get_name_splitter( smbl.name )
names.update( name_splitter.scope_names )
names = list( names )
names.sort()
self.logger.debug( 'looking for scopes - done' )
-
+
nss = {'': self.__global_ns}
-
+
self.logger.debug( 'building namespace objects' )
for ns_name in itertools.ifilterfalse( self.__find_udt, names ):
name_splitter = impl_details.get_name_splitter( ns_name )
@@ -139,11 +139,43 @@
parent_ns.adopt_declaration( ns_decl )
nss[ ns_name ] = ns_decl
self.logger.debug( 'building namespace objects - done' )
-
+
self.logger.debug( 'scanning symbols table - done' )
+
+ def __load_classes( self ):
+ classes = {}#unique symbold id : class decl
+ is_udt = lambda smbl: smbl.symTag == msdia.SymTagUDT
+ self.logger.info( 'building udt objects' )
+ for udt_smbl in itertools.ifilter( is_udt, self.symbols.itervalues() ):
+ classes[udt_smbl.symIndexId] = self.__create_class(udt_smbl)
+ self.logger.info( 'building udt objects(%d) - done', len(classes) )
+
+ does_parent_exist = lambda cls_decl: not classes.has_key( cls_decl.dia_symbols[0].classParentId )
+ self.logger.info( 'integrating udt objects with namespaces' )
+ while classes:
+ self.logger.info( 'there are %d classes to go', len( classes ) )
+ to_be_deleted = filter( does_parent_exist, classes.itervalues() )
+ for ns_class in to_be_deleted:
+ udt_smbl = ns_class.dia_symbols[0]
+ name_splitter = impl_details.get_name_splitter( udt_smbl.name )
+ if not name_splitter.scope_names:
+ self.global_ns.adopt_declaration( ns_class )
+ else:
+ parent_name = '::' + name_splitter.scope_names[-1]
+ parent = self.global_ns.decls( parent_name, allow_empty=True )
+ if not parent:
+ self.logger.debug( 'unable to find parent for class %s', udt_smbl.name )
+ continue
+ if isinstance( parent[0], declarations.namespace_t ):
+ parent.adopt_declaration( ns_class )
+ else:
+ parent[0].adopt_declaration( ns_class, declarations.ACCESS_TYPES.PUBLIC )
+ del classes[ ns_class.dia_symbols[0].symIndexId ]
+ self.logger.info( 'integrating udt objects with namespaces - done' )
+
def read(self):
self.__load_nss()
- #self.__populate_scopes()
+ self.__load_classes()
@property
def dia_global_scope(self):
@@ -183,50 +215,7 @@
self.logger.debug( 'name( "%s" ) is **NOT** UDT symbol' % name )
return None
- def __list_main_classes( self ):
- #in this context main classes, are classes that were defined within a namespace
- #as opposite to the classes defined in other classes
- classes = []
- dia_classes = self.dia_global_scope.findChildren( msdia.SymTagUDT, None, 0 )
- for dia_class in itertools.imap(as_symbol, dia_classes ):
- name_splitter = impl_details.get_name_splitter( dia_class.name )
- for index, scope in enumerate( name_splitter.scope_names ):
- if scope in self.__namespaces:
- continue
- else:
- udt = self.__find_udt( scope )
- if udt:
- classes.append( udt )
- if index:
- self.__namespaces[ name_splitter.scope_names[index-1] ] = None
- break
- else:
- self.__namespaces[ scope ] = None
- else:
- classes.append( dia_class )
- if name_splitter.scope_names:
- self.__namespaces[ name_splitter.scope_names[-1] ] = None
- return classes
- def __add_inner_classes( self, parent_class ):
- self.logger.debug( 'adding inner classes to "%s"' % parent_class.decl_string )
- for symbol_id in parent_class.dia_symbols:
- self.logger.debug( '\tdia symbol id: %d' % symbol_id )
- dia_symbol = self.__dia_session.symbolById( symbol_id )
- found = dia_symbol.findChildren( msdia.SymTagUDT, None, 0 )
- for inner_dia_class in itertools.imap(as_symbol, found):
- self.logger.debug( '\t\tinner UDT found - %s' % inner_dia_class.name )
- inner_name_splitter = impl_details.get_name_splitter( inner_dia_class.name )
- try:
- inner_klass = parent_class.class_( inner_name_splitter.name, recursive=False )
- inner_klass.dia_symbols.add( inner_dia_class.symIndexId )
- except parent_class.declaration_not_found_t:
- inner_klass = self.__create_class( inner_dia_class )
- parent_class.adopt_declaration( inner_klass
- , impl_details.guess_access_type( inner_dia_class.access ) )
- self.__classes[ inner_dia_class.name ] = inner_klass
- self.logger.debug( 'adding inner classes to "%s" - done' % parent_class.decl_string )
-
def __create_enum( self, enum_smbl ):
name_splitter = impl_details.get_name_splitter( enum_smbl.name )
enum_decl = declarations.enumeration_t( name_splitter.name )
@@ -245,23 +234,6 @@
#between those cases
return None
- def __load_enums( self, parent_symbol_id ):
- parent_symbol = self.__dia_session.symbolById( parent_symbol_id )
- self.logger.debug( 'loading enums to "%s" ' % parent_symbol.name )
- enum_smbls = parent_symbol.findChildren( SymTagEnum, None, 0 )
- for enum_smbl in itertools.imap(as_symbol, enum_smbls ):
- enum_decl = self.__create_enum( enum_smbl )
- if enum_decl:
- try:
- for enum_discovered in self.__enums[ enum_smbl.name ]:
- if self.__are_symbols_equivalent( enum_smbl.symIndexId, enum_discovered.dia_symbols[0] ):
- continue
- else:
- self.__enums[ enum_smbl.name ].append( enum_decl )
- except KeyError:
- self.__enums[ enum_smbl.name ] = [ enum_decl ]
- self.logger.debug( '\tfound %s %s' % ( enum_smbl.name, str(enum_decl) ) )
- self.logger.debug( 'loading enums to "%s" - done' % parent_symbol.name )
def __create_typedef( self, typedef_smbl ):
name_splitter = impl_details.get_name_splitter( typedef_smbl.name )
@@ -269,82 +241,10 @@
typedef_decl.dia_symbols = [ typedef_smbl.symIndexId ]
return typedef_decl
- def __load_typedefs( self, parent_symbol_id ):
- parent_symbol = self.__dia_session.symbolById( parent_symbol_id )
- self.logger.debug( 'loading typedefs to "%s" ' % parent_symbol.name )
- typedef_smbls = parent_symbol.findChildren( SymTagTypedef, None, 0 )
- for typedef_smbl in itertools.imap(as_symbol, typedef_smbls ):
- typedef_decl = self.__create_typedef( typedef_smbl )
- try:
- for typedef_discovered in self.__typedefs[ typedef_smbl.name ]:
- if self.__are_symbols_equivalent( typedef_smbl.symIndexId, typedef_discovered.dia_symbols[0] ):
- continue
- else:
- self.__typedefs[ typedef_smbl.name ].append( typedef_decl )
- except KeyError:
- self.__typedefs[ typedef_smbl.name ] = [ typedef_decl ]
- self.logger.debug( '\tfound %s %s' % ( typedef_smbl.name, str(typedef_decl) ) )
- self.logger.debug( 'loading typedefs to "%s" - done' % parent_symbol.name )
-
- def __load_classes( self, parent_symbol_id ):
- parent_symbol = self.__dia_session.symbolById( parent_symbol_id )
- self.logger.debug( 'loading classes to "%s" ' % parent_symbol.name )
- class_smbls = parent_symbol.findChildren( msdia.SymTagUDT, None, 0 )
- for class_smbl in itertools.imap(as_symbol, class_smbls ):
- class_decl = self.__create_class( class_smbl )
- try:
- equivalent_found = False
- for class_discovered in self.__classes[ class_smbl.name ]:
- for smbl_discovered in class_discovered.dia_symbols:
- equivalent_found = self.__are_symbols_equivalent( smbl_discovered, class_smbl.symIndexId )
- if equivalent_found:
- class_discovered.dia_symbols.add( class_smbl.symIndexId )
- break
- if equivalent_found:
- break
- if not equivalent_found:
- self.__classes[ class_smbl.name ].append( class_decl )
- except KeyError:
- self.__classes[ class_smbl.name ] = [ class_decl ]
- self.logger.debug( '\tfound %s' % str(class_decl) )
- self.logger.debug( 'loading classes to "%s" - done' % parent_symbol.name )
-
def __create_class( self, class_smbl ):
name_splitter = impl_details.get_name_splitter( class_smbl.name )
class_decl = declarations.class_t( name_splitter.name )
class_decl.class_type = impl_details.guess_class_type(class_smbl.udtKind)
- class_decl.dia_symbols = set([class_smbl.symIndexId])
+ class_decl.dia_symbols = [class_smbl]
class_decl.byte_size = class_smbl.length
return class_decl
-
- def __populate_scopes(self):
- self.__load_enums( self.dia_global_scope.symIndexId )
- self.__load_classes( self.dia_global_scope.symIndexId )
- self.__load_typedefs( self.dia_global_scope.symIndexId )
- #~ main_classes = self.__list_main_classes()
- #~ self.__create_nss()
-
- #~ for dia_class in main_classes:
- #~ name_splitter = impl_details.get_name_splitter( dia_class.name )
- #~ if not name_splitter.scope_names:
- #~ parent_ns = self.global_ns
- #~ else:
- #~ parent_ns = self.__namespaces[ name_splitter.scope_names[-1] ]
-
- #~ try:
- #~ klass = parent_ns.class_( name_splitter.name, recursive=False )
- #~ klass.dia_symbols.add( dia_class.symIndexId )
- #~ except parent_ns.declaration_not_found_t:
- #~ klass = self.__create_class( dia_class )
- #~ parent_ns.adopt_declaration( klass )
- #~ self.__classes[ dia_class.name ] = klass
-
- #~ map( self.__add_inner_classes, self.__classes.values() )
-
- #~ self.__add_enums( self.dia_global_scope.symIndexId )
- #~ for klass in self.__classes.itervalues():
- #~ map( self.__add_enums, klass.dia_symbols )
-
- #declarations.print_declarations( self.global_ns )#.namespace( 'ns1' ) )
- #declarations.print_declarations( self.global_ns.namespace( 'std' ) )
-
Deleted: pygccxml_dev/unittests/pdb_reader.py
===================================================================
--- pygccxml_dev/unittests/pdb_reader.py 2008-03-22 22:14:05 UTC (rev 1285)
+++ pygccxml_dev/unittests/pdb_reader.py 2008-03-22 22:14:36 UTC (rev 1286)
@@ -1,22 +0,0 @@
-import os
-import sys
-import win32com.client
-from sets import Set as set
-
-MODULE_IDENTIFIER = ('{106173A0-0173-4e5c-84E7-E915422BE997}', 0, 2, 0)
-MODULE_PATH = r'Lib\site-packages\win32com\gen_py\106173A0-0173-4e5c-84E7-E915422BE997x0x2x0.py'
-
-try:
- full_module_path = os.path.split( sys.executable )[0]
- full_module_path = os.path.join( full_module_path, MODULE_PATH )
- if os.path.exists( full_module_path ):
- os.remove( full_module_path )
- print full_module_path, " removed successfully"
-except Exception, error:
- print error
-
-msdia = win32com.client.gencache.EnsureModule( *MODULE_IDENTIFIER )
-print msdia
-
-if __name__ == "__main__":
- pass
Modified: pygccxml_dev/unittests/pdb_tester.py
===================================================================
--- pygccxml_dev/unittests/pdb_tester.py 2008-03-22 22:14:05 UTC (rev 1285)
+++ pygccxml_dev/unittests/pdb_tester.py 2008-03-22 22:14:36 UTC (rev 1286)
@@ -8,11 +8,15 @@
class tester_t( unittest.TestCase ):
def __init__(self, *args):
unittest.TestCase.__init__(self, *args)
+ self.pdb_file = os.path.join( autoconfig.data_directory
+ , 'msvc_build'
+ , 'Debug'
+ , 'msvc_build.pdb' )
def __test_splitter_impl( self, name, expected_result ):
splitter = pdb.impl_details.full_name_splitter_t( name )
- self.failUnless( len(splitter.scope_names) == len(expected_result) )
- self.failUnless( splitter.scope_names == expected_result )
+ self.failUnless( len(splitter.scope_names) == len(expected_result) )
+ self.failUnless( splitter.scope_names == expected_result )
def __test_name_splitter(self):
name = "std::_Tree<std::_Tmap_traits<engine_objects::ouuid_t,engine_objects::sql_query::parameterized_query::sql_fragment_t,std::less<engine_objects::ouuid_t>,std::allocator<std::pair<engine_objects::ouuid_t const ,engine_objects::sql_query::parameterized_query::sql_fragment_t> >,0> >::const_iterator::operator->"
@@ -21,17 +25,16 @@
, 'std::_Tree<std::_Tmap_traits<engine_objects::ouuid_t,engine_objects::sql_query::parameterized_query::sql_fragment_t,std::less<engine_objects::ouuid_t>,std::allocator<std::pair<engine_objects::ouuid_t const ,engine_objects::sql_query::parameterized_query::sql_fragment_t> >,0> >', 'std::_Tree<std::_Tmap_traits<engine_objects::ouuid_t,engine_objects::sql_query::parameterized_query::sql_fragment_t,std::less<engine_objects::ouuid_t>,std::allocator<std::pair<engine_objects::ouuid_t const ,engine_objects::sql_query::parameterized_query::sql_fragment_t> >,0> >::const_iterator'
]
self.__test_splitter_impl( name, expected_result )
-
+
name = 'boost::reference_wrapper<engine_objects::ops::pathable_t const >::operator engine_objects::ops::pathable_t const &'
expected_result = [
'boost'
, 'boost::reference_wrapper<engine_objects::ops::pathable_t const >'
]
self.__test_splitter_impl( name, expected_result )
-
+
def test_create_nss(self):
- control_pdb = os.path.join( autoconfig.data_directory, r'xxx.pdb' )
- reader = pdb.decl_loader_t( control_pdb )
+ reader = pdb.decl_loader_t( self.pdb_file )
print reader.symbols_table.name
reader.read()
f = file( 'decls.cpp', 'w+' )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rom...@us...> - 2008-03-22 22:14:00
|
Revision: 1285
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1285&view=rev
Author: roman_yakovenko
Date: 2008-03-22 15:14:05 -0700 (Sat, 22 Mar 2008)
Log Message:
-----------
adding Visual Studio 8.0 build scripts for "data"
Added Paths:
-----------
pygccxml_dev/unittests/data/msvc_build/
pygccxml_dev/unittests/data/msvc_build/all.cpp
pygccxml_dev/unittests/data/msvc_build/msvc_build.sln
pygccxml_dev/unittests/data/msvc_build/msvc_build.vcproj
Added: pygccxml_dev/unittests/data/msvc_build/all.cpp
===================================================================
--- pygccxml_dev/unittests/data/msvc_build/all.cpp (rev 0)
+++ pygccxml_dev/unittests/data/msvc_build/all.cpp 2008-03-22 22:14:05 UTC (rev 1285)
@@ -0,0 +1,43 @@
+#include "abstract_classes.hpp"
+#include "attributes.hpp"
+#include "bit_fields.hpp"
+#include "complex_types.hpp"
+#include "core_cache.hpp"
+#include "core_class_hierarchy.hpp"
+#include "core_diamand_hierarchy_base.hpp"
+#include "core_diamand_hierarchy_derived1.hpp"
+#include "core_diamand_hierarchy_derived2.hpp"
+#include "core_diamand_hierarchy_final_derived.hpp"
+#include "core_membership.hpp"
+#include "core_ns_join_1.hpp"
+#include "core_ns_join_2.hpp"
+#include "core_ns_join_3.hpp"
+#include "core_overloads_1.hpp"
+#include "core_overloads_2.hpp"
+#include "core_types.hpp"
+#include "declarations_calldef.hpp"
+#include "declarations_comparison.hpp"
+#include "declarations_enums.hpp"
+#include "declarations_for_filtering.hpp"
+#include "declarations_variables.hpp"
+#include "demangled.hpp"
+#include "free_operators.hpp"
+#include "has_public_binary_operator_traits.hpp"
+#include "include_all.hpp"
+#include "include_std.hpp"
+#include "indexing_suites2.hpp"
+#include "noncopyable.hpp"
+#include "patcher.hpp"
+#include "remove_template_defaults.hpp"
+#include "string_traits.hpp"
+#include "type_as_exception_bug.h"
+#include "type_traits.hpp"
+#include "typedefs1.hpp"
+#include "typedefs2.hpp"
+#include "typedefs_base.hpp"
+#include "unnamed_classes.hpp"
+#include "unnamed_enums_bug1.hpp"
+#include "unnamed_enums_bug2.hpp"
+#include "unnamed_ns_bug.hpp"
+#include "vector_traits.hpp"
+
Added: pygccxml_dev/unittests/data/msvc_build/msvc_build.sln
===================================================================
--- pygccxml_dev/unittests/data/msvc_build/msvc_build.sln (rev 0)
+++ pygccxml_dev/unittests/data/msvc_build/msvc_build.sln 2008-03-22 22:14:05 UTC (rev 1285)
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual C++ Express 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "msvc_build", "msvc_build.vcproj", "{FEC30A07-68D0-49A3-B7DE-431E5E3B9B6D}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {FEC30A07-68D0-49A3-B7DE-431E5E3B9B6D}.Debug|Win32.ActiveCfg = Debug|Win32
+ {FEC30A07-68D0-49A3-B7DE-431E5E3B9B6D}.Debug|Win32.Build.0 = Debug|Win32
+ {FEC30A07-68D0-49A3-B7DE-431E5E3B9B6D}.Release|Win32.ActiveCfg = Release|Win32
+ {FEC30A07-68D0-49A3-B7DE-431E5E3B9B6D}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
Added: pygccxml_dev/unittests/data/msvc_build/msvc_build.vcproj
===================================================================
--- pygccxml_dev/unittests/data/msvc_build/msvc_build.vcproj (rev 0)
+++ pygccxml_dev/unittests/data/msvc_build/msvc_build.vcproj 2008-03-22 22:14:05 UTC (rev 1285)
@@ -0,0 +1,348 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="msvc_build"
+ ProjectGUID="{FEC30A07-68D0-49A3-B7DE-431E5E3B9B6D}"
+ RootNamespace="msvc_build"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb"
+ GenerateXMLDocumentationFiles="true"
+ BrowseInformation="1"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ ValidateIntelliSense="true"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\all.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath="..\abstract_classes.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\attributes.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\bit_fields.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\complex_types.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\core_cache.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\core_class_hierarchy.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\core_diamand_hierarchy_base.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\core_diamand_hierarchy_derived1.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\core_diamand_hierarchy_derived2.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\core_diamand_hierarchy_final_derived.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\core_membership.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\core_ns_join_1.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\core_ns_join_2.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\core_ns_join_3.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\core_overloads_1.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\core_overloads_2.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\core_types.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\declarations_calldef.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\declarations_comparison.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\declarations_enums.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\declarations_for_filtering.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\declarations_variables.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\demangled.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\free_operators.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\has_public_binary_operator_traits.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\include_all.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\include_std.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\indexing_suites2.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\noncopyable.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\patcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\remove_template_defaults.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\string_traits.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\type_as_exception_bug.h"
+ >
+ </File>
+ <File
+ RelativePath="..\type_traits.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\typedefs1.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\typedefs2.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\typedefs_base.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\unnamed_classes.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\unnamed_enums_bug1.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\unnamed_enums_bug2.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\unnamed_ns_bug.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\vector_traits.hpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ <File
+ RelativePath=".\ReadMe.txt"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|