| 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!" ); |