July 08, 2012
On Sunday, July 08, 2012 01:36:14 Walter Bright wrote:
> On 7/7/2012 8:40 PM, Andrei Alexandrescu wrote:
> > http://www.reddit.com/r/programming/comments/w7hbg/dstep_tool_for_translat ing_c_and_objc_headers/
> Gotta change the name:

c2d?

- Jonathan M Davis
July 09, 2012
On 7/8/2012 1:01 PM, Jacob Carlborg wrote:
> That is not completely true if one is picky. The following code is legal C, but
> not legal Objective-C :
>
> int id;
> int nil;
>
> In Objective-C "id" is a type.

What do people do in OC makefiles?



>> The name makes more sense now, but for marketing reasons it should give
>> more of a clue as to what it does.
>
> Do you have a suggestion?

CtoD ?


July 09, 2012
On 7/8/2012 3:27 PM, Dmitry Olshansky wrote:
> I think extra syntax could be added easily WHEN the need arrives, so far 1:1
> converters to extension feels fine.

I don't think CTFE is good enough to parse C code in all its complex glory - and it would be 1000 times too slow if it did.


July 09, 2012
On Sunday, July 08, 2012 18:39:54 Walter Bright wrote:
> On 7/8/2012 3:27 PM, Dmitry Olshansky wrote:
> > I think extra syntax could be added easily WHEN the need arrives, so far 1:1 converters to extension feels fine.
> 
> I don't think CTFE is good enough to parse C code in all its complex glory - and it would be 1000 times too slow if it did.

Unless you need to get at an external program or file, I would fully expect to be able to write a fully functional C parser using only CTFE-usable constructs. However, I expect that it would be disgusting to do so, and as you say, it would be horribly inefficient.

- Jonathan M Davis
July 09, 2012
On 7/8/12 9:39 PM, Walter Bright wrote:
> On 7/8/2012 3:27 PM, Dmitry Olshansky wrote:
>> I think extra syntax could be added easily WHEN the need arrives, so
>> far 1:1
>> converters to extension feels fine.
>
> I don't think CTFE is good enough to parse C code in all its complex
> glory

disagree

 - and it would be 1000 times too slow if it did.

agree (for now)


Andrei
July 09, 2012
> What do people do in OC makefiles?

With Clang you can use the -ObjC or "-x objective-c" flags. But I guess most people use Xcode and not makefiles.

> CtoD ?

I'll have to think about it.

-- 
/Jacob Carlborg
July 09, 2012
On 2012-07-08 23:22, Jonathan Andrew wrote:

> Jacob,

> The only disadvantage to the single-file limitation is that in the case
> of GTK at least, it has preprocessor directives to keep you from just
> #include-ing the single file you want to convert, so I just used sed to
> strip out all the #error directives that come up and force it to do my
> bidding. I understand DStep doesn't deal with preprocessor yet, but as
> far as the CLang front-end it uses goes, it might be helpful to find a
> way to turn off #error-s.

I had no idea about that.

> sed -i 's/#error/\/\//g' *.h
>
> The next step was to rename all the D reserved words that GTK used as
> function arguments - in, out, function, and align are the only ones I
> can think of off the top of my head. Easy fix for the user (by no means
> am I complaining), but if you want to streamline the conversion,
> automatically renaming these kinds of arguments might be a helpful option.

I thought the tool did that already.

> Then, renaming all the duplicate empty struct{} entries in some of the
> files. You already know about this, but it was probably the most
> time-consuming part of the process for converting GTK, at least. I
> couldn't think of an easy way to automate this on my end, because some
> of the empty structs were necessary to get it to compile.

I thought I had fixed this too. I'll have to take a look.

> Finally, putting import statements in all the .d files after I was done.
> Still a long way to go on this (500 files).
>
> Sorry for the long post, this is probably obvious stuff to everybody
> else, but I was really impressed with DStep - thank you for creating it!

No it's good, this is just what I wanted people to do. It would be great if you could report these issues:

https://github.com/jacob-carlborg/dstep/issues

If you have a simple test case or a header I can try that would be great.

-- 
/Jacob Carlborg
July 09, 2012
Jacob Carlborg , dans le message (digitalmars.D.announce:23893), a
 écrit :
> 
>> What do people do in OC makefiles?
> 
> With Clang you can use the -ObjC or "-x objective-c" flags. But I guess most people use Xcode and not makefiles.
> 
>> CtoD ?
> 
> I'll have to think about it.
> 
> -- 
> /Jacob Carlborg

CtoDi ? I suppose the tool translates interface only, not the code.

July 09, 2012
On Monday, 9 July 2012 at 07:27:35 UTC, travert@phare.normalesup.org (Christophe Travert) wrote:
> Jacob Carlborg , dans le message (digitalmars.D.announce:23893), a
>  écrit :
>> 
>>> What do people do in OC makefiles?
>> 
>> With Clang you can use the -ObjC or "-x objective-c" flags. But I guess most people use Xcode and not makefiles.
>> 
>>> CtoD ?
>> 
>> I'll have to think about it.
>> 
>> --
>> /Jacob Carlborg
>
> CtoDi ? I suppose the tool translates interface only, not the code.

If I were him, I would choose "cited"

July 09, 2012
On 2012-07-09 09:27, Christophe Travert wrote:

> CtoDi ? I suppose the tool translates interface only, not the code.
>

Yes, only declarations.

-- 
/Jacob Carlborg