www.digitalmars.com         C & C++   DMDScript  

D.gnu - .h -> .d hints?

reply Lws <eluusive sbcglobal.net> writes:
As i mentioned before i'm trying to make a stub for Carbon on MacOS X.  
Well I ran Carbon.h through the gcc's preprocessor and it came out at 
80,000 lines.   Is there some way I can more easily do this?
I'm essentially going through it by hand, and i'm not even 1000 lines 
through it.  I noticed some windows stuff APIs got ported really 
quickly.  I can't imagine they were any smaller.

Any ideas to speed this up would be great.
May 17 2004
parent reply J C Calvarese <jcc7 cox.net> writes:
Lws wrote:
 As i mentioned before i'm trying to make a stub for Carbon on MacOS X.  
 Well I ran Carbon.h through the gcc's preprocessor and it came out at 
 80,000 lines.   Is there some way I can more easily do this?
 I'm essentially going through it by hand, and i'm not even 1000 lines 
 through it.  I noticed some windows stuff APIs got ported really 
 quickly.  I can't imagine they were any smaller.
 
 Any ideas to speed this up would be great.

This is similar to a question posed yesterday at dsource.org. http://www.dsource.org/forums/viewtopic.php?t=139 I'll basically tell you what I told Xerpher: Andy's webpage (http://andy.tadan.us/d/) has an item called SWIG on it: "SWIG (with a D mode) This is a very early test to see how well SWIG could be used to generate D interfaces from existing C and C++ libraries. The outlook is anything but grim. (Last updated 21 Sep 2003)" Also, Y. Tomino (http://hp.vector.co.jp/authors/VA028375/d/windows.h.html) has a Perl script that he uses for converting Windows headers. These projects may be of use to you. -- Justin (a/k/a jcc7) http://jcc_7.tripod.com/d/
May 17 2004
parent John Fletcher <J.P.Fletcher aston.ac.uk> writes:
J C Calvarese wrote:

 Lws wrote:
 As i mentioned before i'm trying to make a stub for Carbon on MacOS X.
 Well I ran Carbon.h through the gcc's preprocessor and it came out at
 80,000 lines.   Is there some way I can more easily do this?
 I'm essentially going through it by hand, and i'm not even 1000 lines
 through it.  I noticed some windows stuff APIs got ported really
 quickly.  I can't imagine they were any smaller.

 Any ideas to speed this up would be great.

This is similar to a question posed yesterday at dsource.org. http://www.dsource.org/forums/viewtopic.php?t=139 I'll basically tell you what I told Xerpher: Andy's webpage (http://andy.tadan.us/d/) has an item called SWIG on it: "SWIG (with a D mode) This is a very early test to see how well SWIG could be used to generate D interfaces from existing C and C++ libraries. The outlook is anything but grim. (Last updated 21 Sep 2003)"

 --
 Justin (a/k/a jcc7)
 http://jcc_7.tripod.com/d/

Thank you for this reference to SWIG for D. I have used SWIG in the past for interfacing to Ruby and Tcl. I have now tried this one out on both Linux (Fedora Core 1) and Windows and have some tests working. John Fletcher
Jun 02 2004