[ctypes-commit] ctypes/sandbox/tools/codegen gccxmlparser.py,1.8,1.9
Brought to you by:
theller
From: Thomas H. <th...@us...> - 2005-01-07 18:58:41
|
Update of /cvsroot/ctypes/ctypes/sandbox/tools/codegen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15074 Modified Files: gccxmlparser.py Log Message: Convert internal names into valid Python identifiers. Index: gccxmlparser.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/sandbox/tools/codegen/gccxmlparser.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** gccxmlparser.py 22 Dec 2004 08:39:40 -0000 1.8 --- gccxmlparser.py 7 Jan 2005 18:58:32 -0000 1.9 *************** *** 21,25 **** def demangle(self, name): ! return "_py_" + name.replace("$", "_") def startElement(self, name, attrs): --- 21,27 ---- def demangle(self, name): ! if name.startswith("__"): ! name = "_py_" + name ! return name.replace("$", "_") def startElement(self, name, attrs): *************** *** 62,66 **** def Typedef(self, attrs): ! name = attrs["name"] typ = attrs["type"] return typedesc.Typedef(name, typ) --- 64,68 ---- def Typedef(self, attrs): ! name = self.demangle(attrs["name"]) typ = attrs["type"] return typedesc.Typedef(name, typ) *************** *** 70,74 **** def FundamentalType(self, attrs): ! name = attrs["name"] if name == "void": size = "" --- 72,76 ---- def FundamentalType(self, attrs): ! name = self.demangle(attrs["name"]) if name == "void": size = "" *************** *** 118,122 **** def Function(self, attrs): # name, returns, extern, attributes ! name = attrs["name"] returns = attrs["returns"] attributes = attrs.get("attributes", "").split() --- 120,124 ---- def Function(self, attrs): # name, returns, extern, attributes ! name = self.demangle(attrs["name"]) returns = attrs["returns"] attributes = attrs.get("attributes", "").split() *************** *** 140,144 **** def OperatorFunction(self, attrs): # name, returns, extern, attributes ! name = attrs["name"] returns = attrs["returns"] return typedesc.OperatorFunction(name, returns) --- 142,146 ---- def OperatorFunction(self, attrs): # name, returns, extern, attributes ! name = self.demangle(attrs["name"]) returns = attrs["returns"] return typedesc.OperatorFunction(name, returns) *************** *** 148,152 **** def Constructor(self, attrs): ! name = attrs["name"] return typedesc.Constructor(name) --- 150,154 ---- def Constructor(self, attrs): ! name = self.demangle(attrs["name"]) return typedesc.Constructor(name) *************** *** 155,159 **** def Method(self, attrs): # name, virtual, pure_virtual, returns ! name = attrs["name"] returns = attrs["returns"] return typedesc.Method(name, returns) --- 157,161 ---- def Method(self, attrs): # name, virtual, pure_virtual, returns ! name = self.demangle(attrs["name"]) returns = attrs["returns"] return typedesc.Method(name, returns) *************** *** 173,177 **** def Enumeration(self, attrs): # id, name ! name = attrs["name"] size = attrs["size"] align = attrs["align"] --- 175,179 ---- def Enumeration(self, attrs): # id, name ! name = self.demangle(attrs["name"]) size = attrs["size"] align = attrs["align"] *************** *** 188,192 **** def EnumValue(self, attrs): ! name = attrs["name"] value = attrs["init"] self.context[-1].add_value(name, value) --- 190,194 ---- def EnumValue(self, attrs): ! name = self.demangle(attrs["name"]) value = attrs["init"] self.context[-1].add_value(name, value) *************** *** 237,241 **** def Field(self, attrs): # name, type ! name = attrs["name"] typ = attrs["type"] bits = attrs.get("bits", None) --- 239,243 ---- def Field(self, attrs): # name, type ! name = self.demangle(attrs["name"]) typ = attrs["type"] bits = attrs.get("bits", None) |