bgen and gensuitemodule (was: [Pythonmac-SIG] How do you find the app that matches a creator type)

Bob Ippolito bob at redivi.com
Sat Feb 12 00:56:21 CET 2005


On Feb 11, 2005, at 18:32, Jack Jansen wrote:

> On 1-feb-05, at 2:09, Bob Ippolito wrote:
>
>>>> Unfortunately these patches need to be rewritten such that they 
>>>> change the gensuitemodule scripts
>>>
>>> I think you mean bgen, yes?:)
>>
>> Yeah I mean bgen...  I'm confusing the evil code generators
>
> Bob, I hope you realise that these "evil code generators" were written 
> by Guido Himself (Our Beloved Leader, He Who Coded What No Man Coded 
> Before, He Who Forever Enlightens Our Path, etc etc etc etc etc:-)
>
> My main tasks in the MacPython world have been:
> a) Keep those two working with new releases of Python
> b) Keep those two working with whatever new stuff Steve (Our Beloved 
> Leader, He Who Designed What No Man Designed Before, He Who Forever 
> Enlightens Our Path, etc etc etc etc etc:-) came up with.

Just because they have holy origins doesn't make them any less evil :)

Other than the difficultly in setting bgen up and getting used to the 
workflow, my main problem with it is that it is hard to make it 
understand callbacks, which are used a lot these days.  I would like to 
see something like bgen end up generating ctypes and/or PyObjC's FFI 
support instead of C code, which would make callbacks much easier (if 
not automatic), and the edit/run cycle is faster.  There's also a lot 
of metadata that could be stored about constants and functions that 
isn't (i.e. parsing comments and shoving them into doc strings or at 
least comments in the generated code).  I think that some of bgen's 
parsing capabilities are going to fall apart when/if Universal Headers 
go away, because the new style headers use integer constants rather 
than four character codes in the cases where it is necessary to keep 
the source files as ASCII.

Thomas Heller has been working on some interesting stuff with gcc-xml 
(argh) that automatically generates wrappers given C headers, and I've 
got some stuff in the PyObjC sandbox that does (will do) the same for 
Objective-C and a subset of C frameworks (I intend to wrap 
CoreFoundation and SystemPreferences with it, at least).  Right now it 
mostly just tokenizes, but support is there to deal with #defines and 
externs, so I have been able to use it to wrap a lot of the "newer" 
Objective-C frameworks that don't have really tricky selectors or 
global functions.

gensuitemodule has some pretty severe limitations, but I think that 
appscript is a suitable replacement... though I still use aeve in my 
product because I understand it, my requirements are simple, and it can 
do asynchronous events with PyObjC.

-bob



More information about the Pythonmac-SIG mailing list