C-style nested structs convert to D

2009-03-18 Thread CodexArcanum
Hey all, I'm trying to rewrite a few .h files into D so I can call a C library. 
 One snag I've hit is this guy:

struct _tree_t {
_tree_t* next;
_tree_t* father;
_tree_t* sons;
}

D won't do the nested struct thing, so I need to convert this into something D 
will like, but which the library will still take in.  What should I do?


How many people / projects are using Tango now?

2009-03-18 Thread Spacen Jasset

How many people / projects are using Tango at this time?

I am considering switching over to tango instead of phobos due to 
missing features, but mainly I think because of bugs that don't seem to 
get fixed.


I had a look round for a poll on my question but couldn't really see 
one. It seems to me that most people are using tango now though, for any 
amount of 'serious' work.


Re: How many people / projects are using Tango now?

2009-03-18 Thread Steve Schveighoffer
On Wed, 18 Mar 2009 10:50:23 +, Spacen Jasset wrote:

 How many people / projects are using Tango at this time?
 
 I am considering switching over to tango instead of phobos due to
 missing features, but mainly I think because of bugs that don't seem to
 get fixed.
 
 I had a look round for a poll on my question but couldn't really see
 one. It seems to me that most people are using tango now though, for any
 amount of 'serious' work.

I use Tango, and have used it to develop utilities for my company.  I 
tried using Phobos for about a week, but found the lack of support for 
socket and process I/O didn't fit my needs.  I'm sure it's improved since 
then (about 2 years ago), but it would be impossible for me to switch 
back now :)

I contribute regularly to Tango, and I enjoy that aspect of it.  I also 
find the developers more accessible and focused on practical matters 
versus not-yet-proven radical language features.  I'm not saying this in 
a negative way -- I think the steps Walter and Andrei are taking towards 
making D2 suitable for future needs are worth while -- but when one has 
to get work done, one needs to use something that works now :)

-Steve


Re: Segfault (NullPointerException) in Linux

2009-03-18 Thread Frank Benoit
Qian Xu schrieb:
--- code 2 (current solution) --
 
 public test(MyObj obj)
 {
   if (obj !is null 
   obj.getObj2 !is null 
   obj.getObj2.getObj3 !is null)
   {
  obj.getObj2.getObj3.test();
   }
 }
 
 --

If you want to be able to return something like nothing, you can use
NullObject. That is, return an object that lets you navigate the
references and lets you test for it being a null object.

auto o = obj.getObj2.getObj3;
if( !o.isNull() ){
o.test();
}


C callbacks?

2009-03-18 Thread Chris Andrews
I've hit another snag on my C library interfacing.  The .h defines a function:

//typedef bool (*TCOD_bsp_callback_t)(TCOD_bsp_t *node, void *userData);
bool* bsp_callback_t(bsp_t* node, void* userData); //bsp_t is a struct defining 
the bsp tree

Sidenote: Did I translate that right?

Anyway, this function is later passed into various functions, like:

bool bsp_traverse_pre_order(bsp_t *node, bsp_callback_t listener, void 
*userData);


I've tried doing some reading on this board regarding c callbacks and 
delegates, but it feels a bit over my head.  Can anyone assist me in figuring 
out how to D-ify this bit of code so I can interact with the C dll?