FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

.h to .d conversion

 
Post new topic   Reply to topic     Forum Index -> h2d
View previous topic :: View next topic  
Author Message
Cabal



Joined: 28 Apr 2004
Posts: 18
Location: UK

PostPosted: Wed May 26, 2004 9:31 am    Post subject: .h to .d conversion Reply with quote

Hi,

I don't know if dsource.org is the appropriate host for this project but here goes...

I have a hankering after writing some D wrappers for basic cross platform functionality - threads and sockets to start with. But I definitely don't grok the apparent desire of the D community to continuously re-define C library interfaces. I shudder at the very thought of all the 'extern (C)' blocks I've seen for the individual functions a D module is using.
So, having decided I wasn't having any of that I implemented 'h2d' which, surprisingly, does a reasonable job of automatically converting preprocessed C headers into something that dmd doesn't barf on.
The reason I hesitate about this site being the correct one for me and my baby is that it is written in C++, and more specifically, boost::spirit (if nothing else I've learned to both love and hate boost::spirit over the past 2 or 3 weeks)

So how about it? Am I in the wrong/right place? Is anyone interested in lending a hand?

Caveats:
I'm a *nix programmer. This probably (almost certainly in fact) won't do the business for windows headers, though there's no reason why it shouldn't be extended to cover various Windows'isms.
I've only tried it on the headers that I've been trying to use (pthread.h and netdb.h, which are of respectable size once preprocessed) - read: I've added conversions and transformations until dmd will parse the resulting module and allow me to call functions, but there's no crap like 'if (name == "netdb.h") { do netdb stuff... } else { ... }'.
It isn't blindingly fast - but it can parse a whole file while you're still writing your first 'extern (C)'
Back to top
View user's profile Send private message
Cabal



Joined: 28 Apr 2004
Posts: 18
Location: UK

PostPosted: Sun May 30, 2004 1:32 pm    Post subject: Reply with quote

If I were the sensitive sort I'd be feeling pretty rejected by now Smile

Has no-one got a use for this thing? Not even a little bit of a use?
Back to top
View user's profile Send private message
brad
Site Admin


Joined: 22 Feb 2004
Posts: 490
Location: Atlanta, GA USA

PostPosted: Sun May 30, 2004 1:58 pm    Post subject: Reply with quote

I can definitely set up the project for you. I would attempt to use it to try to wrap Expat headers.

Let me know if you have a name and some code to check into the project. Everything keys off of the project name right now...
_________________
I really like the vest!
Back to top
View user's profile Send private message
Cabal



Joined: 28 Apr 2004
Posts: 18
Location: UK

PostPosted: Sun May 30, 2004 2:48 pm    Post subject: Reply with quote

I thought 'h2d' might be appropriate - and nothing comes up under that name on freshmeat...

I'll have a quick look at what it makes of the expat headers after I get the opengl headers sorted
Back to top
View user's profile Send private message
qbert



Joined: 30 Mar 2004
Posts: 209
Location: Dallas, Texas

PostPosted: Sun May 30, 2004 8:07 pm    Post subject: Reply with quote

Thats a huge task ( C header conversion ) , I would defintly use it but i couldnt offer anything more than bug reports.

C
Back to top
View user's profile Send private message MSN Messenger
clayasaurus



Joined: 21 May 2004
Posts: 857

PostPosted: Thu Jun 03, 2004 8:23 pm    Post subject: Reply with quote

a h to d conversion tool would be highly appreciated. its the project that everyone needs but no one wants to do.

oh, and about extern (C) blocks and windowisms. i program on linux, but i don't need to do extern (C) in front of all my functions, rather i do

version(linux)
extern (C):

version (Windows)
extern (Windows):

this will cause the whole C header file to be either extern C or Windows, depending on the system. never tested it on windows but the linux part works.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> h2d All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group