Re: htod (8.52.5n) not recognizing wchar_t?
Thanks!
Re: htod (8.52.5n) not recognizing wchar_t?
On Tuesday, September 26, 2017 07:33:57 DanielG via Digitalmars-d-learn wrote: > According to this page (https://dlang.org/htod.html), wchar_t > should be recognized as wchar. But I'm just getting an error: > "Error: ')' expected" ... anywhere a wchar_t appears in my .h > file. > > Anything I need to do? I'd prefer to keep this entire file > uncommented so I don't always have to hand-edit the results of > htod. I find it quite surprising that it doesn't like wchar_t, but depending on what version of C it's converting to, maybe wchar_t isn't officially part of it. I don't know. I would have expected it to work. However, regardless of this specific issue, htod hasn't been updated in quite a while, and if you really want to be automatically generating C bindings, I'd suggest that you look at dstep, which uses clang: http://code.dlang.org/packages/dstep https://github.com/jacob-carlborg/dstep - Jonathan M Davis
Re: htod for linux
On Friday, 21 April 2017 at 11:40:45 UTC, Mike Parker wrote: On Friday, 21 April 2017 at 10:54:26 UTC, سليمان السهمي (Soulaïman Sahmi) wrote: Is there an htod for linux or an equivalent that works with Cpp, there is dstep but it does not support Cpp. From the very bottom of the htod doc page [1]: "No Linux version." https://dlang.org/htod.html However, I wouldn't be surprised to get good results on wine.
Re: htod for linux
You may also want to try dstep - I just recently used that tool for the first time, and it worked really well (required a bit of tweaking of the source and result files though, but nothing major). => https://github.com/jacob-carlborg/dstep
Re: htod for linux
I think we need a dub package for the cpp standard library. If somebody has managed to get that together, it would be a great step towards better cpp interoperability.
Re: htod for linux
On Friday, 21 April 2017 at 12:10:04 UTC, Mike Parker wrote: The only thing I'm aware of is Binderoo [1]. According to the currently skinny wiki, binderoo_util [2] can be used to generate bindings if you're invested in using the whole set up. Ethan's scheduled to give a talk about it on Day 2 of DConf [3]. [1] https://github.com/Remedy-Entertainment/binderoo/wiki [2] https://github.com/Remedy-Entertainment/binderoo/wiki/binderoo_util [3] http://dconf.org/2017/talks/watson.html Thanks, I'll try that.
Re: htod for linux
On Friday, 21 April 2017 at 12:04:02 UTC, سليمان السهمي (Soulaïman Sahmi) wrote: On Friday, 21 April 2017 at 11:40:45 UTC, Mike Parker wrote: "No Linux version." That's a shame, any alternative with cpp support? It's quite painful to "port" something ubiquitous like std::string by hand. base_string.h is ugly, is arcane, even a parser would have a hard time with it. Hopefully it gets in core.stdcpp in the future. The only thing I'm aware of is Binderoo [1]. According to the currently skinny wiki, binderoo_util [2] can be used to generate bindings if you're invested in using the whole set up. Ethan's scheduled to give a talk about it on Day 2 of DConf [3]. [1] https://github.com/Remedy-Entertainment/binderoo/wiki [2] https://github.com/Remedy-Entertainment/binderoo/wiki/binderoo_util [3] http://dconf.org/2017/talks/watson.html
Re: htod for linux
On Friday, 21 April 2017 at 11:40:45 UTC, Mike Parker wrote: "No Linux version." That's a shame, any alternative with cpp support? It's quite painful to "port" something ubiquitous like std::string by hand. base_string.h is ugly, is arcane, even a parser would have a hard time with it. Hopefully it gets in core.stdcpp in the future.
Re: htod for linux
On Friday, 21 April 2017 at 10:54:26 UTC, سليمان السهمي (Soulaïman Sahmi) wrote: Is there an htod for linux or an equivalent that works with Cpp, there is dstep but it does not support Cpp. From the very bottom of the htod doc page [1]: "No Linux version." https://dlang.org/htod.html
Re: htod question
On Friday, 22 January 2016 at 01:04:50 UTC, Dibyendu Majumdar wrote: On Friday, 22 January 2016 at 01:03:09 UTC, Dibyendu Majumdar wrote: On Friday, 22 January 2016 at 00:52:59 UTC, W.J. wrote: Counter question: What's so bad about the D std library ? I am trying to create bindings for existing C library so I was trying to use htod for that. The library includes various C header files ... causing htod to fail Yeah, htod often requires preparing the files your trying to convert. Often removing macro's and the like. Its a manual process, and it can get dirty.
Re: htod question
On 2016-01-22 01:31, Dibyendu Majumdar wrote: I tried using htod but got errors as it could not handle the std C header files (Visual C++). How do people work around this? You could try DStep [1]. Although I'm not entirely sure if it works on Windows. It uses libclang, so if Clang can handle the header file it should work in DStep as well. [1] https://github.com/jacob-carlborg/dstep -- /Jacob Carlborg
Re: htod question
On Friday, 22 January 2016 at 00:31:01 UTC, Dibyendu Majumdar wrote: I tried using htod but got errors as it could not handle the std C header files (Visual C++). And probably never will. D doesn't have a preprocessor so it's kind of hard to automate the process. How do people work around this? Thanks and Regards Dibyendu They don't. Counter question: What's so bad about the D std library ?
Re: htod question
On Friday, 22 January 2016 at 00:52:59 UTC, W.J. wrote: Counter question: What's so bad about the D std library ? I am trying to create bindings for existing C library so I was trying to use htod for that.
Re: htod question
On Friday, 22 January 2016 at 01:03:09 UTC, Dibyendu Majumdar wrote: On Friday, 22 January 2016 at 00:52:59 UTC, W.J. wrote: Counter question: What's so bad about the D std library ? I am trying to create bindings for existing C library so I was trying to use htod for that. The library includes various C header files ... causing htod to fail
Re: htod question
On Friday, 22 January 2016 at 01:04:50 UTC, Dibyendu Majumdar wrote: On Friday, 22 January 2016 at 01:03:09 UTC, Dibyendu Majumdar wrote: On Friday, 22 January 2016 at 00:52:59 UTC, W.J. wrote: Counter question: What's so bad about the D std library ? I am trying to create bindings for existing C library so I was trying to use htod for that. The library includes various C header files ... causing htod to fail I see. I didn't quite understand your question correctly. I thought you were trying to port over the std c library. Maybe you can give an example ?
Re: htod - const
Why is 'const' removed? cause htod sucks. D1 didn't have const and htod wasn't updated for ages.
Re: htod - const
trass3r, I wouldn't say that it sucks. It has really helped a lot in porting some simple header files. It goes terribly bad on the more complex though.
Re: htod - const
Thanks Trass3r. On Tue, Mar 6, 2012, at 05:50 PM, Trass3r wrote: Why is 'const' removed? cause htod sucks. D1 didn't have const and htod wasn't updated for ages.
Re: htod - const
Am 06.03.2012, 20:13 Uhr, schrieb maarten van damme maartenvd1...@gmail.com: I wouldn't say that it sucks. It has really helped a lot in porting some simple header files. It goes terribly bad on the more complex though. Sadly, using regular expressions is much more efficient. At least those don't destroy the source by removing const, comments, evaluating preprocessor directives, etc.
Re: htod - const
On 3/6/12, Trass3r u...@known.com wrote: Sadly, using regular expressions is much more efficient. Do you have some script that does that and sorta works? I've tried others (e.g. dstep but couldn't get LLVM to compile unfortunately..).
Re: htod
Thank you very much, that solved my issue. C:\dirhtod -I c:\d\dm\include ocilib.h Fatal error: unable to open input file 'stdlib.h' You have an extra space there. Use: htod -IC:\d\dm\include ocilib.h That will work.
Re: htod
On 2011-08-13 04:13, Trass3r wrote: I'm working on a tool to convert C header files to D modules based on clang. But currently it's not a prioritized project. I also played with the idea. Clang's Rewrite facilities should be perfect for that. Yeah, I'm using Rewrite, if I recall correctly. Should really be a community effort :) If someone is interested I've add my clang fork to github: https://github.com/jacob-carlborg/clang -- /Jacob Carlborg
Re: htod
On 2011-08-13 02:59, maarten van damme wrote: Are you really working on a better htod? Yes, I guess so. will it try to convert ifdefs in version()? I don't know yet. I'm avoiding the preprocessor for as long as I can. 2011/8/12 Jacob Carlborg d...@me.com mailto:d...@me.com On 2011-08-12 13:48, Trass3r wrote: Am 12.08.2011, 13:35 Uhr, schrieb Jacob Carlborg d...@me.com mailto:d...@me.com: On 2011-08-12 11:36, simendsjo wrote: htod is a fork of dmc or something, right? How difficult is it to update the program to make it more user friendly? Is the source public? Would it be better to use gcc or clang instead? htod is a great thought, but I haven't either gotten it to work for anything but the simplest cases. I'm working on a tool to convert C header files to D modules based on clang. But currently it's not a prioritized project. I also played with the idea. Clang's Rewrite facilities should be perfect for that. Yeah, I'm using Rewrite, if I recall correctly. -- /Jacob Carlborg -- /Jacob Carlborg
Re: htod
On 2011-08-13 04:13, Trass3r wrote: I'm working on a tool to convert C header files to D modules based on clang. But currently it's not a prioritized project. I also played with the idea. Clang's Rewrite facilities should be perfect for that. Yeah, I'm using Rewrite, if I recall correctly. Should really be a community effort :) I guess so. It started out as a better implementation of my DStep project. To convert Objective-C headers to D modules. But since Objective-C is C as well it needs to handle all C as well. I guess I can put it on github. But currently it's patches for clang, just so I could get a quick start. -- /Jacob Carlborg
Re: htod
On Friday, August 12, 2011 04:07:47 Jason King wrote: I'm attempting to convert a c header to d using htod. If this is not current best practice please point me in another direction. C:\dirhtod -I c:\d\dm\include ocilib.h Fatal error: unable to open input file 'stdlib.h' C:\dirdir c:\d\dm\include\stdlib.h Directory of c:\d\dm\include 07/28/2011 09:10 PM12,553 stdlib.h 1 File(s) 12,553 bytes 0 Dir(s) 526,794,256,384 bytes free Putting stdlib.h in same dir with header I'm converting gives no joy either. There's nothing wrong with using htod if you can get it to work. However, the question is whether you can get it to work for what you're doing. And as I understand it, you're gonig to have to go over what it did after it did it, because it doesn't do a perfect job. But if you can get it to work, it's definitely desirable, since it'll save you a fair bit of work. But unfortunately, htod Windows-only, and I haven't been converting much C code lately, I don't know it well enough to really help you get it working. It _is_ worth using though. - Jonathan M Davis
Re: htod
On 12.08.2011 11:24, Jonathan M Davis wrote: On Friday, August 12, 2011 04:07:47 Jason King wrote: I'm attempting to convert a c header to d using htod. If this is not current best practice please point me in another direction. C:\dirhtod -I c:\d\dm\include ocilib.h Fatal error: unable to open input file 'stdlib.h' C:\dirdir c:\d\dm\include\stdlib.h Directory of c:\d\dm\include 07/28/2011 09:10 PM12,553 stdlib.h 1 File(s) 12,553 bytes 0 Dir(s) 526,794,256,384 bytes free Putting stdlib.h in same dir with header I'm converting gives no joy either. There's nothing wrong with using htod if you can get it to work. However, the question is whether you can get it to work for what you're doing. And as I understand it, you're gonig to have to go over what it did after it did it, because it doesn't do a perfect job. But if you can get it to work, it's definitely desirable, since it'll save you a fair bit of work. But unfortunately, htod Windows-only, and I haven't been converting much C code lately, I don't know it well enough to really help you get it working. It _is_ worth using though. - Jonathan M Davis htod is a fork of dmc or something, right? How difficult is it to update the program to make it more user friendly? Is the source public? Would it be better to use gcc or clang instead? htod is a great thought, but I haven't either gotten it to work for anything but the simplest cases.
Re: htod
My expectation is not that I can htod that 17k line header and magically have a d module. A lot of the header is #define'd constants and typedefs and I _do_ expect htod to remove some of the scutwork involved there. At this point I'd just be happy if it ran w/o error. There's nothing wrong with using htod if you can get it to work. However, the question is whether you can get it to work for what you're doing. And htod is a fork of dmc or something, right? How difficult is it to update the program to make it more user friendly? Is the source public? Would it be better to use gcc or clang instead? htod is a great thought, but I haven't either gotten it to work for anything but the simplest cases.
Re: htod
On 2011-08-12 11:36, simendsjo wrote: htod is a fork of dmc or something, right? How difficult is it to update the program to make it more user friendly? Is the source public? Would it be better to use gcc or clang instead? htod is a great thought, but I haven't either gotten it to work for anything but the simplest cases. I'm working on a tool to convert C header files to D modules based on clang. But currently it's not a prioritized project. -- /Jacob Carlborg
Re: htod
Am 12.08.2011, 13:35 Uhr, schrieb Jacob Carlborg d...@me.com: On 2011-08-12 11:36, simendsjo wrote: htod is a fork of dmc or something, right? How difficult is it to update the program to make it more user friendly? Is the source public? Would it be better to use gcc or clang instead? htod is a great thought, but I haven't either gotten it to work for anything but the simplest cases. I'm working on a tool to convert C header files to D modules based on clang. But currently it's not a prioritized project. I also played with the idea. Clang's Rewrite facilities should be perfect for that.
Re: htod
htod is a fork of dmc or something, right? Yep. How difficult is it to update the program to make it more user friendly? Only Walter can. Is the source public? No. Would it be better to use gcc or clang instead? Hell yeah. Clang's predestined for that.
Re: htod
On 8/12/11, Jason King jhk...@airmail.net wrote: I'm attempting to convert a c header to d using htod. If this is not current best practice please point me in another direction. C:\dirhtod -I c:\d\dm\include ocilib.h Fatal error: unable to open input file 'stdlib.h' You have an extra space there. Use: htod -IC:\d\dm\include ocilib.h That will work.
Re: htod
On 2011-08-12 13:48, Trass3r wrote: Am 12.08.2011, 13:35 Uhr, schrieb Jacob Carlborg d...@me.com: On 2011-08-12 11:36, simendsjo wrote: htod is a fork of dmc or something, right? How difficult is it to update the program to make it more user friendly? Is the source public? Would it be better to use gcc or clang instead? htod is a great thought, but I haven't either gotten it to work for anything but the simplest cases. I'm working on a tool to convert C header files to D modules based on clang. But currently it's not a prioritized project. I also played with the idea. Clang's Rewrite facilities should be perfect for that. Yeah, I'm using Rewrite, if I recall correctly. -- /Jacob Carlborg
Re: htod
I'm working on a tool to convert C header files to D modules based on clang. But currently it's not a prioritized project. I also played with the idea. Clang's Rewrite facilities should be perfect for that. Yeah, I'm using Rewrite, if I recall correctly. Should really be a community effort :)
Re: htod and system files
On 05.03.2011 20:04, Bekenn wrote: On 3/4/2011 3:31 PM, simendsjo wrote: The htod page, http://www.digitalmars.com/d/2.0/htod.html, says that system files will be included using the -hs option. htod mysql.h -hs Fatal error: unable to open input file 'sys/types.h' Does it try to find these files through an environment variable? htod is compatible with the -I and -D compiler switches from dmc. Use -I to reference to the directory containing the system headers you want to use. Ah, thanks. Doesn't seem dmc is a supported compiler though.. htod -hs -Ic:\d\dm\include mysql.h my_socket fd; /* For Perl DBI/dbd */ ^ mysql_com.h(268) : Error: ';' expected following declaration of struct member my_bool net_realloc(NET *net, size_t length); ^ mysql_com.h(422) : Error: ')' expected my_bool my_net_write(NET *net,const unsigned char *packet, size_t len); ^ mysql_com.h(424) : Error: ')' expected const unsigned char *header, size_t head_len, ^ mysql_com.h(426) : Error: ')' expected int net_real_write(NET *net,const unsigned char *packet, size_t len); ^ mysql_com.h(428) : Error: ')' expected Fatal error: too many errors