[pygccxml-commit] SF.net SVN: pygccxml:[1487] pygccxml_dev
Brought to you by:
mbaas,
roman_yakovenko
|
From: <rom...@us...> - 2008-12-23 13:27:32
|
Revision: 1487
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1487&view=rev
Author: roman_yakovenko
Date: 2008-12-23 13:27:29 +0000 (Tue, 23 Dec 2008)
Log Message:
-----------
adding another set of tests
Modified Paths:
--------------
pygccxml_dev/pygccxml/msvc/common_utils.py
pygccxml_dev/unittests/data/msvc/mydll.80.vcproj
pygccxml_dev/unittests/data/msvc/mydll.cpp
pygccxml_dev/unittests/data/msvc/mydll.h
pygccxml_dev/unittests/undname_creator_tester.py
Modified: pygccxml_dev/pygccxml/msvc/common_utils.py
===================================================================
--- pygccxml_dev/pygccxml/msvc/common_utils.py 2008-12-23 08:45:12 UTC (rev 1486)
+++ pygccxml_dev/pygccxml/msvc/common_utils.py 2008-12-23 13:27:29 UTC (rev 1487)
@@ -111,11 +111,7 @@
else:
return ','.join( map( self.__format_type_as_undecorated, argtypes ) )
- def undecorated_decl(self, calldef):
- """returns string, which contains full function name formatted exactly as
- result of dbghelp.UnDecorateSymbolName, with UNDNAME_NO_MS_KEYWORDS | UNDNAME_NO_ACCESS_SPECIFIERS | UNDNAME_NO_ECSU
- options.
- """
+ def __undecorated_calldef( self, calldef ):
calldef_type = calldef.function_type()
result = []
@@ -138,11 +134,34 @@
result.append( 'const' )
return ''.join( result )
+ def __undecorated_variable( self, decl ):
+ result = []
+ if decl.type_qualifiers.has_static:
+ result.append( 'static ' )
+ result.append( self.__format_type_as_undecorated( decl.type ) )
+ result.append( ' ' )
+ if isinstance( decl.parent, declarations.class_t ):
+ result.append( self.__remove_leading_scope( decl.parent.decl_string ) + '::' )
+ result.append( decl.name )
+ return ''.join( result )
+
+ def undecorated_decl(self, decl):
+ """returns string, which contains full function name formatted exactly as
+ result of dbghelp.UnDecorateSymbolName, with UNDNAME_NO_MS_KEYWORDS | UNDNAME_NO_ACCESS_SPECIFIERS | UNDNAME_NO_ECSU
+ options.
+ """
+ if isinstance( decl, declarations.calldef_t ):
+ return self.__undecorated_calldef( decl )
+ elif isinstance( decl, declarations.variable_t ):
+ return self.__undecorated_variable( decl )
+ else:
+ raise NotImplementedError()
+
undecorate_blob = undname_creator().undecorate_blob
undecorate_decl = undname_creator().undecorated_decl
class exported_symbols:
- map_file_re = re.compile( r' +\d+ (?P<decorated>.+) \((?P<undecorated>.+)\)$' )
+ map_file_re = re.compile( r' +\d+ (?P<decorated>.+?) \((?P<undecorated>.+)\)$' )
@staticmethod
def load_from_map_file( fname ):
"""returns dictionary { decorated symbol : orignal declaration name }"""
Modified: pygccxml_dev/unittests/data/msvc/mydll.80.vcproj
===================================================================
--- pygccxml_dev/unittests/data/msvc/mydll.80.vcproj 2008-12-23 08:45:12 UTC (rev 1486)
+++ pygccxml_dev/unittests/data/msvc/mydll.80.vcproj 2008-12-23 13:27:29 UTC (rev 1487)
@@ -137,6 +137,7 @@
LinkIncremental="1"
GenerateDebugInformation="true"
GenerateMapFile="true"
+ MapFileName="$(TargetDir)$(TargetName).map"
MapExports="true"
SubSystem="2"
OptimizeReferences="2"
Modified: pygccxml_dev/unittests/data/msvc/mydll.cpp
===================================================================
--- pygccxml_dev/unittests/data/msvc/mydll.cpp 2008-12-23 08:45:12 UTC (rev 1486)
+++ pygccxml_dev/unittests/data/msvc/mydll.cpp 2008-12-23 13:27:29 UTC (rev 1487)
@@ -41,6 +41,16 @@
void do_smth( number_aptr_t& ){
}
+
+int myclass_t::my_static_member = 99;
+const int myclass_t::my_const_static_member = 10009;
+int my_global_int = 90;
+volatile int my_volatile_global_variable = 9;
+int my_global_array[10] = {0,1,2,3,4,5,6,7,8,9};
+
+void* get_pvoid(void*){ return 0;}
+void** get_ppvoid(void){return 0;}
+
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
Modified: pygccxml_dev/unittests/data/msvc/mydll.h
===================================================================
--- pygccxml_dev/unittests/data/msvc/mydll.h 2008-12-23 08:45:12 UTC (rev 1486)
+++ pygccxml_dev/unittests/data/msvc/mydll.h 2008-12-23 13:27:29 UTC (rev 1487)
@@ -2,6 +2,7 @@
#include <memory>
+
class __declspec(dllexport) number_t{
public:
number_t();
@@ -24,4 +25,27 @@
enum{ auto_ptr_size = sizeof( number_aptr_t ) };
-void __declspec(dllexport) do_smth( number_aptr_t& );
+__declspec(dllexport) void do_smth( number_aptr_t& );
+
+__declspec(dllexport) extern int my_global_int;
+
+typedef void(*do_smth_type)( number_aptr_t& );
+
+__declspec(dllexport) extern volatile int my_volatile_global_variable;
+
+__declspec(dllexport) extern int my_global_array[10];
+
+__declspec(dllexport) void* get_pvoid(void*);
+__declspec(dllexport) void** get_ppvoid(void);
+
+
+class __declspec(dllexport) myclass_t{
+public:
+ static int my_static_member;
+ static const int my_const_static_member;
+ volatile int my_volatile_member;
+
+ do_smth_type* get_do_smth(){ return 0; }
+ void set_do_smth(do_smth_type*){};
+
+};
\ No newline at end of file
Modified: pygccxml_dev/unittests/undname_creator_tester.py
===================================================================
--- pygccxml_dev/unittests/undname_creator_tester.py 2008-12-23 08:45:12 UTC (rev 1486)
+++ pygccxml_dev/unittests/undname_creator_tester.py 2008-12-23 13:27:29 UTC (rev 1487)
@@ -30,6 +30,8 @@
tester_t.global_ns.init_optimizer()
def is_included( self, decl ):
+ if not isinstance( decl, ( declarations.calldef_t, declarations.variable_t) ):
+ return False
for suffix in [ self.header, 'memory' ]:
if decl.location.file_name.endswith( suffix ):
return True
@@ -49,7 +51,7 @@
undecorated_blob_names.add( undname )
undecorated_decl_names = set()
- for f in self.global_ns.calldefs(self.is_included):
+ for f in self.global_ns.decls(self.is_included):
undecorated_decl_names.add( msvc.undecorate_decl( f ) )
issuperset = undecorated_decl_names.issuperset( undecorated_blob_names )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|