Show
Ignore:
Timestamp:
07/07/07 04:41:31 (17 months ago)
Author:
krobillard
Message:

Setting words in the shared global store now throws an error.
Default binding changed so top-level set-words are added to thread context.

Files:
1 modified

Legend:

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

    r426 r427  
    2424 
    2525 
    26 extern UContext ur_global; 
     26extern UContext ur_thrGlobal; 
    2727extern UContext ur_envGlobal; 
    2828 
     
    6666    int wrdN; 
    6767 
    68     global = (ut->env->blocks.arr.used) ? &ur_envGlobal : &ur_global; 
     68    global = (ut->env->blocks.arr.used) ? &ur_envGlobal : &ur_thrGlobal; 
    6969 
    7070    wrdN = ur_lookup( global, UR_ATOM_KERNEL_OPS ); 
     
    358358 
    359359 
    360 #define _throwUnset(th,cell)    _throwUnsetF(th,cell,"unset") 
    361 #define _throwUnbound(th,cell)  _throwUnsetF(th,cell,"unbound") 
     360#define _throwUnset(th,cell)    _throwUnsetF(th,cell,"is unset") 
     361#define _throwUnbound(th,cell)  _throwUnsetF(th,cell,"is unbound") 
    362362 
    363363static void _throwUnsetF( UThread* ut, const UCell* wcell, const char* umsg ) 
     
    368368    ur_atomStr( ur_atom(wcell), str ); 
    369369    ur_termCStr( str ); 
    370     ur_throwErr( UR_ERR_SCRIPT, "word '%s is %s", str->ptr.c, umsg ); 
     370    ur_throwErr( UR_ERR_SCRIPT, "word '%s %s", str->ptr.c, umsg ); 
    371371} 
    372372 
     
    413413                ++it; 
    414414            } 
    415             _throwUnsetF( ut, pc, "out-of-scope local" ); 
     415            _throwUnsetF( ut, pc, "is out-of-scope local" ); 
    416416            return 0; 
    417417        } 
     
    419419            if( pc->word.wordBlk != ut->localWordBlk ) 
    420420            { 
    421                 _throwUnsetF( ut, pc, "out-of-scope local" ); 
     421                _throwUnsetF( ut, pc, "is out-of-scope local" ); 
    422422                return 0; 
    423423            } 
     
    431431    } 
    432432 
    433     _throwUnsetF( ut, pc, "Invalid bind mask" ); 
     433    _throwUnsetF( ut, pc, "has invalid bind mask" ); 
    434434    return 0; 
    435435} 
     
    452452    { 
    453453        case UR_BIND_THREAD: 
    454             // ur_blockPtr( pc->word.valBlk ) 
    455             blk = (((UBlock*) ut->blocks.arr.ptr.v) + pc->word.valBlk); 
     454            blk = tBlockPtr( pc->word.valBlk ); 
    456455            dest = blk->ptr.cells + wrdN; 
    457456            break; 
    458457 
    459458        case UR_BIND_GLOBAL: 
    460             // ur_blockPtr( pc->word.valBlk ) 
    461             blk = (((UBlock*) ut->env->blocks.arr.ptr.v) - pc->word.valBlk); 
    462             dest = blk->ptr.cells + wrdN; 
    463             break; 
     459            _throwUnsetF( ut, pc, "is in shared global storage" ); 
     460            return 0; 
    464461 
    465462        case UR_BIND_LOCAL: 
     
    476473                ++it; 
    477474            } 
    478             _throwUnsetF( ut, pc, "out-of-scope local" ); 
     475            _throwUnsetF( ut, pc, "is out-of-scope local" ); 
    479476            return 0; 
    480477        } 
     
    482479#ifdef UR_CONFIG_DATAFLOW 
    483480        case UR_BIND_PLUG: 
    484             // Assuming there are no global components. 
     481            // Using tBlockPtr - assuming there are no global components. 
    485482            ur_setPlug( ut, tBlockPtr(pc->word.valBlk), wrdN, val ); 
    486483            return 1; 
     
    488485 
    489486        default: 
    490             _throwUnsetF( ut, pc, "Invalid bind mask" ); 
     487            _throwUnsetF( ut, pc, "has invalid bind mask" ); 
    491488            return 0; 
    492489    } 
     
    520517    if( end != cmd ) 
    521518    { 
    522         blkN = ur_tokenize( ut, cmd, end, 0 ); 
     519        blkN = ur_tokenize( ut, cmd, end ); 
    523520        if( blkN ) 
    524521        { 
     
    984981            if( tos->word.valBlk == BLK_GLOBAL_VAL ) 
    985982            { 
    986                 tos->word.index = ur_internWord( &ur_global, ur_atom(tos) ); 
     983                tos->word.index = ur_internWord( &ur_thrGlobal, ur_atom(tos) ); 
    987984            } 
    988985            else