Skip to content

Commit d89cc32

Browse files
author
roman_yakovenko
committed
removing deprecated functionality
1 parent 2a11a66 commit d89cc32

File tree

8 files changed

+30
-166
lines changed

8 files changed

+30
-166
lines changed

pygccxml/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@
3434
import pygccxml.utils as utils
3535

3636
#TODO:
37-
# 1. Write documentation for filtering functionality.
38-
# 2. Add "explicit" property for constructors
37+
# 1. Add "explicit" property for constructors
3938

4039
__version__ = '1.0.0'
4140

pygccxml/binary_parsers/undname.py

Lines changed: 22 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@
44
# http://www.boost.org/LICENSE_1_0.txt)
55

66
"""
7-
provides functionality needed to undecorate\demangle compiler generated unique names
7+
provides low-level functionality, needed to undecorate\demangle compiler generated
8+
unique names and map them to the declarations
9+
10+
On Windows:
11+
ctypes package is used to call UnDecorateSymbolName function from dbghelp.dll
12+
13+
On Linux:
14+
"nm" utility is used.
815
"""
916

1017
import os
@@ -14,6 +21,8 @@
1421
from pygccxml import declarations
1522

1623
class UNDECORATE_NAME_OPTIONS:
24+
"""defines few constants for UnDecorateSymbolName function"""
25+
1726
UNDNAME_COMPLETE = 0x0000 #Enables full undecoration.
1827
UNDNAME_NO_LEADING_UNDERSCORES = 0x0001 #Removes leading underscores from Microsoft extended keywords.
1928
UNDNAME_NO_MS_KEYWORDS = 0x0002 #Disables expansion of Microsoft extended keywords.
@@ -48,39 +57,19 @@ class UNDECORATE_NAME_OPTIONS:
4857

4958
SHORT_UNIQUE_NAME = UNDNAME_NO_MS_KEYWORDS | UNDNAME_NO_ACCESS_SPECIFIERS | UNDNAME_NO_ECSU
5059

51-
#~ The following code doesn't work - access violation
52-
53-
#~__unDName definition was taken from:
54-
#~http://www.tech-archive.net/Archive/VC/microsoft.public.vc.language/2006-02/msg00754.html
55-
56-
#~ msvcrxx = ctypes.windll.msvcr90
57-
#~ free_type = ctypes.CFUNCTYPE( None, ctypes.c_void_p ) #free type
58-
#~ malloc_type = ctypes.CFUNCTYPE( ctypes.c_void_p, ctypes.c_uint ) #malloc type
59-
#~ __unDName = msvcrxx.__unDName
60-
#~ __unDName.argtypes = [ ctypes.c_char_p #undecorated name
61-
#~ , ctypes.c_char_p #decorated name
62-
#~ , ctypes.c_int #sizeof undecorated name
63-
#~ , malloc_type
64-
#~ , free_type
65-
#~ , ctypes.c_ushort #flags
66-
#~ ]
67-
#~ __unDName.restype = ctypes.c_char_p
68-
#~ def undecorate_name( name, options=None ):
69-
#~ if not name:
70-
#~ return ''
71-
#~ if options is None:
72-
#~ options = UNDECORATE_NAME_OPTIONS.SHORT_UNIQUE_NAME
73-
#~ buffer_size = 1024 * 32
74-
#~ undecorated_name = ctypes.create_string_buffer('\0' * buffer_size) #should be enouph for any symbol
75-
#~ __unDName( undecorated_name
76-
#~ , str(name)
77-
#~ , buffer_size
78-
#~ , malloc_type( msvcrxx.malloc )
79-
#~ , free_type( msvcrxx.free )
80-
#~ , options )
81-
#~ return undecorated_name.value
82-
8360
class undname_creator_t:
61+
"""formats declarations string representation and exported symbols, so they
62+
could be matched later.
63+
64+
The class formats variables, free and member functions, symbols exported from
65+
.dll, .map and .so files.
66+
67+
On Windows, the class works with unique name produced by MSVC compiler and
68+
with undecorated names produced by dbghelp.dll
69+
70+
On Linux, the class works with mangled names produced by GCC-XML ( GCC 4.2 )
71+
compiler and demangled name produced by "nm" utility.
72+
"""
8473
def __init__( self ):
8574
if 'win32' in sys.platform:
8675
import ctypes.wintypes
@@ -147,7 +136,6 @@ def __format_type_as_undecorated( self, type_, is_argument, hint ):
147136
result = result.replace( ' ' + x, x )
148137
return result
149138

150-
151139
def __normalize( self, name ):
152140
for what, with_ in self.__fundamental_types:
153141
name = name.replace( what, with_ )

pygccxml/declarations/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,6 @@
217217
import templates
218218
import call_invocation
219219

220-
from filtering import filtering
221-
222220
from decl_factory import decl_factory_t
223221

224222
from matchers import matcher_base_t

pygccxml/declarations/filtering.py

Lines changed: 0 additions & 79 deletions
This file was deleted.

pygccxml/declarations/scopedef.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
import time
1111
import algorithm
12-
import filtering
1312
import templates
1413
import declaration
1514
import mdecl_wrapper

pygccxml/utils/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ def normalize_path( some_path ):
8989
"""return os.path.normpath( os.path.normcase( some_path ) )"""
9090
return os.path.normpath( os.path.normcase( some_path ) )
9191

92+
def contains_parent_dir( fpath, dirs ):
93+
"""returns bool( filter( lambda dir: fpath.startswith( dir ), dirs ) )
94+
precondition: dirs and fpath should be normalize_path'ed before calling this function
95+
"""
96+
return bool( filter( lambda dir: fpath.startswith( dir ), dirs ) )
97+
98+
9299
def get_architecture():
93100
"""returns computer architecture: 32 or 64.
94101

unittests/filtering_tester.py

Lines changed: 0 additions & 46 deletions
This file was deleted.

unittests/test_all.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import type_traits_tester
2020
import core_tester
2121
import xmlfile_reader_tester
22-
import filtering_tester
2322
import text_reader_tester
2423
import hierarchy_traveling
2524
import patcher_tester
@@ -70,7 +69,6 @@
7069
, type_traits_tester
7170
, core_tester
7271
, xmlfile_reader_tester
73-
, filtering_tester
7472
, text_reader_tester
7573
, hierarchy_traveling
7674
, patcher_tester

0 commit comments

Comments
 (0)