Method: RCSimCinterface.rcsim_add_refConcat_refs
- Defined in:
- ext/hruby_sim/hruby_rcsim_build.c
.rcsim_add_refConcat_refs(refConcatV, refVs) ⇒ Object
Adds references to a C ref concat.
1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 |
# File 'ext/hruby_sim/hruby_rcsim_build.c', line 1514
VALUE rcsim_add_refConcat_refs(VALUE mod, VALUE refConcatV, VALUE refVs) {
/* Get the C refConcat from the Ruby value. */
RefConcat refConcat;
value_to_rcsim(RefConcatS,refConcatV,refConcat);
// printf("rcsim_add_refConcat_refs with refConcat=%p\n",refConcat);
/* Prepare the size for the references. */
long num = RARRAY_LEN(refVs);
long old_num = refConcat->num_refs;
refConcat->num_refs += num;
// printf("first refConcat->refs=%p\n",refConcat->refs); fflush(stdout);
refConcat->refs = realloc(refConcat->refs,
sizeof(Reference[refConcat->num_refs]));
// refConcat->refs = (Reference*)my_realloc(refConcat->refs,
// sizeof(Reference[old_num]), sizeof(Reference[refConcat->num_refs]));
// printf("now refConcat->refs=%p\n",refConcat->refs); fflush(stdout);
// printf("access test: %p\n",refConcat->refs[0]); fflush(stdout);
/* Get and add the references from the Ruby value. */
for(long i=0; i< num; ++i) {
Reference ref;
// show_access(refConcat->refs,old_num+i);
value_to_rcsim(ReferenceS,rb_ary_entry(refVs,i),ref);
refConcat->refs[old_num + i] = ref;
// printf("ref=%p ref &type=%p type=%p width=%llu\n",ref,&(ref->type),ref->type,type_width(ref->type));
}
return refConcatV;
}
|