Changeset 58 for trunk/orca

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

Location:
trunk/orca
Files:
2 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; 
  • trunk/orca/tests/working/op_math_tuples.r

    r52 r58  
    44a: 1.2.3 
    55b: 253 
    6 print ["add tuple pos-integer" a + b b + a] 
    7 print ["sub tuple pos-integer" a - b] 
    8 print ["mul tuple pos-integer" a * b b * a] 
    9 print ["div tuple pos-integer" a / b] 
    10 print ["and tuple pos-integer" a and b] 
    11 print ["or  tuple pos-integer" a or  b] 
    12 print ["xor tuple pos-integer" a xor b] 
     6print ["RT11: add tuple pos-integer" a + b b + a] 
     7print ["RT12: sub tuple pos-integer" a - b] 
     8print ["RT13: mul tuple pos-integer" a * b b * a] 
     9print ["RT14: div tuple pos-integer" a / b] 
     10print ["RT15: and tuple pos-integer" a and b] 
     11print ["RT16: or  tuple pos-integer" a or  b] 
     12print ["RT17: xor tuple pos-integer" a xor b] 
    1313 
    1414b: -253 
    15 print ["add tuple neg-integer" a + b b + a] 
    16 print ["sub tuple neg-integer" a - b] 
    17 print ["mul tuple neg-integer" a * b b * a] 
    18 print ["div tuple neg-integer" a / b] 
    19 print ["and tuple neg-integer" a and b] 
    20 print ["or  tuple neg-integer" a or  b] 
    21 print ["xor tuple neg-integer" a xor b] 
     15print ["RT21: add tuple neg-integer" a + b b + a] 
     16print ["RT22: sub tuple neg-integer" a - b] 
     17print ["RT23: mul tuple neg-integer" a * b b * a] 
     18print ["RT24: div tuple neg-integer" a / b] 
     19print ["RT25: and tuple neg-integer" a and b] 
     20print ["RT26: or  tuple neg-integer" a or  b] 
     21print ["RT27: xor tuple neg-integer" a xor b] 
    2222 
    2323b: 501.12345 
    24 print ["add tuple pos_decimal" a + b] 
    25 print ["sub tuple pos_decimal" a - b] 
    26 print ["mul tuple pos_decimal" a * b] 
    27 print ["div tuple pos_decimal" a / b] 
    28 print ["and tuple pos_decimal" a and b] 
    29 print ["or  tuple pos_decimal" a or  b] 
    30 print ["xor tuple pos_decimal" a xor b] 
     24print ["RT31: add tuple pos_decimal" a + b] 
     25print ["RT32: sub tuple pos_decimal" a - b] 
     26print ["RT33: mul tuple pos_decimal" a * b] 
     27print ["RT34: div tuple pos_decimal" a / b] 
     28print ["RT35: and tuple pos_decimal" a and b] 
     29print ["RT36: or  tuple pos_decimal" a or  b] 
     30print ["RT37: xor tuple pos_decimal" a xor b] 
    3131 
    3232b: -501.12345 
    33 print ["add tuple neg_decimal" a + b] 
    34 print ["sub tuple neg_decimal" a - b] 
    35 print ["mul tuple neg_decimal" a * b] 
    36 print ["div tuple neg_decimal" a / b] 
    37 print ["and tuple neg_decimal" a and b] 
    38 print ["or  tuple neg_decimal" a or  b] 
    39 print ["xor tuple neg_decimal" a xor b] 
     33print ["RT41: add tuple neg_decimal" a + b] 
     34print ["RT42: sub tuple neg_decimal" a - b] 
     35print ["RT43: mul tuple neg_decimal" a * b] 
     36print ["RT44: div tuple neg_decimal" a / b] 
     37print ["RT45: and tuple neg_decimal" a and b] 
     38print ["RT46: or  tuple neg_decimal" a or  b] 
     39print ["RT47: xor tuple neg_decimal" a xor b] 
    4040 
    4141; tuples with tuples 
    4242b: 0.0.0 
    4343print ["low bound"] 
    44 print ["add tuple tuple" a + b b + a] 
    45 print ["sub tuple tuple" a - b b - a] 
    46 print ["mul tuple tuple" a * b b * a] 
    47 print ["div tuple tuple" b / a]                 ;; div by zero 
    48 print ["and tuple tuple" a and b b and a] 
    49 print ["or  tuple tuple" a or  b b or  a] 
    50 print ["xor tuple tuple" a xor b b xor a] 
     44print ["RT51: add tuple tuple" a + b b + a] 
     45print ["RT52: sub tuple tuple" a - b b - a] 
     46print ["RT53: mul tuple tuple" a * b b * a] 
     47print ["RT54: div tuple tuple" b / a]                 ;; div by zero 
     48print ["RT55: and tuple tuple" a and b b and a] 
     49print ["RT56: or  tuple tuple" a or  b b or  a] 
     50print ["RT57: xor tuple tuple" a xor b b xor a] 
    5151 
    5252b: 255.255.255 
    5353print ["high bound"] 
    54 print ["add tuple tuple" a + b b + a] 
    55 print ["sub tuple tuple" a - b b - a] 
    56 print ["mul tuple tuple" a * b b * a] 
    57 print ["div tuple tuple" a / b b / a] 
    58 print ["and tuple tuple" a and b b and a] 
    59 print ["or  tuple tuple" a or  b b or  a] 
    60 print ["xor tuple tuple" a xor b b xor a] 
     54print ["RT61: add tuple tuple" a + b b + a] 
     55print ["RT62: sub tuple tuple" a - b b - a] 
     56print ["RT63: mul tuple tuple" a * b b * a] 
     57print ["RT64: div tuple tuple" a / b b / a] 
     58print ["RT65: and tuple tuple" a and b b and a] 
     59print ["RT66: or  tuple tuple" a or  b b or  a] 
     60print ["RT67: xor tuple tuple" a xor b b xor a] 
    6161 
    6262b: 127.127.127 
    6363print ["between"] 
    64 print ["add tuple tuple" a + b b + a] 
    65 print ["sub tuple tuple" a - b b - a] 
    66 print ["mul tuple tuple" a * b b * a] 
    67 print ["div tuple tuple" a / b b / a] 
    68 print ["and tuple tuple" a and b b and a] 
    69 print ["or  tuple tuple" a or  b b or  a] 
    70 print ["xor tuple tuple" a xor b b xor a] 
     64print ["RT71: add tuple tuple" a + b b + a] 
     65print ["RT72: sub tuple tuple" a - b b - a] 
     66print ["RT73: mul tuple tuple" a * b b * a] 
     67print ["RT74: div tuple tuple" a / b b / a] 
     68print ["RT75: and tuple tuple" a and b b and a] 
     69print ["RT76: or  tuple tuple" a or  b b or  a] 
     70print ["RT77: xor tuple tuple" a xor b b xor a] 
    7171 
    7272b: 127.127.127.127 
    7373print ["different len"] 
    74 print ["add tuple tuple" a + b b + a] 
    75 print ["sub tuple tuple" a - b b - a] 
    76 print ["mul tuple tuple" a * b b * a] 
    77 print ["div tuple tuple" a / b]                 ;; div by zero 
    78 print ["and tuple tuple" a and b b and a] 
    79 print ["or  tuple tuple" a or  b b or  a] 
    80 print ["xor tuple tuple" a xor b b xor a] 
     74print ["RT81: add tuple tuple" a + b b + a] 
     75print ["RT82: sub tuple tuple" a - b b - a] 
     76print ["RT83: mul tuple tuple" a * b b * a] 
     77print ["RT84: div tuple tuple" a / b]                 ;; div by zero 
     78print ["RT85: and tuple tuple" a and b b and a] 
     79print ["RT86: or  tuple tuple" a or  b b or  a] 
     80print ["RT87: xor tuple tuple" a xor b b xor a] 
    8181