[pypy-commit] cffi cffi-1.0: Generate more comments

arigo noreply at buildbot.pypy.org
Sat Apr 18 13:34:34 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: cffi-1.0
Changeset: r1755:3ccb4668ee1f
Date: 2015-04-18 13:35 +0200
http://bitbucket.org/cffi/cffi/changeset/3ccb4668ee1f/

Log:	Generate more comments

diff --git a/new/recompiler.py b/new/recompiler.py
--- a/new/recompiler.py
+++ b/new/recompiler.py
@@ -118,8 +118,12 @@
         #
         # the declaration of '_cffi_types'
         prnt('static void *_cffi_types[] = {')
+        typeindex2type = dict([(i, tp) for (tp, i) in self._typesdict.items()])
         for i, op in enumerate(self.cffi_types):
-            prnt('/* %2d */ %s,' % (i, op.as_c_expr()))
+            comment = ''
+            if i in typeindex2type:
+                comment = ' // ' + typeindex2type[i]._get_c_name()
+            prnt('/* %2d */ %s,%s' % (i, op.as_c_expr(), comment))
         if not self.cffi_types:
             prnt('  0')
         prnt('};')


More information about the pypy-commit mailing list