[ctypes-commit] ctypes/sandbox/tools/codegen typedesc.py,1.4,1.5 gccxmlparser.py,1.10,1.11 codegener
Brought to you by:
theller
From: Thomas H. <th...@us...> - 2005-01-13 16:43:55
|
Update of /cvsroot/ctypes/ctypes/sandbox/tools/codegen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3247 Modified Files: typedesc.py gccxmlparser.py codegenerator.py Log Message: Add a variable type. Index: typedesc.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/sandbox/tools/codegen/typedesc.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** typedesc.py 12 Jan 2005 08:11:26 -0000 1.4 --- typedesc.py 13 Jan 2005 16:43:42 -0000 1.5 *************** *** 138,140 **** --- 138,146 ---- self.enumeration = enumeration + class Variable(object): + def __init__(self, name, typ, init): + self.name = name + self.typ = typ + self.init = init + ################################################################ Index: codegenerator.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/sandbox/tools/codegen/codegenerator.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** codegenerator.py 12 Jan 2005 08:04:33 -0000 1.19 --- codegenerator.py 13 Jan 2005 16:43:42 -0000 1.20 *************** *** 252,255 **** --- 252,262 ---- self.done.add(tp) + def Variable(self, tp): + if tp in self.done: + return + self.done.add(tp) + print >> self.stream, \ + "%s = %s # Variable" % (tp.name, tp.init) + def EnumValue(self, tp): if tp in self.done: Index: gccxmlparser.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/sandbox/tools/codegen/gccxmlparser.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** gccxmlparser.py 12 Jan 2005 08:06:28 -0000 1.10 --- gccxmlparser.py 13 Jan 2005 16:43:42 -0000 1.11 *************** *** 58,62 **** def Namespace(self, attrs): pass - def Variable(self, attrs): pass def Base(self, attrs): pass def Ellipsis(self, attrs): pass --- 58,61 ---- *************** *** 69,72 **** --- 68,83 ---- # simple types and modifiers + def Variable(self, attrs): + name = attrs["name"] + if name.startswith("cpp_sym_"): + # XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx fix me! + name = name[len("cpp_sym_"):] + init = attrs["init"] + typ = attrs["type"] + return typedesc.Variable(name, typ, init) + + def _fixup_Variable(self, t): + t.typ = self.all[t.typ] + def Typedef(self, attrs): name = self.demangle(attrs["name"]) *************** *** 260,264 **** def get_result(self): interesting = (typedesc.Typedef, typedesc.Enumeration, typedesc.EnumValue, ! typedesc.Function, typedesc.Structure, typedesc.Union) result = [] remove = [] --- 271,276 ---- def get_result(self): interesting = (typedesc.Typedef, typedesc.Enumeration, typedesc.EnumValue, ! typedesc.Function, typedesc.Structure, typedesc.Union, ! typedesc.Variable) result = [] remove = [] *************** *** 284,286 **** xml.sax.parse(xmlfile, handler) return handler.get_result() - --- 296,297 ---- |