Changeset 140
- Timestamp:
- 05/06/06 02:05:44 (3 years ago)
- Location:
- trunk/orca
- Files:
-
- 1 added
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/orca/context.c
r94 r140 556 556 557 557 558 #if 0 558 559 /* 559 560 Returns true if block contains does or func. … … 623 624 } 624 625 } 626 #endif 625 627 626 628 -
trunk/orca/ovalue.c
r138 r140 2217 2217 cr->count = ac 2218 2218 2219 extern void orRebind( OIndex blk, OIndex from, OIndex to ); 2219 #define RECURSE_COUNT index 2220 2221 //extern void orRebind( OIndex blk, OIndex from, OIndex to ); 2220 2222 2221 2223 /** … … 2600 2602 total = nv->argc + nv->refc; 2601 2603 2604 #if 0 2602 2605 if( nv->flags & OR_FLAG_CLOSURE ) 2603 2606 { … … 2636 2639 data->used -= total; 2637 2640 *DATA_TOP = *nv; 2641 #else 2642 vblk = orBlockPtr( vblkN ); 2643 save = vblk->values + total; 2644 if( save->RECURSE_COUNT ) 2645 { 2646 // Point context values to stack. 2647 save = vblk->values; 2648 vblk->values = DATA_TOP - total; 2649 2650 orSetTF( DATA_TOP, OT_UNSET ); 2651 DATA_TOP->RECURSE_COUNT = 1; 2652 ++data->used; 2653 2654 orEvalBlock( orBLOCKS + nv->func.bodyBlk, 0 ); 2655 2656 // Restore context (note we re-acquire the context after eval). 2657 vblk = orBlockPtr( vblkN ); 2658 vblk->values = save; 2659 2660 nv = DATA_TOP; 2661 data->used -= total + 1; 2662 *DATA_TOP = *nv; 2663 } 2664 else 2665 { 2666 // Copy arguments from stack to function context. 2667 data->used -= total; 2668 memCpy( vblk->values, DATA_TOP, sizeof(OValue) * total ); 2669 2670 ++save->RECURSE_COUNT; 2671 orEvalBlock( orBLOCKS + nv->func.bodyBlk, 0 ); 2672 --save->RECURSE_COUNT; 2673 } 2674 #endif 2638 2675 } 2639 2676 … … 4257 4294 4258 4295 4259 //extern void orRebindClosure( OIndex blkN );4260 4261 4296 OR_NATIVE( orDoesNative ) 4262 4297 { … … 4283 4318 4284 4319 4285 extern int orClosureRequired( OIndex );4320 //extern int orClosureRequired( OIndex ); 4286 4321 4287 4322 //void orMakeFunction( OBlock* spec, OBlock* body ) … … 4317 4352 { 4318 4353 OBlock* vblk; 4354 int total = argc + refc; 4319 4355 4320 4356 // ctx->flags = OR_CTX_ONSTACK; 4321 4357 // orMakeContext( &ctx, argc + refc ); 4322 4358 4323 ctx.wblkN = orBlockN( orMakeBlock( argc + refc) );4359 ctx.wblkN = orBlockN( orMakeBlock( total ) ); 4324 4360 orRefPush( OT_BLOCK, ctx.wblkN ); 4325 4361 4326 vblk = orMakeBlock( 0);4327 vblk->used = argc + refc;4362 vblk = orMakeBlock( total + 1 ); 4363 vblk->used = total; 4328 4364 ctx.vblkN = orBlockN( vblk ); 4329 4365 orRefPush( OT_BLOCK, ctx.vblkN ); 4366 4367 next = vblk->values + total; 4368 orSetTF( next, OT_UNSET ); 4369 next->RECURSE_COUNT = 0; 4330 4370 4331 4371 wblk = orBlockPtr( ctx.wblkN ); … … 4424 4464 res->func.context = ctx.vblkN; 4425 4465 4466 #if 0 4426 4467 if( orClosureRequired( bodyN ) ) 4427 4468 { … … 4429 4470 //printf( "KR closure bit\n" ); 4430 4471 } 4472 #endif 4431 4473 } 4432 4474 } -
trunk/orca/ovalue.h
r98 r140 124 124 #define OR_FLAG_HEX 0x02 // integer! only 125 125 #define OR_FLAG_RECURSION 0x02 // object! only 126 #define OR_FLAG_CLOSURE 0x04 // object! only126 //#define OR_FLAG_CLOSURE 0x04 // object! only 127 127 #define OR_FLAG_CATCH 0x08 128 128 #define OR_FLAG_THROW 0x10
