Method: RCSimCinterface.rcsim_add_block_statements
- Defined in:
- ext/hruby_sim/hruby_rcsim_build.c
.rcsim_add_block_statements(blockV, stmntVs) ⇒ Object
Adds statements to a C block.
1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 |
# File 'ext/hruby_sim/hruby_rcsim_build.c', line 1432 VALUE rcsim_add_block_statements(VALUE mod, VALUE blockV, VALUE stmntVs) { /* Get the C block from the Ruby value. */ Block block; value_to_rcsim(BlockS,blockV,block); // printf("rcsim_add_block_statements with block=%p\n",block); /* Prepare the size for the statements. */ long num = RARRAY_LEN(stmntVs); long old_num = block->num_stmnts; block->num_stmnts += num; // printf("first block->stmnts=%p\n",block->stmnts); fflush(stdout); block->stmnts = realloc(block->stmnts, sizeof(Statement[block->num_stmnts])); // block->stmnts = (Statement*)my_realloc(block->stmnts, // sizeof(Statement[old_num]), sizeof(Statement[block->num_stmnts])); // printf("now block->stmnts=%p\n",block->stmnts); fflush(stdout); // printf("access test: %p\n",block->stmnts[0]); fflush(stdout); /* Get and add the statements from the Ruby value. */ for(long i=0; i< num; ++i) { Statement stmnt; // show_access(block->stmnts,old_num+i); value_to_rcsim(StatementS,rb_ary_entry(stmntVs,i),stmnt); block->stmnts[old_num + i] = stmnt; } return blockV; } |