Issue 19 in ctypesgen: Enhancement: Support 'bool'

20 views
Skip to first unread message

codesite...@google.com

unread,
Jul 13, 2011, 11:50:21 AM7/13/11
to ctyp...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 19 by natetas...@gmail.com: Enhancement: Support 'bool'
http://code.google.com/p/ctypesgen/issues/detail?id=19

It would be most excellent if you would support 'bool' return and argument
types, as ctypes has a c_bool:
http://docs.python.org/library/ctypes.html#ctypes.c_bool.

Currently, in my library, I am losing my functions with this type:
Error: <input>:16: Syntax error at 'bool'

codesite...@google.com

unread,
Jul 18, 2013, 6:22:26 AM7/18/13
to ctyp...@googlegroups.com

Comment #1 on issue 19 by ronald.b...@gmail.com: Enhancement: Support 'bool'
http://code.google.com/p/ctypesgen/issues/detail?id=19

This is my patch for boolean support for ctypesgen. Please note that the
actual parser (parsetab.py) should still be generated from cgrammar.py.

Note that I first submitted this as part of the patch for issue #43, but
got a recommendation to create separate patches for separate functionality
(I agree).

I also added a test for the bool type.

Attachments:
ctypesgen-bool.patch 3.6 KB

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

codesite...@google.com

unread,
Jul 19, 2013, 5:08:53 AM7/19/13
to ctyp...@googlegroups.com

Comment #2 on issue 19 by ronald.b...@gmail.com: Enhancement: Support 'bool'
http://code.google.com/p/ctypesgen/issues/detail?id=19

I fixed my patch for the bool type so that it conforms to section 7.16 of
the C spec (as far as I understand now), i.e. the bool keyword is _Bool,
and the macro definitions from <stdbool.h> (or any custom macros) are
required to make the bool 'keyword' work.

Attachments:
ctypesgen-bool.2.patch 3.6 KB

codesite...@google.com

unread,
Aug 20, 2013, 12:55:56 AM8/20/13
to ctyp...@googlegroups.com
Updates:
Labels: -Type-Defect Type-Enhancement

Comment #3 on issue 19 by clac...@gmail.com: Enhancement: Support 'bool'
http://code.google.com/p/ctypesgen/issues/detail?id=19

Changes look good but the test for this new feature is failing on my
machine. Following up with Ronald via email.

codesite...@google.com

unread,
Aug 20, 2013, 2:53:46 AM8/20/13
to ctyp...@googlegroups.com

Comment #4 on issue 19 by ronald.b...@gmail.com: Enhancement: Support 'bool'
http://code.google.com/p/ctypesgen/issues/detail?id=19

New patch that includes parsetab.py, which is generated from cgrammar.py.

codesite...@google.com

unread,
Aug 21, 2013, 12:02:33 AM8/21/13
to ctyp...@googlegroups.com
Updates:
Status: Fixed

Comment #5 on issue 19 by clac...@gmail.com: Enhancement: Support 'bool'
http://code.google.com/p/ctypesgen/issues/detail?id=19

Fixed in r148 (note my change description incorrectly attributes this to
issue #19). Thanks Ronald!

codesite...@google.com

unread,
Aug 21, 2013, 12:04:34 AM8/21/13
to ctyp...@googlegroups.com

Comment #6 on issue 19 by clac...@gmail.com: Enhancement: Support 'bool'
http://code.google.com/p/ctypesgen/issues/detail?id=19

And r149.

codesite...@google.com

unread,
Aug 21, 2013, 12:05:34 AM8/21/13
to ctyp...@googlegroups.com

Comment #7 on issue 19 by clac...@gmail.com: Enhancement: Support 'bool'
http://code.google.com/p/ctypesgen/issues/detail?id=19

Fixed in r149. Thanks for the patch!
Reply all
Reply to author
Forward
0 new messages