Changeset 97 for trunk/orca

Show
Ignore:
Timestamp:
03/19/06 18:33:15 (3 years ago)
Author:
krobillard
Message:

Compose now takes /only refinement (currently the only implemented behavior).

Location:
trunk/orca
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/orca/boot.c

    r96 r97  
    6565  "    value\n" 
    6666  "    /deep\n" 
     67  "    /only\n" 
    6768  "]\n" 
    6869  "form: native [\n" 
  • trunk/orca/boot.r

    r96 r97  
    9090        value 
    9191        /deep 
     92        /only 
    9293    ] 
    9394 
  • trunk/orca/ovalue.c

    r94 r97  
    29432943 
    29442944 
    2945 static void composeBlock( OBlock* blk, OIndex si, int deep ) 
    2946 { 
     2945static void composeBlock( OBlock* blk, OIndex si, int deep, int only ) 
     2946{ 
     2947    OValue* res; 
    29472948    OValue* it  = blk->values + si; 
    29482949    OValue* end = blk->values + blk->used; 
     
    29502951    while( it != end ) 
    29512952    { 
    2952         if( it->type == OT_PAREN ) 
     2953        if( orIs(it, OT_PAREN) ) 
    29532954        { 
    29542955            orEvalBlock( orBLOCK(it), it->series.it ); 
    29552956            if( orErrorThrown ) 
    29562957                break; 
    2957             orCopyV( it, *orRESULT ); 
    2958         } 
    2959         else if( (it->type == OT_BLOCK) && deep ) 
    2960         { 
    2961             composeBlock( orBLOCK(it), it->series.it, 1 ); 
     2958 
     2959            res = orRESULT; 
     2960            if( orIs(res, OT_BLOCK) && ! only ) 
     2961            { 
     2962                orError( "compose result of block! not implemented." ); 
     2963                return; 
     2964            } 
     2965            else 
     2966            { 
     2967                orCopyV( it, *res ); 
     2968            } 
     2969        } 
     2970        else if( orIs(it, OT_BLOCK) && deep ) 
     2971        { 
     2972            composeBlock( orBLOCK(it), it->series.it, 1, only ); 
    29622973        } 
    29632974        ++it; 
     
    29692980{ 
    29702981#define REF_COMP_DEEP     a1+1 
    2971  
    2972     if( a1->type == OT_BLOCK ) 
     2982#define REF_COMP_ONLY     a1+2 
     2983 
     2984    if( orIs(a1, OT_BLOCK) ) 
    29732985    { 
    29742986        OBlock* blk; 
     
    29782990        deep = orRefineSet(REF_COMP_DEEP) ? 1 : 0; 
    29792991 
    2980         blk = orCopyBlock( a1->index, a1->series.it, deep ); 
     2992        blk = orCopyBlock( a1->series.n, a1->series.it, deep ); 
    29812993        blkN = orBlockN(blk); 
    29822994 
    2983         composeBlock( blk, 0, deep );  
     2995        composeBlock( blk, 0, deep, 
     2996                      orRefineSet(REF_COMP_ONLY) ? 1 : 0 );  
    29842997        if( ! orErrorThrown ) 
    29852998        {