Changeset 418 for branches/thune

Show
Ignore:
Timestamp:
06/22/07 20:53:36 (17 months ago)
Author:
krobillard
Message:

Rune works again.

Location:
branches/thune/thread_safe
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • branches/thune/thread_safe/gc.c

    r387 r418  
    446446    blk.used      = UR_TOS - UR_BOS; 
    447447 
     448#ifndef LANG_RUNE 
    448449    assert( ur_is(UR_BOS, UT_UNSET) ); 
     450#endif 
    449451    assert( blk.used > -1 ); 
    450452 
  • branches/thune/thread_safe/rune/project.r

    r323 r418  
    1414    cflags {-DUR_CONFIG_TRIG} 
    1515    cflags {-DUR_CONFIG_MATH3D} 
    16     cflags {-DUR_CONFIG_DT_CODE} 
     16    ;cflags {-DUR_CONFIG_DT_CODE} 
    1717    ;cflags {-DUR_CONFIG_MACROS} 
    1818    ;cflags {-DUR_CONFIG_EMH} 
     
    5858        %files.c 
    5959        %math.c 
     60        %bignum.c 
    6061        %support/mt19937ar.c 
    6162    ] 
  • branches/thune/thread_safe/rune/rune.c

    r351 r418  
    4141 
    4242 
    43 #define OR_TOC          ur_thread->toc 
    44 #define OR_BOC          ur_thread->cstack 
     43#define OR_TOC          ut->toc 
     44#define OR_BOC          ut->cstack 
    4545 
    4646#define ur_funcFetch(cell)  cell->func.closureN 
     
    140140 
    141141#ifdef DEBUG 
    142 void dumpControl() 
     142void dumpControl( UThread* ut ) 
    143143{ 
    144144    UString str; 
    145145    UString* sp = &str; 
    146     UCell* it  = ur_env->threads->cstack; 
    147     UCell* end = ur_env->threads->toc + 1; 
     146    UCell* it  = ut->cstack; 
     147    UCell* end = ut->toc + 1; 
    148148 
    149149    ur_arrayInit( sp, 1, 0 ); 
     
    164164 
    165165 
    166 static int _verifyArgs( UThread* ur_thread, UCell* dt, int count ) 
     166static int _verifyArgs( UThread* ut, UCell* dt, int count ) 
    167167{ 
    168168    UCell* it; 
     
    210210extern int ur_getSelector( UThread*, const UCell* sel, UCell* res ); 
    211211 
    212 int ur_eval( UThread* ur_thread, UIndex blkN, UIndex si ) 
     212int ur_eval( UThread* ut, UIndex blkN, UIndex si ) 
    213213{ 
    214214    UBlock* blk; 
     
    245245                { 
    246246                    // Return from function. 
    247                     cval = UR_LF_BEG->localFrame.cell; 
     247                    cval = UR_LF_BEG->cell; 
    248248                    UR_LF_POP; 
    249249                    ur_copyCell(cval, *val); 
     
    285285    if( ur_is(pc, UT_WORD) ) 
    286286    { 
    287         val = ur_wordCell( ur_thread, pc ); 
     287        val = ur_wordCell( ut, pc ); 
    288288    } 
    289289    else 
     
    301301 
    302302        case UT_GETWORD: 
    303             val = ur_wordCell( ur_thread, val ); 
     303            val = ur_wordCell( ut, val ); 
    304304            break; 
    305305 
     
    373373 
    374374        case UT_SELECT: 
    375             if( ! ur_getSelector( ur_thread, val, UR_TOS ) ) 
     375            if( ! ur_getSelector( ut, val, UR_TOS ) ) 
    376376            { 
    377377                --pc; 
     
    523523                case ROP_EACH_LOOP: 
    524524                    val = ur_s_prev(UR_TOS); 
    525                     if( ur_itLen( val ) > 0 ) 
     525                    if( ur_itLen( ut, val ) > 0 ) 
    526526                    { 
    527                         cval = ur_wordCell( ur_thread, ur_s_prev(val) ); 
     527                        cval = ur_wordCell( ut, ur_s_prev(val) ); 
    528528                        if( ! cval ) 
    529529                            goto op_throw; 
    530                         ur_pick( val, 0, cval ); 
     530                        ur_pick( ut, val, 0, cval ); 
    531531                        val->series.it++; 
    532532                        val = UR_TOS; 
     
    553553        case UT_SETWORD: 
    554554            LOOK_AHEAD_FOR_INFIX 
    555             cval = ur_wordCell( ur_thread, OR_TOC ); 
     555            cval = ur_wordCell( ut, OR_TOC ); 
    556556            if( ! cval ) 
    557557            { 
     
    636636do_call: 
    637637 
    638     //printf( "KR call %ld\n", UR_TOS - ur_thread->dstack ); 
    639  
    640     val->call.addr( ur_thread, UR_TOS ); 
     638    //printf( "KR call %ld\n", UR_TOS - ut->dstack ); 
     639 
     640    val->call.addr( ut, UR_TOS ); 
    641641    val = UR_TOS; 
    642642    UR_S_DROP; 
     
    680680        int locc = totc - argc; 
    681681 
    682         UR_LF_PUSH( -val->func.sigN, UR_TOS - (argc - 1) ); 
     682        //UR_LF_PUSH( -val->func.sigN, UR_TOS - (argc - 1) ); 
     683        --ut->localFT; 
     684        UR_LF_BEG->cell = UR_TOS - (argc - 1); 
     685        UR_LF_BEG->n    = val->func.sigN; 
     686 
    683687 
    684688        if( argc ) 
    685689        { 
    686690            blk = ur_blockPtr( val->func.sigN ); 
    687             if( ! _verifyArgs( ur_thread, blk->ptr.cells + totc, argc ) ) 
     691            if( ! _verifyArgs( ut, blk->ptr.cells + totc, argc ) ) 
    688692                goto op_throw; 
    689693        } 
     
    854858trace_error: 
    855859 
    856     _appendTraceBlk( &UR_TOS->err, blkN, pc - start ); 
     860    _appendTraceBlk( ut, &UR_TOS->err, blkN, pc - start ); 
    857861 
    858862error: 
     
    886890        putchar( ur_char(tos) ); 
    887891    } 
    888     else if( ur_stringSlice(tos, &it, &end) && it ) 
     892    else if( ur_stringSlice(ut, tos, &it, &end) && it ) 
    889893    { 
    890894        if( ur_encoding(tos) == UR_ENC_UTF16 ) 
     
    908912{ 
    909913    UString* str; 
    910     str = ur_binPtr( ur_thread->callTempBinN ); 
     914    str = ur_binPtr( BIN_THREAD_TMP ); 
    911915    str->used = 0; 
    912916    ur_toStr( tos, str, 0 ); 
     
    917921    tos = UR_TOS; 
    918922    ur_initType( tos, UT_STRING ); 
    919     ur_setSeries( tos, ur_thread->callTempBinN, 0 ); 
    920     rc_cout( ur_thread, tos ); 
     923    ur_setSeries( tos, BIN_THREAD_TMP, 0 ); 
     924    rc_cout( ut, tos ); 
    921925    UR_S_DROP; 
    922926} 
     
    927931UR_CALL( rc_func_loop ) 
    928932{ 
    929     uc_func( ur_thread, tos ); 
     933    uc_func( ut, tos ); 
    930934    UR_TOS->func.flags |= UR_FLAG_FUNC_LOOP; 
    931935} 
     
    940944 
    941945 
    942 extern UIndex _funcSignature( const UCell* scell, int* pArgc, int* pVarc ); 
     946extern UIndex _funcSignature( UThread*, const UCell*, int* pArgc, int* pVarc ); 
    943947 
    944948// (block -- block) 
     
    961965        { 
    962966            assert( ur_is(it, UT_WORD) ); 
    963             val = ur_wordCell( ur_thread, it ); 
     967            val = ur_wordCell( ut, it ); 
    964968            ++it; 
    965969            assert( ur_is(it, UT_BLOCK) ); 
     
    968972            { 
    969973                /* LIMIT: All Rune call sigN blocks must be in first 65k. */ 
    970                 val->call.sigN  = _funcSignature( it, &argc, &varc ); 
     974                val->call.sigN  = _funcSignature( ut, it, &argc, &varc ); 
    971975                ur_argc(val)    = argc; 
    972976                ur_varc(val)    = 0; //varc 
     
    9991003 
    10001004 
    1001 void rune_install( UrlanEnv* env ) 
    1002 { 
    1003     ur_makeCalls( env, rune_calls, sizeof(rune_calls) / sizeof(UCallDef) ); 
     1005void rune_install( UThread* ut ) 
     1006{ 
     1007    ur_makeCalls( ut, rune_calls, sizeof(rune_calls) / sizeof(UCallDef) ); 
    10041008 
    10051009    // Bootstrap declare-natives 
    10061010    { 
    1007     UCell* val = ur_resolveArgPath( UT_WORD, 
    1008                                     ur_intern(env, "declare-natives", 15), 
    1009                                     UT_NONE ); 
     1011    UCell* val = ur_resolvePath( ut, ur_intern("declare-natives", 15), 
     1012                                 UT_NONE ); 
    10101013    if( val ) 
    10111014    { 
  • branches/thune/thread_safe/unix/os.c

    r387 r418  
    313313 
    314314#if 0 
    315 static void _callOutput( UThread* thread, UCell* tos ) 
     315static void _callOutput( UThread* ut, UCell* tos ) 
    316316{ 
    317317#define BUFSIZE     512 
     
    386386static int _asyncProcCount = 0; 
    387387 
    388 static void _callSimple( UThread* thread, UCell* tos ) 
     388static void _callSimple( UThread* ut, UCell* tos ) 
    389389{ 
    390390    int pid; 
     
    461461    if( orRefineSet( REF_CALL_OUTPUT ) ) 
    462462    { 
    463         _callOutput( thread, tos ); 
     463        _callOutput( ut, tos ); 
    464464    } 
    465465    else 
    466466    */ 
    467467    { 
    468         _callSimple( thread, tos ); 
     468        _callSimple( ut, tos ); 
    469469    } 
    470470} 
  • branches/thune/thread_safe/urlan.c

    r408 r418  
    9696    "code!", 
    9797    "port!", 
    98     "struct!" 
     98    "struct!", 
     99    "component!", 
     100    "plug!" 
    99101}; 
    100102 
     
    438440#endif 
    439441#ifdef LANG_RUNE 
    440 extern void rune_install( UrlanEnv* ); 
     442extern void rune_install( UThread* ); 
    441443#endif 
    442444 
     
    519521 
    520522#ifdef LANG_RUNE 
    521     rune_install( env ); 
     523    rune_install( ut ); 
    522524#endif 
    523525 
     
    550552#elif defined(__APPLE__) 
    551553        ur_setUnbound( cell, ur_intern( "mac-osx", 7 ) ); 
     554#elif defined(__sun__) 
     555        ur_setUnbound( cell, ur_intern( "solaris", 7 ) ); 
    552556#elif defined(_WIN32) 
    553557        ur_setUnbound( cell, ur_intern( "windows", 7 ) ); 
  • branches/thune/thread_safe/urlan.h

    r417 r418  
    7878#define UT_PORT         36 
    7979#define UT_STRUCT       37 
    80  
    81 #define UT_BI_COUNT     38 
     80#define UT_COMPONENT    38 
     81#define UT_PLUG         39 
     82 
     83#define UT_BI_COUNT     40 
    8284#define UT_MAX          64 
    8385#define UT_TYPEMASK     99 
     
    202204 
    203205 
    204 /* 
    205206typedef struct 
    206207{ 
     
    208209    uint8_t  flags; 
    209210    uint16_t inputMask; 
    210     UIndex   wordN; 
    211     UIndex   valN; 
     211    UIndex   wordN;     /* wordBlk at same position as in context. */ 
     212    UIndex   valN;      /* valBlk  at same position as in context. */ 
    212213    UIndex   bodyN; 
    213214} 
    214215UCellComponent; 
    215 */ 
    216216 
    217217 
     
    359359    UCellContext  ctx; 
    360360    UCellContext  port; 
    361     //UCellComponent  comp; 
    362361    UCellCall     call; 
    363362    UCellFunction func; 
     
    372371    UCellError    err; 
    373372    UCellCode     code; 
     373    UCellComponent comp; 
    374374} 
    375375UCell;