Changeset 44

Show
Ignore:
Timestamp:
02/12/06 15:46:49 (3 years ago)
Author:
krobillard
Message:

Added orIfTrue/orIfFalse macros.

Location:
trunk/orca
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/orca/ovalue.c

    r42 r44  
    14881488void orIfNative( OValue* a1 ) 
    14891489{ 
    1490     if( a1->type != OT_NONE ) 
    1491     { 
    1492         if( (a1->type != OT_LOGIC) || (a1->integer != 0)  ) 
    1493         { 
    1494             OValue* a2 = a1 + 1; 
    1495             orEvalBlock( orBLOCK( a2 ), a2->series.it ); 
    1496             return; 
    1497         } 
     1490    if( orIfTrue(a1) ) 
     1491    { 
     1492        OValue* a2 = a1 + 1; 
     1493        orEvalBlock( orBLOCK( a2 ), a2->series.it ); 
     1494        return; 
    14981495    } 
    14991496    orResultNONE; 
     
    15031500void orUnlessNative( OValue* a1 ) 
    15041501{ 
    1505     if( (a1->type == OT_NONE) || 
    1506         ((a1->type == OT_LOGIC) && (a1->integer == 0)) ) 
     1502    if( orIfFalse(a1) ) 
    15071503    { 
    15081504        OValue* a2 = a1 + 1; 
  • trunk/orca/ovalue.h

    r42 r44  
    486486#define orType(val)     (val)->type 
    487487#define orInteger(val)  (val)->integer 
     488#define orLogic(val)    (val)->integer 
    488489#define orDecimal(val)  (val)->num.decimal 
    489490#define orTupleLen(val) (val)->argc 
     
    494495#define orIsBlock(t)    ((t >= OT_BLOCK) && (t < OT_SETPATH)) 
    495496#define orIsNumber(t)   ((t == OT_INTEGER) || (t == OT_DECIMAL)) 
     497 
     498#define orIfTrue(val) \ 
     499    ((orType(val) != OT_NONE) && \ 
     500     ((orType(val) != OT_LOGIC) || (orLogic(val) != 0))) 
     501 
     502#define orIfFalse(val) \ 
     503    (orIs(val, OT_NONE) || (orIs(val, OT_LOGIC) && (orLogic(val) == 0))) 
    496504 
    497505#define orRefAvail(n) \ 
  • trunk/orca/tests/run_test

    r11 r44  
    22 
    33INTERPRETER=../orca 
    4 #INTERPRETER=../rsharp 
     4REBOL=rebol 
     5#REBOL=./rebol 
    56 
    67#DIFF='diff -w --ignore-blank-lines' 
     
    1314        ROUT=${FILE%.*}.outr  
    1415        OUT=${FILE%.*}.out 
    15         rebol -qs $FILE >$ROUT 
     16        $REBOL -qs $FILE >$ROUT 
    1617        $INTERPRETER $FILE >$OUT 
    1718        ${DIFF} $OUT $ROUT