Show
Ignore:
Timestamp:
07/07/07 23:25:19 (17 months ago)
Author:
krobillard
Message:

Components can now be copied. Added component test.

Files:
1 modified

Legend:

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

    r417 r428  
    1919 
    2020 
    21 #include "os.h" 
    22 #include "urlan.h" 
     21#include "internal.h" 
    2322#include "charset.h" 
    24 #include "internal.h" 
    2523#include "list.h" 
     24#ifdef UR_CONFIG_DATAFLOW 
     25#include "component.h" 
     26#endif 
    2627 
    2728 
     
    23562357            } 
    23572358            break; 
     2359 
     2360#ifdef UR_CONFIG_DATAFLOW 
     2361        case UT_COMPONENT: 
     2362        { 
     2363            UBlock* orig; 
     2364            UBlock* blk; 
     2365            UCell* cnt; 
     2366            UCell* it; 
     2367            UCell* end; 
     2368            UIndex blkN; 
     2369            int len; 
     2370 
     2371            orig = ur_blockPtr( val->ctx.valBlk ); 
     2372            it   = orig->ptr.cells; 
     2373            len  = orig->used; 
     2374            blkN = ur_makeBlockT( ut, len, &blk ); 
     2375 
     2376            ur_copyCells( it, it + len, blk->ptr.cells ); 
     2377            blk->used = len; 
     2378 
     2379            // Point result & self to new values. 
     2380            it = blk->ptr.cells + COMPONENT_SELF; 
     2381            val->ctx.valBlk = it->ctx.valBlk = blkN; 
     2382 
     2383            // Initialize input mask. 
     2384            cnt = blk->ptr.cells + COMPONENT_COUNTS; 
     2385            ur_ccMask(cnt) = 0xffff << ur_ccIn(cnt); 
     2386 
     2387            // Initialize plugs to unset. 
     2388            it = blk->ptr.cells + COMPONENT_CELLS; 
     2389            end = it + ur_ccIn(cnt) + ur_ccOut(cnt); 
     2390            while( it != end ) 
     2391            { 
     2392                ur_initType( it, UT_UNSET ); 
     2393                ++it; 
     2394            } 
     2395 
     2396            // Initialize locals to none. 
     2397            end = it + ur_ccLoc(cnt); 
     2398            while( it != end ) 
     2399            { 
     2400                ur_setNone( it ); 
     2401                ++it; 
     2402            } 
     2403 
     2404            // Copy & rebind body. 
     2405            it = blk->ptr.cells + COMPONENT_BODY; 
     2406            ur_clone( ut, it, UR_COPY_ALL, 1 ); 
     2407            ur_bindT( ut, it->series.n, val, UR_BIND_PLUG ); 
     2408        } 
     2409            break; 
     2410#endif 
    23582411 
    23592412        default:    // keep value...