Changeset 54 for trunk/orca/ovalue.c

Show
Ignore:
Timestamp:
02/17/06 15:30:01 (3 years ago)
Author:
krobillard
Message:

Now using orDecimal() & orInt() where appropriate.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/orca/ovalue.c

    r44 r54  
    396396 
    397397    // Makes sure double is aligned on 8 byte boundary. 
    398     assert( ((char*) res) + 8 == ((char*) &res->num.decimal) ); 
     398    assert( ((char*) res) + 8 == ((char*) &orDecimal(res)) ); 
    399399 
    400400    orNative( orNativeNative, "native" ); 
     
    651651            if( from->type == OT_INTEGER ) 
    652652            { 
    653                 orResult( OT_ACTION, from->integer ); 
     653                orResult( OT_ACTION, orInt(from) ); 
    654654                return 1; 
    655655            } 
     
    657657#endif 
    658658        case OT_LOGIC: 
    659             orResult( OT_LOGIC, from->integer ? 1 : 0 ); 
     659            orResult( OT_LOGIC, orInt(from) ? 1 : 0 ); 
    660660            return 1; 
    661661 
     
    663663            if( from->type == OT_LOGIC ) 
    664664            { 
    665                 res->integer = from->integer; 
     665                orInt(res) = orInt(from); 
    666666                return 1; 
    667667            } 
    668668            else if( from->type == OT_DECIMAL ) 
    669669            { 
    670                 res->integer = (int) from->num.decimal; 
     670                orInt(res) = (int) orDecimal(from); 
    671671                return 1; 
    672672            } 
     
    677677                char* end = str->charArray + str->used; 
    678678                const char* fin; 
    679                 res->integer = orStringToInt( it, end, &fin ); 
     679                orInt(res) = orStringToInt( it, end, &fin ); 
    680680                if( fin == end ) 
    681681                    return 1; 
     
    687687                (from->type == OT_LOGIC) ) 
    688688            { 
    689                 res->num.decimal = (double) from->integer; 
     689                orDecimal(res) = (double) orInt(from); 
    690690                return 1; 
    691691            } 
     
    696696                char* end = str->charArray + str->used; 
    697697                const char* fin; 
    698                 res->num.decimal = orStringToDec( it, end, &fin ); 
     698                orDecimal(res) = orStringToDec( it, end, &fin ); 
    699699                if( fin == end ) 
    700700                    return 1; 
     
    735735                        if( it->type != OT_INTEGER ) 
    736736                            break; 
    737                         *tuple++ = it->integer; 
     737                        *tuple++ = orInt(it); 
    738738                        ++it; 
    739739                    } 
     
    760760    if( a1->type == OT_DATATYPE ) 
    761761    { 
    762         if( orMake( a1->integer, a2, a1 ) ) 
     762        if( orMake( orInt(a1), a2, a1 ) ) 
    763763            return; 
    764764 
    765         switch( a1->integer ) 
     765        switch( orInt(a1) ) 
    766766        { 
    767767            case OT_BLOCK: 
    768768                if( a2->type == OT_INTEGER ) 
    769769                { 
    770                     OBlock* blk = orMakeBlock( a2->integer ); 
     770                    OBlock* blk = orMakeBlock( orInt(a2) ); 
    771771                    orResultBLOCK( blk - orBLOCKS ); 
    772772                    return; 
     
    777777                if( a2->type == OT_INTEGER ) 
    778778                { 
    779                     OString* str = orMakeString( a2->integer ); 
     779                    OString* str = orMakeString( orInt(a2) ); 
    780780                    orResultSTRING( str - orSTRINGS ); 
    781781                    return; 
     
    843843                else if( a2->type == OT_INTEGER ) 
    844844                { 
    845                     OBlock* blk = orMakeList( a2->integer ); 
     845                    OBlock* blk = orMakeList( orInt(a2) ); 
    846846                    orResultSeries( OT_LIST, orBlockN(blk), LIST_TAIL ); 
    847847                    return; 
     
    869869            { 
    870870                OValue* res = orRESULT; 
    871                 orSetTF( res, a1->integer ); 
     871                orSetTF( res, orInt(a1) ); 
    872872                res->vec3.x = 0.0f; 
    873873                res->vec3.y = 0.0f; 
     
    922922    type = a1->type; 
    923923    if( type == OT_DATATYPE ) 
    924         type = a1->integer; 
     924        type = orInt(a1); 
    925925 
    926926    if( type == a2->type ) 
     
    14771477    int logic; 
    14781478    if( (a1->type == OT_NONE) || 
    1479         ((a1->type == OT_LOGIC) && (a1->integer == OR_FALSE)) ) 
     1479        ((a1->type == OT_LOGIC) && (orInt(a1) == OR_FALSE)) ) 
    14801480        logic = OR_TRUE; 
    14811481    else 
     
    15151515    if( a1->type != OT_NONE ) 
    15161516    { 
    1517         if( (a1->type != OT_LOGIC) || (a1->integer != 0)  ) 
     1517        if( (a1->type != OT_LOGIC) || (orInt(a1) != 0)  ) 
    15181518            --blkArg; 
    15191519    } 
     
    15261526    OIndex body; 
    15271527    OIndex bi; 
    1528     int n = a1->integer; 
     1528    int n = orInt(a1); 
    15291529 
    15301530    ++a1; 
     
    15561556    { 
    15571557        int counter = 0; 
    1558         int n = a2->integer; 
     1558        int n = orInt(a2); 
    15591559        orSetTF( wval, OT_INTEGER ); 
    15601560        while( counter < n ) 
    15611561        { 
    1562             wval->integer = ++counter; 
     1562            orInt(wval) = ++counter; 
    15631563            orEvalBlock( orBLOCKS + body, bi ); 
    15641564            if( orErrorThrown ) 
     
    16001600                if( si >= str->used ) 
    16011601                    break; 
    1602                 wval->integer = str->charArray[ si++ ]; 
     1602                orInt(wval) = str->charArray[ si++ ]; 
    16031603                orEvalBlock( orBLOCKS + body, bi ); 
    16041604                if( orErrorThrown ) 
     
    16281628        if( res->type != OT_NONE ) 
    16291629        { 
    1630             if( (res->type != OT_LOGIC) || (res->integer != 0) ) 
     1630            if( (res->type != OT_LOGIC) || (orInt(res) != 0) ) 
    16311631                break; 
    16321632        } 
     
    16571657    if( res->type != OT_NONE ) 
    16581658    { 
    1659         if( (res->type != OT_LOGIC) || (res->integer != 0) ) 
     1659        if( (res->type != OT_LOGIC) || (orInt(res) != 0) ) 
    16601660        { 
    16611661            if( onstack ) 
     
    19271927            if( pit->type == OT_INTEGER ) 
    19281928            { 
    1929                 orPick( cres, pit->integer - 1, result ); 
     1929                orPick( cres, orInt(pit) - 1, result ); 
    19301930            } 
    19311931            else if( pit->type == OT_GETWORD ) 
     
    19351935                if( wval->type != OT_INTEGER ) 
    19361936                    goto invalid; 
    1937                 orPick( cres, wval->integer - 1, result ); 
     1937                orPick( cres, orInt(wval) - 1, result ); 
    19381938            } 
    19391939            else 
     
    19671967            if( pit->type == OT_INTEGER ) 
    19681968            { 
    1969                 orPick( cres, pit->integer - 1, result ); 
     1969                orPick( cres, orInt(pit) - 1, result ); 
    19701970                cres = result; 
    19711971            } 
     
    20362036            if( end->type == OT_INTEGER ) 
    20372037            { 
    2038                 result->series.it = end->integer - 1; 
     2038                result->series.it = orInt(end) - 1; 
    20392039            } 
    20402040            else if( end->type == OT_GETWORD ) 
     
    20452045                if( val->type != OT_INTEGER ) 
    20462046                    goto invalid; 
    2047                 result->series.it = val->integer - 1; 
     2047                result->series.it = orInt(val) - 1; 
    20482048            } 
    20492049            else if( end->type == OT_WORD ) 
     
    21032103                int index = ser->series.it; 
    21042104                if( index < str->used ) 
    2105                     str->charArray[ index ] = val->integer; 
     2105                    str->charArray[ index ] = orInt(val); 
    21062106            } 
    21072107            break; 
     
    27812781    it = DATA_TOP + (count - funcv->argc - refc); 
    27822782    it->type    = OT_LOGIC; 
    2783     it->integer = 1; 
     2783    orLogic(it) = 1; 
    27842784 
    27852785    if( si->LAST_ARG ) 
     
    29952995        if( res->type != OT_NONE ) 
    29962996        { 
    2997             if( (res->type != OT_LOGIC) || (res->integer != 0) ) 
     2997            if( (res->type != OT_LOGIC) || (orLogic(res) != 0) ) 
    29982998            { 
    29992999                return; 
     
    30283028 
    30293029        res = orRESULT; 
    3030         if( res->type == OT_NONE ) 
     3030        if( orIs(res, OT_NONE) ) 
    30313031            goto fail; 
    3032         if( (res->type == OT_LOGIC) && (res->integer == 0) ) 
     3032        if( orIs(res, OT_LOGIC) && (orLogic(res) == 0) ) 
    30333033            goto fail; 
    30343034    } 
     
    31103110            else if( it->type == OT_DATATYPE ) 
    31113111            { 
    3112                 dprint( " %s\n", orDatatypeName(it->integer) ); 
     3112                dprint( " %s\n", orDatatypeName(orInt(it)) ); 
    31133113            } 
    31143114            else if( (it->type == OT_OBJECT) || 
     
    38123812 
    38133813                case OT_CHAR: 
    3814                     orSetBit( bin->byteArray, it->integer ); 
    3815                     range = it->integer; 
     3814                    orSetBit( bin->byteArray, orInt(it) ); 
     3815                    range = orInt(it); 
    38163816                    break; 
    38173817 
     
    38233823                        if( (rend != end) && (rend->type == OT_CHAR) ) 
    38243824                        { 
    3825                             r2 = rend->integer; 
     3825                            r2 = orInt(rend); 
    38263826                            while( range < r2 ) 
    38273827                            { 
     
    39813981 
    39823982    orSetTF( val, OT_DECIMAL ); 
    3983     val->num.decimal = n; 
     3983    orDecimal(val) = n; 
    39843984    return val; 
    39853985} 
     
    40614061            orWordVal( it, ctxBlk, val ); 
    40624062            if( val->type == OT_DATATYPE ) 
    4063                 it->integer = val->integer; 
     4063                orInt(it) = orInt(val); 
    40644064            else 
    4065                 it->integer = val->type; 
     4065                orInt(it) = val->type; 
    40664066        } 
    40674067        else 
    40684068        { 
    4069             it->integer = it->type; 
     4069            orInt(it) = it->type; 
    40704070        } 
    40714071        it->type = OT_DATATYPE;