www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - HTOD: Low hanging fruit

reply "Andre" <andre s-e-a-p.de> writes:
Hi,

HTOD is not able to translate a #define if the
value is in brackets like here:

#define SQL_STILL_EXECUTING			2
#define SQL_ERROR				(-1)
#define SQL_INVALID_HANDLE			(-2)
#define SQL_NEED_DATA				99
(Example from ODBC header file sql.h)

This seems like a low hanging fruit.

Kind regards
André
Dec 06 2013
parent reply "Dicebot" <public dicebot.lv> writes:
On Friday, 6 December 2013 at 15:04:18 UTC, Andre wrote:
 Hi,

 HTOD is not able to translate a #define if the
 value is in brackets like here:

 #define SQL_STILL_EXECUTING			2
 #define SQL_ERROR				(-1)
 #define SQL_INVALID_HANDLE			(-2)
 #define SQL_NEED_DATA				99
 (Example from ODBC header file sql.h)

 This seems like a low hanging fruit.

 Kind regards
 André
htod is old and unsupported. I recommend dstep (https://github.com/jacob-carlborg/dstep) which is based on libclang and thus naturally up to date with current C state.
Dec 06 2013
next sibling parent reply "Dicebot" <public dicebot.lv> writes:
To be honest I'd love htod to be completely removed from
dlang.org (and possibly replaced with dstep) as it does more harm
than good.
Dec 06 2013
parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 12/6/13 7:15 AM, Dicebot wrote:
 To be honest I'd love htod to be completely removed from
 dlang.org (and possibly replaced with dstep) as it does more harm
 than good.
I agree. Please send a pull request. Thanks, Andrei
Dec 06 2013
prev sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2013-12-06 16:14, Dicebot wrote:

 htod is old and unsupported. I recommend dstep
 (https://github.com/jacob-carlborg/dstep) which is based on libclang and
 thus naturally up to date with current C state.
DStep doesn't currently support any preprocessor handling, except for some simple includes. The C interface for libclang need to be extended to support handling the preprocessor as well. Contributions are always welcome. -- /Jacob Carlborg
Dec 06 2013
parent reply "Dicebot" <public dicebot.lv> writes:
On Friday, 6 December 2013 at 17:02:18 UTC, Jacob Carlborg wrote:
 On 2013-12-06 16:14, Dicebot wrote:

 htod is old and unsupported. I recommend dstep
 (https://github.com/jacob-carlborg/dstep) which is based on 
 libclang and
 thus naturally up to date with current C state.
DStep doesn't currently support any preprocessor handling, except for some simple includes. The C interface for libclang need to be extended to support handling the preprocessor as well. Contributions are always welcome.
Does it simply ignores preprocessor tokens or actually makes substitutions (but there is no D-ification)? I thought it is the latter.
Dec 06 2013
parent reply Jacob Carlborg <doob me.com> writes:
On 2013-12-06 18:10, Dicebot wrote:

 Does it simply ignores preprocessor tokens or actually makes
 substitutions (but there is no D-ification)? I thought it is the latter.
It does substitutions. I guess using libclang would be just like compiling with Clang but stop the process somewhere after the AST is created and before the code generating phase has started. -- /Jacob Carlborg
Dec 06 2013
parent reply Jacob Carlborg <doob me.com> writes:
On 2013-12-06 18:13, Jacob Carlborg wrote:

 It does substitutions. I guess using libclang would be just like
 compiling with Clang but stop the process somewhere after the AST is
 created and before the code generating phase has started.
This also has the unfortunate consequences that you can only generate bindings for one platform. -- /Jacob Carlborg
Dec 06 2013
parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 12/6/13, Jacob Carlborg <doob me.com> wrote:
 On 2013-12-06 18:13, Jacob Carlborg wrote:

 It does substitutions. I guess using libclang would be just like
 compiling with Clang but stop the process somewhere after the AST is
 created and before the code generating phase has started.
This also has the unfortunate consequences that you can only generate bindings for one platform.
I guess libtooling (http://clang.llvm.org/docs/LibTooling.html) would be a better fit for a codegenerator, but it's a C++ library.
Dec 06 2013
next sibling parent Jacob Carlborg <doob me.com> writes:
On 2013-12-06 19:35, Andrej Mitrovic wrote:

 I guess libtooling (http://clang.llvm.org/docs/LibTooling.html) would
 be a better fit for a codegenerator, but it's a C++ library.
I don't see what this would give me. libclang already handles command line parsing. DStep handles, in addition to those specified, all flags that Clang handles. -- /Jacob Carlborg
Dec 06 2013
prev sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2013-12-06 19:35, Andrej Mitrovic wrote:

 I guess libtooling (http://clang.llvm.org/docs/LibTooling.html) would
 be a better fit for a codegenerator, but it's a C++ library.
What would be better is to use the Clang C++ libraries since they already provide all the functionality needed. Although they are not stable and are C++ libraries. I'm actually quite satisfied I've come this far without needing to change a single thing in libclang itself. -- /Jacob Carlborg
Dec 06 2013
parent reply "Andre" <andre s-e-a-p.de> writes:
If DStep is the prefered solution would it be possible to also
provide a pre compiled binary for windows? This would make DStep
more user friendly.

=> Just trying to find out what is needed to compile DStep on a
windows machine, whether I need mambo/tango/s.th. else and
praying libclang is available for MS Windows... :)

Kind regards
André
Dec 07 2013
parent reply Jacob Carlborg <doob me.com> writes:
On 2013-12-07 18:53, Andre wrote:
 If DStep is the prefered solution would it be possible to also
 provide a pre compiled binary for windows? This would make DStep
 more user friendly.

 => Just trying to find out what is needed to compile DStep on a
 windows machine, whether I need mambo/tango/s.th. else and
 praying libclang is available for MS Windows... :)
To build DStep you need Tango, a couple of my libraries (mambo, dstack) and libclang. I plan to make it available through Dub. libclang is available for Windows. They provide experimental binaries for MinGW for version 3.1 and 3.2. I have already tried to build it on Windows, unfortunately it fails to pass the DStep tests. I think it was a segfault or similar. I haven't investigated any further. -- /Jacob Carlborg
Dec 08 2013
parent reply "John Colvin" <john.loughran.colvin gmail.com> writes:
On Sunday, 8 December 2013 at 17:25:44 UTC, Jacob Carlborg wrote:
 To build DStep you need Tango, a couple of my libraries (mambo, 
 dstack) and libclang. I plan to make it available through Dub.
How is that going?
Dec 09 2013
next sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2013-12-09 10:15, John Colvin wrote:

 How is that going?
I just haven't done it yet. I don't think it should be any problems. Although I'm not too happy I need to put my two utility libraries in Dub. They're not ready for that yet. -- /Jacob Carlborg
Dec 09 2013
parent reply "John Colvin" <john.loughran.colvin gmail.com> writes:
On Monday, 9 December 2013 at 15:33:22 UTC, Jacob Carlborg wrote:
 On 2013-12-09 10:15, John Colvin wrote:

 How is that going?
I just haven't done it yet. I don't think it should be any problems. Although I'm not too happy I need to put my two utility libraries in Dub. They're not ready for that yet.
Could you not use one of the pre/post build options to pull in the necessary github zip files? It's a bit of a hack but i think it could work. Then again, you could just add a -alpha suffix to the package names or similar to be absolutely clear they aren't polished products.
Dec 09 2013
parent Jacob Carlborg <doob me.com> writes:
On 2013-12-09 17:34, John Colvin wrote:

 Could you not use one of the pre/post build options to pull in the
 necessary github zip files? It's a bit of a hack but i think it could work.

 Then again, you could just add a -alpha suffix to the package names or
 similar to be absolutely clear they aren't polished products.
Yeah, I was think doing something like that. I just haven't had the time yet. -- /Jacob Carlborg
Dec 09 2013
prev sibling parent Jacob Carlborg <doob me.com> writes:
On 2013-12-09 10:15, John Colvin wrote:

 How is that going?
I just hit some issues with Dub. I'm considering it a blocker, hopefully there will be a solution: http://forum.rejectedsoftware.com/groups/rejectedsoftware.dub/thread/652/ -- /Jacob Carlborg
Dec 11 2013