Re: Autogenerating wxEuphoria wrappers

new topic     » goto parent     » topic index » view thread      » older message » newer message
ghaberek said...

If you look at the NEW_CONTROL macro, it looks like the style parameter is an intptr_t, which is what get_int() returns.

Hrm... Well there's a larger problem I'm trying to deal with here. How is the wrapper generator supposed to know that style is a inptr_t? Based on the prototype, it looks like it's declared as a long:

long style = wxSB_HORIZONTAL

Obviously, the code generator isn't going to be able to know to look at the NEW_CONTROL macro. blink

I'll just assume that all long datatypes can be treated like this.

ghaberek said...

The pos and size parameters are passed as separate integers from Euphoria.

But again, how does the code generator know that? The prototypes that I'm using came from the wxWidgets website. Obviously, there was a decision that wxEuphoria would have constructors that didn't match those of wxWidgets.

That's fine, but the question then becomes how the wrapper generator gets informed of this, so it can generate the proper code.

You can't just change the parameters in the prototype, because the wrapper generator still needs to construct the correct call internally.

There are a couple ways to handle this. One is to make the assumption that all constructor calls that reference wxPoint and wxSize expect an integer pair, and have it generate appropriate code.

Another option would be to manually replace wxPoint and wxSize with WXPOINT and WXSIZE to inform the wrapper generator that these are intended to be replaced. I could add a flag like this:

%expand WXPOINT wxPoint( int x, int y ) : %expand WXSIZE wxSize( int x, int y )

so you could declare additional expansions if you needed, instead of having to modify the code generator.

Thoughts?

said...

Also, a wxValidator is passed by value and not by pointer, but in wxEuphoria, we can only pass things by pointer, so we have to de-reference to get its value.

Again, this is something that can be handled fairly easily by adding a flag to the prototype.

Since wxValidator is an optional parameter, it's a non-issue in this case. For places where wxEuphoria deviates from the wxWidgets prototypes, the fallback solution would be to use the {% ... }% directives to insert the new prototype, and then some additional directive telling it to create glue for that code.

ghaberek said...

Just use get_string() to get a wxString value from a sequence.

Excellent. I think I've got the "basic prototype to C++" code working fairly well, so I'll turn my attention to handling events and constants, since the wxStyledTextControl has a whole lot of those. I read your comments, but didn't have a chance to look through the wxEuphoria code yet.

Thanks!

- David

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu