[pygccxml-commit] SF.net SVN: pygccxml: [1292] pygccxml_dev
Brought to you by:
mbaas,
roman_yakovenko
|
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.
|