Changeset 327 for trunk/thune/make.c

Show
Ignore:
Timestamp:
12/27/06 20:33:47 (2 years ago)
Author:
krobillard
Message:

Thune - Can make select! from stack values.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/thune/make.c

    r323 r327  
    745745    return 0; 
    746746} 
     747 
     748 
     749/*--------------------------------------------------------------------------*/ 
     750 
     751 
     752#if 0 
     753typedef struct 
     754{ 
     755    UAtom    name; 
     756    uint16_t index; 
     757    UAtom    ctype; 
     758} 
     759UStructField; 
     760 
     761 
     762/* 
     763   [field1 type1  field2 type2 ...]   
     764*/ 
     765UIndex ur_makeStructCell( const UCell* from, UCell* res )  
     766{ 
     767    UArray* bin; 
     768    UIndex binN = 0; 
     769 
     770    if( ur_is(from, UT_BLOCK) ) 
     771    { 
     772        UBlock* blk; 
     773        UCell* it; 
     774        UCell* end; 
     775        int count; 
     776        UAtom wrd; 
     777 
     778        blk = ur_block( from ); 
     779        UR_ITER_BLOCK( it, end, blk, from ) 
     780 
     781        wrd = 0; 
     782        count = 0; 
     783 
     784        while( it != end ) 
     785        { 
     786            if( ur_is(it, UT_WORD) ) 
     787            { 
     788                if( count & 1 ) 
     789                { 
     790                    wrd = ur_atom(it); 
     791                } 
     792                else 
     793                { 
     794                    switch( ur_atom(it) ) 
     795                    { 
     796                        case UT_CHAR: 
     797                            break; 
     798                        case UT_INT: 
     799                            break; 
     800                        case UT_INT64: 
     801                            break; 
     802                        case UT_DECIMAL: 
     803                            break; 
     804                        case UT_VECTOR: 
     805                            break; 
     806                    } 
     807                } 
     808                ++count; 
     809            } 
     810 
     811            ++it; 
     812        } 
     813 
     814        binN = ur_makeBinary( end - it, &bin ); 
     815    } 
     816    //else if( ur_is(from, UT_STRUCT) ) { } 
     817 
     818    if( binN ) 
     819    { 
     820        ur_initType(res, UT_STRUCT); 
     821        ur_setSeries(res, binN, 0); 
     822        return binN; 
     823    } 
     824 
     825    return 0; 
     826} 
     827#endif 
    747828 
    748829 
     
    12031284  (opcode! code word -- value) 
    12041285  (binary! int bytes -- value) 
     1286  (select! word sel -- value) 
    12051287  (context block -- value) 
    12061288*/ 
     
    13141396                    goto error; 
    13151397            } 
     1398#ifdef LANG_THUNE 
     1399            else if( argc == 2 ) 
     1400            { 
     1401                UCell* wrd = ur_s_prev(tos); 
     1402                if( ! ur_isAWord(wrd) ) 
     1403                    goto error; 
     1404 
     1405                ur_copyCell( res, *wrd ); 
     1406                ur_type(res) = UT_SELECT; 
     1407 
     1408                if( ur_is(tos, UT_INT) ) 
     1409                { 
     1410                    res->id.flags &= ~UR_FLAG_SEL_ATOM; 
     1411                    ur_sel(res) = ur_int(tos); 
     1412                } 
     1413                else if( ur_isAWord(tos) ) 
     1414                { 
     1415                    res->id.flags |= UR_FLAG_SEL_ATOM; 
     1416                    ur_sel(res) = ur_atom(tos); 
     1417                } 
     1418            } 
     1419#endif 
    13161420            break; 
    13171421 
     
    15701674        { 
    15711675            // Make array before setting res in case GC is called. 
    1572             UIndex binN = ur_makeVectorCell( tos, res ); 
    1573             if( ! binN ) 
     1676            if( !  ur_makeVectorCell( tos, res ) ) 
    15741677                goto error; 
    15751678        } 
     
    16521755#endif 
    16531756 
     1757#if 0 
     1758        case UT_STRUCT: 
     1759            if( ! ur_makeStructCell( tos, res ) ) 
     1760                goto error; 
     1761            break; 
     1762#endif 
     1763 
    16541764        default: 
    16551765            if( ur_datatype(res) < UT_BI_COUNT )