www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - htod

reply Jason King <jhking airmail.net> writes:
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:\dir>htod -I c:\d\dm\include ocilib.h
Fatal error: unable to open input file 'stdlib.h'

C:\dir>dir c:\d\dm\include\stdlib.h
  Directory of c:\d\dm\include

07/28/2011  09:10 PM            12,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.
Aug 12 2011
next sibling parent reply Jonathan M Davis <jmdavisProg gmx.com> writes:
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:\dir>htod -I c:\d\dm\include ocilib.h
 Fatal error: unable to open input file 'stdlib.h'
 
 C:\dir>dir c:\d\dm\include\stdlib.h
   Directory of c:\d\dm\include
 
 07/28/2011  09:10 PM            12,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
Aug 12 2011
parent reply simendsjo <simendsjo gmail.com> writes:
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:\dir>htod -I c:\d\dm\include ocilib.h
 Fatal error: unable to open input file 'stdlib.h'

 C:\dir>dir c:\d\dm\include\stdlib.h
    Directory of c:\d\dm\include

 07/28/2011  09:10 PM            12,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.
Aug 12 2011
next sibling parent Jason King <jhking airmail.net> writes:
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.
Aug 12 2011
prev sibling next sibling parent reply Jacob Carlborg <doob me.com> writes:
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
Aug 12 2011
parent reply Trass3r <un known.com> writes:
Am 12.08.2011, 13:35 Uhr, schrieb Jacob Carlborg <doob 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.
Aug 12 2011
parent reply Jacob Carlborg <doob me.com> writes:
On 2011-08-12 13:48, Trass3r wrote:
 Am 12.08.2011, 13:35 Uhr, schrieb Jacob Carlborg <doob 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
Aug 12 2011
next sibling parent reply maarten van damme <maartenvd1994 gmail.com> writes:
Are you really working on a better htod?
will it try to convert ifdefs in version()?

2011/8/12 Jacob Carlborg <doob me.com>

 On 2011-08-12 13:48, Trass3r wrote:

 Am 12.08.2011, 13:35 Uhr, schrieb Jacob Carlborg <doob 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
Aug 12 2011
parent Jacob Carlborg <doob me.com> writes:
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 <doob me.com <mailto:doob me.com>>

     On 2011-08-12 13:48, Trass3r wrote:

         Am 12.08.2011, 13:35 Uhr, schrieb Jacob Carlborg <doob me.com
         <mailto:doob 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
Aug 13 2011
prev sibling parent reply Trass3r <un known.com> writes:
 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 :)
Aug 12 2011
next sibling parent Jacob Carlborg <doob me.com> writes:
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
Aug 13 2011
prev sibling parent Jacob Carlborg <doob me.com> writes:
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
Aug 15 2011
prev sibling parent Trass3r <un known.com> writes:
 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.
Aug 12 2011
prev sibling parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 8/12/11, Jason King <jhking 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:\dir>htod -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.
Aug 12 2011
parent Jason King <jhking airmail.net> writes:
Thank you very much, that solved my issue.

 C:\dir>htod -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.
Aug 15 2011