Re: More automated interfacing of D with C codebases

2012-10-23 Thread Jacob Carlborg
On 2012-10-23 21:43, Brad Lanam wrote: Oh, maybe were you thinking that bash is the bourne shell? It's the bourne-again shell, a rewrite of the bourne shell. Solaris sh is probably the closest to the original bourne shell. I thought I said bash somewhere, but perhaps you didn't. My tool ru

Re: More automated interfacing of D with C codebases

2012-10-23 Thread Brad Lanam
On Tuesday, 23 October 2012 at 19:10:29 UTC, Jacob Carlborg wrote: On 2012-10-23 19:42, Brad Lanam wrote: All of these don't use the same shell. Requiring to install bash would mean you do need to install special tools. Not really special but additional tools. But I would count Cygwin as a spe

Re: More automated interfacing of D with C codebases

2012-10-23 Thread Jacob Carlborg
On 2012-10-23 19:42, Brad Lanam wrote: I'm sorry, I don't see how that follows. My scripts work on All variants of Linux (2.4, 2.6), Solaris (2.6 - 11), AIX, Tru64, HP-UX, All *BSD, Mac OSX, Haiku, QNX, SCO, Syllable, UnixWare, Windows Cygwin. My 'di' program builds on all of the above with a

Re: More automated interfacing of D with C codebases

2012-10-23 Thread Brad Lanam
On Tuesday, 23 October 2012 at 06:35:06 UTC, Jacob Carlborg wrote: On 2012-10-22 21:48, Brad Lanam wrote: How can you mention bourne shell and portability in the same sentence? I doesn't work on Windows (yes I know about cygwin and mingw). Clang does work on Windows, I just haven't been able t

Re: More automated interfacing of D with C codebases

2012-10-22 Thread Jacob Carlborg
On 2012-10-23 07:09, timotheecour wrote: If you try to automate processing of the pre-processed headers, all of the included system headers will be processed and too much that isn't needed will be output. Swig has lots of customization to control what gets translated. For example, we recursivel

Re: More automated interfacing of D with C codebases

2012-10-22 Thread Jacob Carlborg
On 2012-10-22 21:48, Brad Lanam wrote: Nothing wrong with that. I had different goals -- portability and legacy systems. My tool is all bourne shell and awk. There aren't many systems it does not work on (e.g. ULTRIX shell runs out of memory). How can you mention bourne shell and portability

Re: More automated interfacing of D with C codebases

2012-10-22 Thread Brad Lanam
On Monday, 22 October 2012 at 19:12:46 UTC, Jacob Carlborg wrote: On 2012-10-22 20:38, Brad Lanam wrote: I prefer the approach I took when I created DStep, it uses libclang. The tool can parse all C(++) and Objective-C(++) code that clang can. Although it currently won't generate code for ever

Re: More automated interfacing of D with C codebases

2012-10-22 Thread Brad Lanam
On Monday, 22 October 2012 at 19:12:46 UTC, Jacob Carlborg wrote: On 2012-10-22 20:38, Brad Lanam wrote: I prefer the approach I took when I created DStep, it uses libclang. The tool can parse all C(++) and Objective-C(++) code that clang can. Although it currently won't generate code for ever

Re: More automated interfacing of D with C codebases

2012-10-22 Thread Jacob Carlborg
On 2012-10-22 20:38, Brad Lanam wrote: Huge difference. It's not necessary to figure out corresponding type sizes on every system. I only need to figure out what needs to be in there. And once all the work of creating the interface file is done, the work of porting to another architecture or

Re: More automated interfacing of D with C codebases

2012-10-22 Thread Jacob Carlborg
On 2012-10-22 19:27, timotheecour wrote: http://www.swig.org/Doc1.1/HTML/SWIG.html#n7 One of SWIG's most recent additions is support for Objective-C parsing. This is currently an experimental feature that may be improved in future releases. Will this generate C code or can it be made to genera

Re: More automated interfacing of D with C codebases

2012-10-22 Thread Jacob Carlborg
On 2012-10-22 19:27, timotheecour wrote: SWIG requires some kind of interface files, which I assume one must have to manually write. Then what's the difference? These can be as small as: sfml.i: %{ #include %} %include SFML/Config.hpp %include SFML/Audio/Export.hpp In practice, some additio

Re: More automated interfacing of D with C codebases

2012-10-22 Thread Brad Lanam
On Monday, 22 October 2012 at 06:28:12 UTC, Jacob Carlborg wrote: On 2012-10-21 21:45, timotheecour wrote: Manually porting of C/C++ libraries shouldn't be the way to go (a major problem being when said library gets updated, human errors, porting to different architectures etc). SWIG require

Re: More automated interfacing of D with C codebases

2012-10-22 Thread timotheecour
correction regarding macros: myheader.h: #define MEX_INFORMATION_VERSION 1 interface file myheader.i: %{ %include "myheader.h" %} %include myheader.h generated d file will contain: int MEX_INFORMATION_VERSION() @property { auto ret = swig.mex_im.swig_mex_MEX_INFORMATION_VERSION_get(); retu

Re: More automated interfacing of D with C codebases

2012-10-22 Thread timotheecour
SWIG requires some kind of interface files, which I assume one must have to manually write. Then what's the difference? These can be as small as: sfml.i: %{ #include %} %include SFML/Config.hpp %include SFML/Audio/Export.hpp In practice, some additional tweaks may be needed to support certa

Re: More automated interfacing of D with C codebases

2012-10-21 Thread Jacob Carlborg
On 2012-10-21 21:45, timotheecour wrote: Manually porting of C/C++ libraries shouldn't be the way to go (a major problem being when said library gets updated, human errors, porting to different architectures etc). SWIG requires some kind of interface files, which I assume one must have to manu

Re: More automated interfacing of D with C codebases

2012-10-21 Thread Brad Lanam
On Sunday, 21 October 2012 at 19:45:53 UTC, timotheecour wrote: I've had good experience using SWIG to automate the job for me, and used it successfully to port the following libraries to D: Yes. SWIG should be a lot faster than my tool. Also I don't have any units to handle C++ code. Complet

Re: More automated interfacing of D with C codebases

2012-10-21 Thread timotheecour
Manually porting of C/C++ libraries shouldn't be the way to go (a major problem being when said library gets updated, human errors, porting to different architectures etc). I've had good experience using SWIG to automate the job for me, and used it successfully to port the following libraries to

Re: More automated interfacing of D with C codebases

2012-10-21 Thread Brad Lanam
I don't think this is exactly what you want either, but it's certainly a lot easier than a manual process: http://gentoo.com/di/mkconfig.html (On Freecode) https://freecode.com/projects/mkconfig I just now released a new version. Freecode will be updated within 24 hours. Check the examples/d

Re: More automated interfacing of D with C codebases

2012-10-15 Thread Jacob Carlborg
On 2012-10-15 19:20, CapitalLetterC wrote: But there are all sorts of issues in that same vein, like how certain structs get put together, what types are aliased with what, etc. That's why I was wondering if you could handle this analogously to how C does, with a config file that gets setup by a

Re: More automated interfacing of D with C codebases

2012-10-15 Thread CapitalLetterC
On Monday, 15 October 2012 at 12:54:51 UTC, Jacob Carlborg wrote: On 2012-10-15 13:51, CapitalLetterC wrote: This will be my first posting here, but I've been obsessed with D since before there was a D2 standard. Despite that rather long period of obsession, it's only just now that I've started

Re: More automated interfacing of D with C codebases

2012-10-15 Thread Jacob Carlborg
On 2012-10-15 13:51, CapitalLetterC wrote: This will be my first posting here, but I've been obsessed with D since before there was a D2 standard. Despite that rather long period of obsession, it's only just now that I've started seriously using D as I attempt to code-up some POC projects to demo