htod - convert C .h files to D import files

Lionello Lunesu lionello at lunesu.remove.com
Tue May 23 11:26:00 PDT 2006


"Walter Bright" <newshound at digitalmars.com> wrote in message 
news:e4vhd6$25ti$1 at digitaldaemon.com...
> Lionello Lunesu wrote:
>> I have found some other issues with htod, but am reluctant to post them. 
>> Don't want Walter's focus to shift to other tools. (Who am I to worry 
>> about Walter's focus? :S)
>>
>> Anyway, here are some things to keep in mind when using htod:
>>
>> * signed char => sbyte
> What's the issue?

dmd claims (correctly) it doesn't know about sbyte:
gl.d(42): identifier 'sbyte' is not defined

>> * wchar_t not known (it's built-in in vc?)
> Hmm. Example?

const wchar_t* APIENTRY gluErrorUnicodeStringEXT (
    GLenum   errCode);

wchar_t wasn't defined anywhere (although I can find it in the headers, but 
it must have been ifdef'ed or something). And I think it's indeed handled as 
a built-in type by VC, which might be the reason why it's not typedef'en 
explicitely. This header is from the PlatformSDK, by the way, so I was 
expecting some ms-only stuff.

>> * void func( void (*callback)(void) ) => void func( void 
>> function(...)callback );
> That's correct.

Thought so. Still, useful info for a knowledge base : )

>> * comments are 1 line off
> This can happen with macros, but it shouldn't happen with declarations.

I'll have to check the exact occurence at the office tomorrow, but it 
happened during the conversion of gl.h (as did the others):

#define SOME_CONSTANT 123   /* multi-line
                      comment */
=>
/* multi-line
const SOME_CONSTANT = 123;
                      comment */
The code ended up being commented and I had to shift it up (or down; don't 
recall).

Just another thing to be noted, that's all.

All-in-all, it still saved me a lot of time!

L. 





More information about the Digitalmars-d-announce mailing list