Changeset 58 for trunk/orca/op.c

Show
Ignore:
Timestamp:
02/21/06 23:18:49 (3 years ago)
Author:
jvargas
Message:

- Regression op_math_tuples PASS when in using Rebol compatible mode

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/orca/op.c

    r56 r58  
    671671} 
    672672 
    673 #if 0 
    674 static int tupleSame( const OValue* a, const OValue* b ) 
    675 { 
    676     if( a->argc == b->argc ) 
    677     { 
    678         int i; 
    679         for( i = 0; i < a->argc; ++i ) 
    680         { 
    681             if( a->tuple[i] != b->tuple[i] ) 
    682                 return 0; 
    683         } 
    684         return 1; 
    685     } 
    686     return 0; 
    687 } 
    688 #endif 
    689  
    690673 
    691674static int orTypeEqual( const OValue* a, const OValue* b ) 
     
    826809    else if( orType(a) == orType(b) ) 
    827810    { 
    828         if( orIs(a, OT_WORD) ) // Should it be orIsWord(a) 
     811        if( orIs(a, OT_WORD) ) 
    829812        { 
    830813            if( (a->word.atom == b->word.atom) && 
     
    837820                logic = 1; 
    838821        } 
    839         else if( orIsSeries(a->type) ) 
     822        else if( orIsSeries( orType(a) ) ) 
    840823        { 
    841824            if( (a->series.n == b->series.n) && 
     
    845828        else if( orIs(a, OT_TUPLE) ) 
    846829        { 
    847             logic = compareValue( a, b ); // tupleSame( a, b ); 
     830            logic = compareValue( a, b ); 
    848831        } 
    849832    } 
     
    925908        if( orIs(b, OT_TUPLE) ) 
    926909        { 
    927             int argc, i;             
    928             argc = a->argc > b->argc ? a->argc : b->argc; 
    929             for( i = 0; i < argc; i++ ) 
     910            int i;             
     911            a->argc = a->argc > b->argc ? a->argc : b->argc; 
     912            for( i = 0; i < a->argc; i++ ) 
    930913            { 
    931914                a->tuple[i] = a->tuple[i] & b->tuple[i]; 
     
    947930            for( i = 0; i < a->argc; i++ ) 
    948931            { 
    949                 a->tuple[i] = a->tuple[i] & (int) orDecimal(b); 
     932                a->tuple[i] = a->tuple[i] & (int) orDecimal(b);                      
    950933            }             
    951934            return; 
     
    982965        if( orIs(b, OT_TUPLE) ) 
    983966        { 
    984             int argc, i;             
    985             argc = a->argc > b->argc ? a->argc : b->argc; 
    986             for( i = 0; i < argc; i++ ) 
     967            int i;             
     968            a->argc = a->argc > b->argc ? a->argc : b->argc; 
     969            for( i = 0; i < a->argc; i++ ) 
    987970            { 
    988971                a->tuple[i] = a->tuple[i] | b->tuple[i]; 
     
    993976        { 
    994977            int i; 
     978#ifndef LANG_ORCA 
     979            int tmp; 
     980#endif 
    995981            for( i = 0; i < a->argc; i++ ) 
    996982            { 
     983#ifdef LANG_ORCA 
    997984                a->tuple[i] = a->tuple[i] | orInt(b); 
     985#else 
     986                tmp =  orToByteRange( orInt(b) ); 
     987                if ( tmp == 0) 
     988                    a->tuple[i] = 0; 
     989                else if ( tmp == 255 ) 
     990                    a->tuple[i] = 255; 
     991                else 
     992                    a->tuple[i] = a->tuple[i] | orInt(b); 
     993#endif 
    998994            }             
    999995            return; 
     
    1002998        { 
    1003999            int i; 
     1000#ifndef LANG_ORCA 
     1001            int tmp; 
     1002#endif 
    10041003            for( i = 0; i < a->argc; i++ ) 
    10051004            { 
     1005#ifdef LANG_ORCA 
    10061006                a->tuple[i] = a->tuple[i] | (int) orDecimal(b); 
     1007#else 
     1008                tmp =  orToByteRange( (int) orDecimal(b) ); 
     1009                if ( tmp == 0) 
     1010                    a->tuple[i] = 0; 
     1011                else if ( tmp == 255 ) 
     1012                    a->tuple[i] = 255; 
     1013                else 
     1014                    a->tuple[i] = a->tuple[i] | orToByteRange( (int) orDecimal(b) ); 
     1015#endif 
    10071016            }             
    10081017            return; 
     
    10391048        if( orIs(b, OT_TUPLE) ) 
    10401049        { 
    1041             int argc, i;             
    1042             argc = a->argc > b->argc ? a->argc : b->argc; 
    1043             for( i = 0; i < argc; i++ ) 
     1050            int i;             
     1051            a->argc = a->argc > b->argc ? a->argc : b->argc; 
     1052            for( i = 0; i < a->argc; i++ ) 
    10441053            { 
    10451054                a->tuple[i] = a->tuple[i] ^ b->tuple[i]; 
     
    10501059        { 
    10511060            int i; 
     1061#ifndef LANG_ORCA 
     1062            int tmp; 
     1063#endif 
    10521064            for( i = 0; i < a->argc; i++ ) 
    10531065            { 
     1066#ifdef LANG_ORCA 
    10541067                a->tuple[i] = a->tuple[i] ^ orInt(b); 
     1068#else 
     1069                tmp =  orToByteRange( orInt(b) ); 
     1070                if ( tmp == 0) 
     1071                    a->tuple[i] = 0; 
     1072                else if ( tmp == 255 ) 
     1073                    a->tuple[i] = 255; 
     1074                else 
     1075                    a->tuple[i] = a->tuple[i] ^ orToByteRange( orInt(b) ); 
     1076#endif 
    10551077            }             
    10561078            return; 
     
    10591081        { 
    10601082            int i; 
     1083#ifndef LANG_ORCA 
     1084            int tmp; 
     1085#endif 
    10611086            for( i = 0; i < a->argc; i++ ) 
    10621087            { 
     1088#ifdef LANG_ORCA 
    10631089                a->tuple[i] = a->tuple[i] ^ (int) orDecimal(b); 
     1090#else 
     1091                tmp =  orToByteRange( (int) orDecimal(b) ); 
     1092                if ( tmp == 0) 
     1093                    a->tuple[i] = 0; 
     1094                else if ( tmp == 255 ) 
     1095                    a->tuple[i] = 255; 
     1096                else 
     1097                    a->tuple[i] = a->tuple[i] ^ orToByteRange( (int) orDecimal(b) ); 
     1098#endif 
    10641099            }             
    10651100            return;