Changeset 426 for branches/thune/thread_safe/eval.c
- Timestamp:
- 07/05/07 04:03:51 (17 months ago)
- Files:
-
- 1 modified
-
branches/thune/thread_safe/eval.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/thune/thread_safe/eval.c
r417 r426 120 120 case UT_CONTEXT: 121 121 case UT_PORT: 122 #ifdef UR_CONFIG_DATAFLOW 123 case UT_COMPONENT: 124 #endif 122 125 { 123 126 int wrdN = ur_lookup( val, ur_sel(sel) ); … … 184 187 185 188 189 #ifdef UR_CONFIG_DATAFLOW 190 void ur_setPlug( UThread*, UBlock* cblk, UIndex wrdN, const UCell* nval ); 191 #endif 192 193 186 194 /** 187 195 Returns non-zero if successful. … … 242 250 break; 243 251 252 #ifdef UR_CONFIG_DATAFLOW 253 case UT_COMPONENT: 254 if( ur_selIsAtom(sel) ) 255 { 256 int wrdN; 257 wrdN = ur_lookup( val, ur_sel(sel) ); 258 ur_setPlug( ut, tBlockPtr(val->ctx.valBlk), wrdN, nval ); 259 return 1; 260 } 261 break; 262 #endif 263 244 264 default: 245 265 if( ! ur_selIsAtom(sel) ) … … 295 315 { 296 316 ur_type(tos) = UT_WORD; 317 } 318 else if( ur_is(tos, UT_LITSELECT) ) 319 { 320 ur_type(tos) = UT_SELECT; 297 321 } 298 322 // else leave tos unchanged... … … 366 390 { 367 391 case UR_BIND_THREAD: 392 #ifdef UR_CONFIG_DATAFLOW 393 case UR_BIND_PLUG: // Each component has its own body for now. 394 #endif 368 395 // ur_blockPtr( pc->word.valBlk ) 369 396 blk = (((UBlock*) ut->blocks.arr.ptr.v) + pc->word.valBlk); … … 404 431 } 405 432 433 _throwUnsetF( ut, pc, "Invalid bind mask" ); 406 434 return 0; 435 } 436 437 438 static int ur_setWord( UThread* ut, const UCell* pc, const UCell* val ) 439 { 440 UBlock* blk; 441 UCell* dest; 442 int wrdN; 443 444 wrdN = pc->word.index; 445 if( wrdN < 0 ) 446 { 447 _throwUnbound( ut, pc); // UR_UNBOUND 448 return 0; 449 } 450 451 switch( pc->word.flags & UR_FLAG_BIND_MASK ) 452 { 453 case UR_BIND_THREAD: 454 // ur_blockPtr( pc->word.valBlk ) 455 blk = (((UBlock*) ut->blocks.arr.ptr.v) + pc->word.valBlk); 456 dest = blk->ptr.cells + wrdN; 457 break; 458 459 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; 464 465 case UR_BIND_LOCAL: 466 { 467 LocalFrame* it = UR_LF_BEG; 468 LocalFrame* end = UR_LF_END; 469 while( it != end ) 470 { 471 if( it->n == pc->word.wordBlk ) 472 { 473 dest = it->cell + wrdN; 474 goto set_word; 475 } 476 ++it; 477 } 478 _throwUnsetF( ut, pc, "out-of-scope local" ); 479 return 0; 480 } 481 482 #ifdef UR_CONFIG_DATAFLOW 483 case UR_BIND_PLUG: 484 // Assuming there are no global components. 485 ur_setPlug( ut, tBlockPtr(pc->word.valBlk), wrdN, val ); 486 return 1; 487 #endif 488 489 default: 490 _throwUnsetF( ut, pc, "Invalid bind mask" ); 491 return 0; 492 } 493 494 set_word: 495 496 ur_copyCell(dest, *val); 497 return 1; 407 498 } 408 499 … … 1378 1469 argc = varc = 0; 1379 1470 1380 sigN = scell->series.n;1381 1471 blk = ur_block( scell ); 1382 1472 it = blk->ptr.cells; … … 1633 1723 #ifdef UR_CONFIG_NET 1634 1724 extern void uc_net_addr( UThread*, UCell* ); 1725 #endif 1726 #ifdef UR_CONFIG_DATAFLOW 1727 #include "component.c" 1635 1728 #endif 1636 1729 … … 1667 1760 #endif 1668 1761 #ifdef LANG_THUNE 1762 #ifdef UR_CONFIG_DATAFLOW 1763 { uc_component, "component" }, 1764 { uc_connect, "connect" }, 1765 #endif 1669 1766 #ifdef UR_CONFIG_THREADS 1670 1767 { uc_thread, "thread" },
