[ctypes-commit] ctypes/sandbox/tools/codegen codegenerator.py,1.18,1.19
Brought to you by:
theller
From: Thomas H. <th...@us...> - 2005-01-12 08:04:42
|
Update of /cvsroot/ctypes/ctypes/sandbox/tools/codegen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23199 Modified Files: codegenerator.py Log Message: EnumValues are now exposed at the top level. Index: codegenerator.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/sandbox/tools/codegen/codegenerator.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** codegenerator.py 10 Jan 2005 16:20:00 -0000 1.18 --- codegenerator.py 12 Jan 2005 08:04:33 -0000 1.19 *************** *** 252,269 **** self.done.add(tp) _enumtypes = 0 def Enumeration(self, tp): if tp in self.done: return self._enumtypes += 1 if tp.name: print >> self.stream print >> self.stream, "%s = c_int # enum" % tp.name ! for n, v in tp.values: ! print >> self.stream, "%s = %s # enum %s" % (n, v, tp.name) ! else: ! for n, v in tp.values: ! print >> self.stream, "%s = %s # enum" % (n, v) ! self.done.add(tp) def StructureBody(self, body): --- 252,273 ---- self.done.add(tp) + def EnumValue(self, tp): + if tp in self.done: + return + print >> self.stream, \ + "%s = %s # enum %s" % (tp.name, tp.value, tp.enumeration.name or "") + self.done.add(tp) + _enumtypes = 0 def Enumeration(self, tp): if tp in self.done: return + self.done.add(tp) self._enumtypes += 1 if tp.name: print >> self.stream print >> self.stream, "%s = c_int # enum" % tp.name ! for item in tp.values: ! self.EnumValue(item) def StructureBody(self, body): |