[dia] Move demangling in it's own function
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] Move demangling in it's own function
- Date: Wed, 6 Oct 2010 22:00:29 +0000 (UTC)
commit baea8b219c8fe095a30f05602367da075ac8269e
Author: Hans Breuer <hans breuer org>
Date: Fri Oct 1 22:09:26 2010 +0200
Move demangling in it's own function
plug-ins/python/wdeps.py | 49 ++++++++++++++++++++++++---------------------
1 files changed, 26 insertions(+), 23 deletions(-)
---
diff --git a/plug-ins/python/wdeps.py b/plug-ins/python/wdeps.py
index b27bf35..0d83896 100644
--- a/plug-ins/python/wdeps.py
+++ b/plug-ins/python/wdeps.py
@@ -49,6 +49,31 @@ is :- "public: class utl::CUnit & __thiscall utl::CUnit::operator/=(class utl::C
# a list of dlls to ignore dependencies of
g_DontFollow = []
+def Demangle (symbols) :
+ demangled = []
+ for s in symbols :
+ m = rDemangle.match (s)
+ if m :
+ #print m.group("tor"), "::", m.group("sym")
+ dm = ""
+ names = string.split (m.group("sym"), "@")
+ # we must not append the .reverse() in the line above otherwise names would become None. WTF? Inplace operation?
+ names.reverse()
+ if m.group("tor") == "?0" : # constructor
+ dm = string.join(names, "::") + "::" + names[-1]
+ elif m.group("tor") == "?1" : # constructor
+ dm = string.join(names, "::") + "::~" + names[-1]
+ elif m.group("tor") != None and m.group("tor")[0] == "?" and m.group("tor")[1] in Operators.keys() : # constructor
+ dm = string.join(names, "::") + "::operator" + Operators[m.group("tor")[1]]
+ else :
+ dm = string.join(names, "::")
+ #print " => ", dm
+ demangled.append (dm)
+ else :
+ #print " <unmatched>: ", s
+ demangled.append (s)
+ return demangled
+
class Node :
def __init__ (self, name, depth) :
self.name = name
@@ -74,29 +99,7 @@ class Edge :
self.delayLoad = delayLoad
if len(symbols) > g_maxWeight :
g_maxWeight = len(symbols)
- demangled = []
- for s in symbols :
- m = rDemangle.match (s)
- if m :
- #print m.group("tor"), "::", m.group("sym")
- dm = ""
- names = string.split (m.group("sym"), "@")
- # we must not append the .reverse() in the line above otherwise names would become None. WTF? Inplace operation?
- names.reverse()
- if m.group("tor") == "?0" : # constructor
- dm = string.join(names, "::") + "::" + names[-1]
- elif m.group("tor") == "?1" : # constructor
- dm = string.join(names, "::") + "::~" + names[-1]
- elif m.group("tor") != None and m.group("tor")[0] == "?" and m.group("tor")[1] in Operators.keys() : # constructor
- dm = string.join(names, "::") + "::operator" + Operators[m.group("tor")[1]]
- else :
- dm = string.join(names, "::")
- #print " => ", dm
- demangled.append (dm)
- else :
- #print " <unmatched>: ", s
- demangled.append (s)
- self.symbols = demangled
+ self.symbols = Demangle(symbols)
def Weight (self) :
"As method to have let always be the number of symbols"
return len(self.symbols)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]