Changeset 276 for trunk/thune/eval.c

Show
Ignore:
Timestamp:
09/18/06 03:43:03 (2 years ago)
Author:
krobillard
Message:

Thune - Custom datatypes can now be created. Added raster! to GL.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/thune/eval.c

    r270 r276  
    186186 
    187187 
     188typedef int (*UDatatypeSelFunc)( UThread*, UCell*, const UCell*, UCell* ); 
     189 
    188190/** 
    189191  Returns non-zero if successful. 
     
    241243            } 
    242244                goto set_none; 
     245 
     246            default: 
     247                if( ur_type(val) >= UT_BI_COUNT ) 
     248                { 
     249                    UDatatypeSelFunc func = ur_thread->env->customDT 
     250                                [ ur_type(val) - UT_BI_COUNT ].selectAtom; 
     251                    if( func ) 
     252                        return func( ur_thread, val, sel, res ); 
     253                } 
     254                goto set_none; 
    243255        } 
    244256    } 
     
    391403                UString* str; 
    392404                ur_throwErr( ur_thread, UR_EX_DATATYPE, 
    393                              "found %s! at TOS-%d; expected ", 
     405                             "found %s at TOS-%d; expected ", 
    394406                             ur_typeName( ur_type(it) ), 
    395407                             count - (int) (end - it) ); 
     
    13421354 
    13431355    --pc; 
    1344     ur_throwErr( ur_thread, UR_EX_DATATYPE, "invalid type %s! for '%s opcode", 
     1356    ur_throwErr( ur_thread, UR_EX_DATATYPE, "invalid type %s for '%s opcode", 
    13451357                 ur_typeName( ur_type(UR_TOS) ), 
    13461358                 ur_atomCStr( ur_atom(pc), 0 ) ); 
     
    23462358            if( ur_atom(it) == UR_ATOM_BAR ) 
    23472359                inLocal = 1; 
    2348             else if( ur_atom(it) >= UT_COUNT ) 
     2360            else if( ur_atom(it) >= UT_BI_COUNT ) 
    23492361            { 
    23502362                if( ! inLocal ) 
     
    23692381            if( ur_atom(it) == UR_ATOM_BAR ) 
    23702382                inLocal = 1; 
    2371             else if( ur_atom(it) < UT_COUNT ) 
     2383            else if( ur_atom(it) < UT_BI_COUNT ) 
    23722384            { 
    23732385                UCell* cell = dst + varc - 1;