[M3devel] UI, Trestle, native... Cocoa??
Mika Nystrom
mika at async.async.caltech.edu
Wed Sep 29 09:50:52 CEST 2010
Darko writes:
...
>Several APIs I've done are by hand using several regular expression =
>search and replaces. Automating it is relatively easy because it doesn't =
>have to be completely general, it only has to parse the header files you =
>are targeting, not every C syntactic construct, which would be a very =
>bad trip. When I did the Mac Carbon APIs I had a file of exceptions =
>which handled the "too hard basket" of declarations. Trying to use the =
>more powerful tools just means you have a steep learning curve and you =
>end up with something messy and unpredictable which you have to hack =
>anyway.
...
My advice would be not to parse C at all. Just translate the reference manual's
specs into some specification language (I use Scheme or Modula-3 but you could
use XML) and generate glue code in both C and Modula-3. It's a lot saner...
you can use your regex translation machine the first time of course, but then
maintain the linkage in a language that actually specifies things properly.
Mika
More information about the M3devel
mailing list