Re: The Euphoria IDE Project

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

I'm going to start putting the next big version of wxEuphoria together

I had a look this weekend at getting wxEuphoria to run on Phix, and I made some notes on the matter. My apologies if this isn't helpful.

It seems I would need to suck alot of complexity out of libwxeu.dll (C++) into wxeud.e, specifically defaults, reference counting, and delete routines. In short, libwxeu.dll/so should contain absolutely no knowledge whatsoever of underlying data structures, and hence be compatible with both OpenEu and Phix.

Routines must be called/defined with atoms/pointers (C_INT etc), rather than E_SEQUENCE/E_OBJECT/E_ATOM/E_INTEGER. The logic for defaulted parameters would need to be moved out of wxeu.cpp, so for example (simplified/untested) instead of:

global function create(integer class, sequence params) 
object rid 
    rid = WX_CREATE_ARRAY[class] 
    return c_func(rid, {params}) 
end function 

and

#define NEW_CONTROL(control) \ 
        s1_ptr p = SEQ_PTR( params );\ 
        wxPoint pos = wxDefaultPosition;\ 
        wxSize size = wxDefaultSize;\ 
        intptr_t style = 0;\ 
        wxWindowID id = -1;\ 
        wxString caption(wxT(""));\ 
        \ 
        switch( p->length ){\ 
                case 8:\ 
                        style = get_int( params, 8 );\ 
                \ 
                case 7:\ 
                        size = wxSize( get_int( params, 6 ), get_int( params, 7 ) );\ 
                \ 
                case 6:\ 
                case 5:\ 
                        pos = wxPoint( get_int( params, 4 ), get_int( params, 5) );\ 
                \ 
                case 4:\ 
                case 3:\ 
                        caption = get_string( params, 3 );\ 
                case 2:\ 
                        id = get_int( params, 2 );\ 
                default:\ 
                        break;\ 
        }\ 
        control * cont = new control( (wxWindow *)get_int(params, 1),\ 
                        id, caption,\ 
                        pos, size, style );\ 
        wxDeRefDS(params);\ 
        return BOX_INT( cont ); 
It would be more like:

global function create(integer class, sequence params) 
object rid 
integer style = 0 
integer sizeX = -1, sizeY = -1 
integer posX = -1, posY = -1 
sequence caption = "" 
integer id = -1 
integer parent 
    switch length(params) with fallthrough 
      8: style = params[8] 
      7: sizeX = params[6] sizeY = params[7] 
      6,5: posX = params[4] posY = params[5] 
      4,3: caption = params[3] 
      2: id = params[2] 
      1: parent = params[1] 
    end switch 
    rid = WX_CREATE_ARRAY[class] 
    return c_func(rid, {parent,id,caption,posX,posY,sizeX,sizeY,style}) 
end function 

and

#define NEW_CONTROL(control) \ 
wxPoint pos = {posX,posY};\ 
wxSize size = {sizeX,sizeY};\ 
    return new control( (wxWindow *)parent, id, caption, pos, size, style ); 

I appreciate that with some 1,400 routines that may be a massive amount of work and I have no idea what impact it would have on performance, but it may lead to better errors, eg "type check error, caption is 0".

Also, I don't really understand why it needs wxDeRefDS() etc; I can only assume that because it is using E_SEQUENCE; params gets incref'd and ends up in libwxeu.dll with a ref count >=2? Unless you do on-the-fly creation in wxeud.e then the actual deallocation/calling of any delete routine etc will occur not in libwxeu.dll but in exeud.e when "params" gets decref'd or when some callee variable drops out of scope.

Anyway, that's where I got, like I said don't know if that is of any interest or use.

The alternative would be to rewrite wxeu.cpp pretty much from scratch, but embed the knowledge of the underlying Phix data structures rather than those of OpenEu.

Regards, Pete

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

Search



Quick Links

User menu

Not signed in.

Misc Menu