Changeset 59 for trunk/orca/op.c

Show
Ignore:
Timestamp:
02/22/06 00:37:24 (3 years ago)
Author:
jvargas
Message:

- Adds full commutative behavior for tuple math as default for Orca
- Introduces regression for Orca tuple math.
- Minor fixes to tests/Makefile

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/orca/op.c

    r58 r59  
    7373            return; 
    7474        } 
     75#ifdef LANG_ORCA 
    7576        else if( orIs(b, OT_TUPLE) ) 
    7677        { 
     
    8990            return; 
    9091        } 
     92#endif 
    9193        a = b; 
    9294    } 
     
    178180            return; 
    179181        } 
    180  
     182#ifdef LANG_ORCA 
     183        else if( orIs(b, OT_TUPLE) ) 
     184        { 
     185            int tmp, i; 
     186            OValue *res; 
     187 
     188            res = b;  
     189 
     190            for( i = 0; i < res->argc; i++ ) 
     191            { 
     192                tmp = orInt(a) - b->tuple[i]; 
     193                res->tuple[i] = orToByteRange(tmp); 
     194            }    
     195 
     196            orResultCopy( *res ); 
     197            return; 
     198        } 
     199#endif 
    181200        a = b; 
    182201    } 
     
    193212            return; 
    194213        } 
     214#ifdef LANG_ORCA 
     215        else if( orIs(b, OT_TUPLE) ) 
     216        { 
     217            int tmp, i; 
     218            OValue *res; 
     219 
     220            res = b;  
     221 
     222            for( i = 0; i < res->argc; i++ ) 
     223            { 
     224                tmp = (int) orDecimal(a) - b->tuple[i]; 
     225                res->tuple[i] = orToByteRange(tmp); 
     226            }    
     227 
     228            orResultCopy( *res ); 
     229            return; 
     230        } 
     231#endif 
    195232        a = b; 
    196233    } 
     
    326363            return; 
    327364        } 
     365#ifdef LANG_ORCA 
    328366        else if( orIs(b, OT_TUPLE) ) 
    329367        { 
     
    342380            return; 
    343381        } 
     382#endif 
    344383        a = b; 
    345384    } 
     
    414453            return; 
    415454        } 
     455#ifdef LANG_ORCA 
     456        else if( orIs(b, OT_TUPLE) ) 
     457        { 
     458            int tmp, i; 
     459            OValue *res; 
     460 
     461            res = b;  
     462 
     463            for( i = 0; i < res->argc; i++ ) 
     464            { 
     465                if( b->tuple[i] == 0 ) 
     466                    goto div0; 
     467                tmp = orInt(a) / b->tuple[i]; 
     468                res->tuple[i] = orToByteRange(tmp); 
     469            }    
     470 
     471            orResultCopy( *res ); 
     472            return; 
     473        } 
     474#endif 
    416475        a = b; 
    417476    } 
     
    432491            return; 
    433492        } 
     493#ifdef LANG_ORCA 
     494        else if( orIs(b, OT_TUPLE) ) 
     495        { 
     496            int tmp, i; 
     497            OValue *res; 
     498 
     499            res = b;  
     500 
     501            for( i = 0; i < res->argc; i++ ) 
     502            { 
     503                if( b->tuple[i] == 0 ) 
     504                    goto div0; 
     505                tmp = (int) orDecimal(a) / b->tuple[i]; 
     506                res->tuple[i] = orToByteRange(tmp); 
     507            }    
     508 
     509            orResultCopy( *res ); 
     510            return; 
     511        } 
     512#endif 
    434513        a = b; 
    435514    } 
     
    446525            for( i = 0; i < res->argc; i++ ) 
    447526            { 
    448                 if ( b->tuple[i] == 0) 
     527                if( b->tuple[i] == 0 ) 
    449528                    goto div0; 
    450529                tmp = a->tuple[i] / b->tuple[i]; 
     
    462541            for( i = 0; i < res->argc; i++ ) 
    463542            { 
    464                 if (orInt(b) == 0) 
     543                if( orInt(b) == 0 ) 
    465544                    goto div0; 
    466545                tmp = a->tuple[i] / orInt(b); 
     
    478557            for( i = 0; i < res->argc; i++ ) 
    479558            { 
    480                 if (orDecimal(b) == 0) 
     559                if( orDecimal(b) == 0 ) 
    481560                    goto div0; 
    482561                tmp = a->tuple[i] / (int) orDecimal(b); 
     
    887966            return; 
    888967        } 
    889         a = b; 
    890     } 
     968#ifdef LANG_ORCA 
     969        else if( orIs(b, OT_TUPLE) ) 
     970        { 
     971            int i; 
     972            OValue *res; 
     973 
     974            res = b;  
     975 
     976            for( i = 0; i < res->argc; i++ ) 
     977            { 
     978                res->tuple[i] =  orInt(a) & b->tuple[i]; 
     979            }    
     980 
     981            orResultCopy( *res ); 
     982            return; 
     983        } 
     984#endif 
     985        a = b; 
     986    } 
     987#ifdef LANG_ORCA 
     988    else if( orIs(a, OT_DECIMAL) ) 
     989    { 
     990        if( orIs(b, OT_TUPLE) ) 
     991        { 
     992            int i; 
     993            OValue *res; 
     994 
     995            res = b;  
     996 
     997            for( i = 0; i < res->argc; i++ ) 
     998            { 
     999                res->tuple[i] =  (int) orDecimal(a) & b->tuple[i]; 
     1000            }    
     1001 
     1002            orResultCopy( *res ); 
     1003            return; 
     1004        } 
     1005        a = b; 
     1006    } 
     1007#endif 
    8911008    else if( orIs(a, OT_LOGIC) ) 
    8921009    { 
     
    9501067            return; 
    9511068        } 
    952         a = b; 
    953     } 
     1069#ifdef LANG_ORCA 
     1070        else if( orIs(b, OT_TUPLE) ) 
     1071        { 
     1072            int i; 
     1073            OValue *res; 
     1074 
     1075            res = b;  
     1076 
     1077            for( i = 0; i < res->argc; i++ ) 
     1078            { 
     1079                res->tuple[i] =  orInt(a) | b->tuple[i]; 
     1080            }    
     1081 
     1082            orResultCopy( *res ); 
     1083            return; 
     1084        } 
     1085#endif 
     1086        a = b; 
     1087    } 
     1088#ifdef LANG_ORCA 
     1089    else if( orIs(a, OT_DECIMAL) ) 
     1090    { 
     1091        if( orIs(b, OT_TUPLE) ) 
     1092        { 
     1093            int i; 
     1094            OValue *res; 
     1095 
     1096            res = b;  
     1097 
     1098            for( i = 0; i < res->argc; i++ ) 
     1099            { 
     1100                res->tuple[i] =  (int) orDecimal(a) | b->tuple[i]; 
     1101            }    
     1102 
     1103            orResultCopy( *res ); 
     1104            return; 
     1105        } 
     1106        a = b; 
     1107    } 
     1108#endif 
    9541109    else if( orIs(a, OT_LOGIC) ) 
    9551110    { 
     
    9851140#else 
    9861141                tmp =  orToByteRange( orInt(b) ); 
    987                 if ( tmp == 0) 
     1142                if( tmp == 0 ) 
    9881143                    a->tuple[i] = 0; 
    989                 else if ( tmp == 255 ) 
     1144                else if( tmp == 255 ) 
    9901145                    a->tuple[i] = 255; 
    9911146                else 
     
    10071162#else 
    10081163                tmp =  orToByteRange( (int) orDecimal(b) ); 
    1009                 if ( tmp == 0) 
     1164                if( tmp == 0 ) 
    10101165                    a->tuple[i] = 0; 
    1011                 else if ( tmp == 255 ) 
     1166                else if( tmp == 255 ) 
    10121167                    a->tuple[i] = 255; 
    10131168                else 
     
    10331188            return; 
    10341189        } 
    1035         a = b; 
    1036     } 
     1190#ifdef LANG_ORCA 
     1191        else if( orIs(b, OT_TUPLE) ) 
     1192        { 
     1193            int i; 
     1194            OValue *res; 
     1195 
     1196            res = b;  
     1197 
     1198            for( i = 0; i < res->argc; i++ ) 
     1199            { 
     1200                res->tuple[i] =  orInt(a) ^ b->tuple[i]; 
     1201            }    
     1202 
     1203            orResultCopy( *res ); 
     1204            return; 
     1205        } 
     1206#endif 
     1207        a = b; 
     1208    } 
     1209#ifdef LANG_ORCA 
     1210    else if( orIs(a, OT_DECIMAL) ) 
     1211    { 
     1212        if( orIs(b, OT_TUPLE) ) 
     1213        { 
     1214            int i; 
     1215            OValue *res; 
     1216 
     1217            res = b;  
     1218 
     1219            for( i = 0; i < res->argc; i++ ) 
     1220            { 
     1221                res->tuple[i] =  (int) orDecimal(a) ^ b->tuple[i]; 
     1222            }    
     1223 
     1224            orResultCopy( *res ); 
     1225            return; 
     1226        } 
     1227        a = b; 
     1228    } 
     1229#endif 
    10371230    else if( orIs(a, OT_LOGIC) ) 
    10381231    { 
     
    10681261#else 
    10691262                tmp =  orToByteRange( orInt(b) ); 
    1070                 if ( tmp == 0) 
     1263                if( tmp == 0 ) 
    10711264                    a->tuple[i] = 0; 
    1072                 else if ( tmp == 255 ) 
     1265                else if( tmp == 255 ) 
    10731266                    a->tuple[i] = 255; 
    10741267                else 
     
    10901283#else 
    10911284                tmp =  orToByteRange( (int) orDecimal(b) ); 
    1092                 if ( tmp == 0) 
     1285                if( tmp == 0 ) 
    10931286                    a->tuple[i] = 0; 
    1094                 else if ( tmp == 255 ) 
     1287                else if( tmp == 255 ) 
    10951288                    a->tuple[i] = 255; 
    10961289                else