www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - H2D Parser Project

reply Joshua Cearley <jtech ezoob.com> writes:
I'm glad to announce that a parser for C header files to D module files
will be available very soon. I've currently got a basic hand written
lexer, and the parser is not yet completed. Version 0.1 will be ready in a
few days to a week. If anyone finds this interesting; post a reply or
email me at <jtech AT ezoob DOT com> to be added to the mailing list for
it (its makeshift right now) for up-to-date news on how its going (I'm not
going to spam the newsgroup for it, lol)

What it will do is take in a C header file and generate a D module based
on that header. Anything that cannot be done automatically will be flagged
in the module with a comment labeled appropriately (i.e. "// FIXME:
Possible enumeration, currently not able to produce D Enum.").

This utility will make using C based libraries considerably easier, and
without the need to write a port for the toolkit. This is primarily being
designed to use SDL (http://www.libsdl.org) but it will be able to use
other things as well (in particularly OpenGL).

P.S. D kicks C++  $$.

-Joshua Cearley
Owner, Lead Developer
BlackCrystal Software
"Making dreams reality."
Jan 21 2005
next sibling parent reply Joshua Cearley <jtech ezoob.com> writes:
Errr. it wont be released under that name. This is not the program on
DSource. (i have to learn to check everywhere before naming something, lol)
Jan 21 2005
parent unknown <unknown_member pathlink.com> writes:
In article <pan.2005.01.21.14.01.34.577845 ezoob.com>, Joshua Cearley says...
Errr. it wont be released under that name. This is not the program on
DSource. (i have to learn to check everywhere before naming something, lol)

maybe just take over the Dsource program since no-one has worked on it in a while
Jan 21 2005
prev sibling next sibling parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Joshua Cearley wrote:

 I'm glad to announce that a parser for C header files to D module files
 will be available very soon. [...]
 
 What it will do is take in a C header file and generate a D module based
 on that header. Anything that cannot be done automatically will be flagged
 in the module with a comment labeled appropriately (i.e. "// FIXME:
 Possible enumeration, currently not able to produce D Enum.").

There are a few of those translators around already, did you search ?
 This utility will make using C based libraries considerably easier, and
 without the need to write a port for the toolkit. This is primarily being
 designed to use SDL (http://www.libsdl.org) but it will be able to use
 other things as well (in particularly OpenGL).

OpenGL 1.2.1 and SDL 1.2.6 have already been translated to D modules. Will post an update, shortly. --anders
Jan 21 2005
prev sibling next sibling parent reply "Matthew" <admin.hat stlsoft.dot.org> writes:
It'll be great - I'd like to convert the Ruby headers with it.

Will others be able to contribute?

"Joshua Cearley" <jtech ezoob.com> wrote in message
news:pan.2005.01.21.13.39.08.70564 ezoob.com...
 I'm glad to announce that a parser for C header files to D module files
 will be available very soon. I've currently got a basic hand written
 lexer, and the parser is not yet completed. Version 0.1 will be ready in a
 few days to a week. If anyone finds this interesting; post a reply or
 email me at <jtech AT ezoob DOT com> to be added to the mailing list for
 it (its makeshift right now) for up-to-date news on how its going (I'm not
 going to spam the newsgroup for it, lol)

 What it will do is take in a C header file and generate a D module based
 on that header. Anything that cannot be done automatically will be flagged
 in the module with a comment labeled appropriately (i.e. "// FIXME:
 Possible enumeration, currently not able to produce D Enum.").

 This utility will make using C based libraries considerably easier, and
 without the need to write a port for the toolkit. This is primarily being
 designed to use SDL (http://www.libsdl.org) but it will be able to use
 other things as well (in particularly OpenGL).

 P.S. D kicks C++  $$.

 -Joshua Cearley
 Owner, Lead Developer
 BlackCrystal Software
 "Making dreams reality." 

Jan 21 2005
parent reply Joshua Cearley <jtech ezoob.com> writes:
On Fri, 21 Jan 2005 21:08:39 +1100, Matthew wrote:

 It'll be great - I'd like to convert the Ruby headers with it.
 
 Will others be able to contribute?

Once I get a subversion server set up and version 0.1 out then yes; I'm probably going to release it under a BSD type license. -Joshua Cearley Owner, Lead Developer BlackCrystal Software "Making dreams reality."
Jan 21 2005
parent "Matthew" <admin.hat stlsoft.dot.org> writes:
"Joshua Cearley" <jtech ezoob.com> wrote in message
news:pan.2005.01.22.03.22.27.217820 ezoob.com...
 On Fri, 21 Jan 2005 21:08:39 +1100, Matthew wrote:

 It'll be great - I'd like to convert the Ruby headers with it.

 Will others be able to contribute?

Once I get a subversion server set up and version 0.1 out then yes; I'm probably going to release it under a BSD type license.

Sounds fine to me. :-)
Jan 21 2005
prev sibling next sibling parent "Walter" <newshound digitalmars.com> writes:
"Joshua Cearley" <jtech ezoob.com> wrote in message
news:pan.2005.01.21.13.39.08.70564 ezoob.com...
 I'm glad to announce that a parser for C header files to D module files
 will be available very soon.

Fantastic!
 P.S. D kicks C++  $$.

It's contributors like yourself that make it so.
Jan 21 2005
prev sibling parent Stewart Gordon <smjg_1998 yahoo.com> writes:
Joshua Cearley wrote:
 I'm glad to announce that a parser for C header files to D module files
 will be available very soon.

Excellent!
 What it will do is take in a C header file and generate a D module based
 on that header. Anything that cannot be done automatically will be flagged
 in the module with a comment labeled appropriately (i.e. "// FIXME:
 Possible enumeration, currently not able to produce D Enum.").

Certainly a step ahead of some of the human language translators dotted about the net. It would be good to have some kind of configuration file, which would decide (among whatever other things): - which #ifdefs to convert to versions, and which to get rid of altogether - how to treat struct/union tags (keep them as the struct/union name, or get rid of them altogether (useful for such things as Windows API headers)). Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Jan 28 2005