Changeset 314 for trunk/thune/make.c

Show
Ignore:
Timestamp:
12/03/06 07:37:24 (2 years ago)
Author:
krobillard
Message:

Thune - Added ur_makeVector().

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/thune/make.c

    r312 r314  
    660660 
    661661 
     662UIndex ur_makeVector( int size, UArray** ptr ) 
     663{ 
     664    UIndex binN; 
     665    UArray* bin; 
     666 
     667    binN = ur_makeBinary( size * sizeof(int32_t) ); 
     668    bin = ur_binPtr( binN ); 
     669    bin->avail /= sizeof(int32_t); 
     670 
     671    if( ptr ) 
     672        *ptr = bin; 
     673 
     674    return binN; 
     675} 
     676 
     677 
    662678// Returns zero if make failed. 
    663 UIndex ur_makeVector( const UCell* from, UCell* res )  
    664 { 
     679UIndex ur_makeVectorCell( const UCell* from, UCell* res )  
     680{ 
     681    UArray* bin; 
    665682    UIndex binN = 0; 
    666683    int vtype = UT_INT; 
     
    668685    if( ur_is(from, UT_BLOCK) ) 
    669686    { 
    670         UBinary* bin; 
    671687        UBlock* blk; 
    672688        UCell* it; 
     
    676692        UR_ITER_BLOCK( it, end, blk, from ) 
    677693 
    678         binN = ur_makeBinary( (end - it) * sizeof(int32_t) ); 
    679         bin = ur_binPtr( binN ); 
     694        binN = ur_makeVector( end - it, &bin ); 
    680695 
    681696        while( it != end ) 
     
    716731    else if( ur_is(from, UT_INT) ) 
    717732    { 
    718         binN = ur_makeBinary( ur_int(from) * sizeof(int32_t) ); 
     733        binN = ur_makeVector( ur_int(from), 0 ); 
    719734    } 
    720735 
     
    723738init: 
    724739        ur_initType(res, UT_VECTOR); 
    725         ur_arrayDT(res) = vtype; 
     740        ur_vectorDT(res) = vtype; 
    726741        ur_setSeries(res, binN, 0); 
    727742        return binN; 
     
    15301545        { 
    15311546            // Make array before setting res in case GC is called. 
    1532             UIndex binN = ur_makeVector( tos, res ); 
     1547            UIndex binN = ur_makeVectorCell( tos, res ); 
    15331548            if( ! binN ) 
    15341549                goto error;