What's the problem in opensourcing htod?

Iain Buclaw ibuclaw at ubuntu.com
Wed Dec 22 08:28:06 PST 2010


== Quote from Sean Kelly (sean at invisibleduck.org)'s article
> Mariusz Gliwiński Wrote:
> > Hello,
> > Why don't You make htod opensource? I don't think it has commercial
potential,
> > or I'm wrong? I'm asking, because it's a shame that people who wants publish
D
> > bindings have to make their own scripts for that (so bindings can be
generated
> > on !windows too).
> I hate to say it, but I've found that creating the D headers by hand is faster
than running htod and hand-editing to fix screw-ups.  Particularly if there are
any #if statements to contend with.

Hear hear. Although that does not mean that you are less likely to make the
occasional cock-up. *cough* RAND_MAX is == INT_MAX in GLIBC *cough* ;)


Thought I might give mention that part of GDC Phobos build process is using a
tailored (not very friendly) application to generate D source files from system C
headers that goes by the obscurely named x3.

An example job you can give it is:

x3_gi_push_header("<stdlib.h>");
x3_out_int_value("RAND_MAX");
x3_gi_pop_header();

Which outputs (on my system)

const int RAND_MAX = 2147483647;


I suppose there's nothing stopping someone to have a look at how it works and
bastardise it for normal usage. And though it's geared towards D1, does not emit
anything D2 can't handle.

Regards


More information about the Digitalmars-d mailing list