Changeset 428 for branches/thune

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

Components can now be copied. Added component test.

Location:
branches/thune/thread_safe
Files:
3 added
4 modified

Legend:

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

    r425 r428  
    2020 
    2121#include "internal.h" 
     22#include "component.h" 
    2223#include "urlan_atoms.h" 
    23  
    24  
    25 // Component Count Accessors 
    26 #define ur_ccIn(cell)   (cell)->coord.elem[0] 
    27 #define ur_ccOut(cell)  (cell)->coord.elem[1] 
    28 #define ur_ccLoc(cell)  (cell)->coord.elem[2] 
    29 #define ur_ccMask(cell) (cell)->coord.elem[3] 
    3024 
    3125 
     
    124118    return 0; //sigN; 
    125119} 
    126  
    127  
    128 /** 
    129 void ur_cloneComponent( UThread* ut, UCell* result, UCell* proto ) 
    130 { 
    131     (void) ut; 
    132     (void) result; 
    133     (void) proto; 
    134 } 
    135 */ 
    136120 
    137121 
  • branches/thune/thread_safe/internal.h

    r426 r428  
    1717//#define BLK_DSTACK          4 
    1818 
    19 enum ComponentContextValues 
    20 { 
    21     COMPONENT_SELF = 0, 
    22     COMPONENT_COUNTS, 
    23     COMPONENT_BODY, 
    24     COMPONENT_CELLS 
    25 }; 
    2619 
    2720#define initGCArray(af) \ 
  • branches/thune/thread_safe/make.c

    r427 r428  
    2929 
    3030 
     31//#define GC_STRESS_TEST  1 
     32 
     33 
    3134extern int64_t ur_stringToInt( const char*, const char*, const char** ); 
    3235extern int64_t ur_hexToInt( const char*, const char*, const char** ); 
     
    3437 
    3538extern UContext ur_thrGlobal; 
    36  
    37  
    38 //#define GC_STRESS_TEST  1 
    3939 
    4040 
  • 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...