Show
Ignore:
Timestamp:
05/30/08 18:36:20 (6 months ago)
Author:
krobillard
Message:

GL testfw reload works again.
Added UG_GUI_THROW macro to be used by widget event handlers.
Added gui_matchArgs() and GUI_PARSE macros.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/thune/gl/widgets/twidget.c

    r527 r528  
    4949{ 
    5050    GWidget* wp; 
     51    int ok; 
     52    const UCell* arg0; 
    5153    UThread* ut = ui->ut; 
    52     int ok; 
    53     const UCell* bc = ms->it + 1; 
    54  
    55     if( ((ms->end - ms->it) < 2) || (! ur_is(bc, UT_BLOCK)) ) 
    56     { 
    57         ms->error = "t-widget requires block!"; 
    58         return 0; 
    59     } 
    60  
    61     wp = gui_allocWidget( ui, classId ); 
    62     if( ! wp ) 
    63     { 
    64         ms->error = "allocWidget failed"; 
    65         return 0; 
    66     } 
    67  
    68     UR_S_PUSH( *bc ); 
    69     ok = ur_evalCStr( ut, "t-widget-context", 16 ); 
    70     if( ok != UR_EVAL_OK ) 
    71         return 0; 
    72  
    73     assert( ur_is(UR_TOS, UT_CONTEXT) ); 
    74     ur_copyCell( wp->cell, *UR_TOS ); 
    75     UR_S_DROP; 
    76  
    77     ms->it += 2; 
    78     return wp; 
     54 
     55    arg0 = gui_matchArgs( ms, 1, UT_BLOCK ); 
     56    if( arg0 ) 
     57    { 
     58        GUI_PARSE_ALLOC( wp ) 
     59 
     60        UR_S_PUSH( *arg0 ); 
     61        ok = ur_evalCStr( ut, "t-widget-context", 16 ); 
     62        if( ok != UR_EVAL_OK ) 
     63            return 0; 
     64 
     65        assert( ur_is(UR_TOS, UT_CONTEXT) ); 
     66        ur_copyCell( wp->cell, *UR_TOS ); 
     67        UR_S_DROP; 
     68 
     69        return wp; 
     70    } 
     71    GUI_PARSE_ERR( "t-widget requires block!" ); 
    7972} 
    8073 
     
    233226            UR_S_DROP; 
    234227        } 
     228        else 
     229        { 
     230            UG_GUI_THROW; 
     231        } 
    235232    } 
    236233}