Method: RCSimCinterface.rcsim_add_scope_inners
- Defined in:
- ext/hruby_sim/hruby_rcsim_build.c
.rcsim_add_scope_inners(scopeV, sigVs) ⇒ Object
Adds inners to a C scope.
1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 |
# File 'ext/hruby_sim/hruby_rcsim_build.c', line 1003 VALUE rcsim_add_scope_inners(VALUE mod, VALUE scopeV, VALUE sigVs) { /* Get the C scope from the Ruby value. */ Scope scope; value_to_rcsim(ScopeS,scopeV,scope); // printf("rcsim_add_scope_inners with scope=%p\n",scope); /* Prepare the size for the inners. */ long num = RARRAY_LEN(sigVs); long old_num = scope->num_inners; scope->num_inners += num; // printf("first scope->inners=%p\n",scope->inners); fflush(stdout); scope->inners = realloc(scope->inners, sizeof(SignalI[scope->num_inners])); // scope->inners = (SignalI*)my_realloc(scope->inners, // sizeof(SignalI[old_num]), sizeof(SignalI[scope->num_inners])); // printf("now scope->inners=%p\n",scope->inners); fflush(stdout); // printf("access test: %p\n",scope->inners[0]); fflush(stdout); /* Get and add the signals from the Ruby value. */ for(long i=0; i< num; ++i) { SignalI sig; // show_access(scope->inners,old_num+i); value_to_rcsim(SignalIS,rb_ary_entry(sigVs,i),sig); scope->inners[old_num + i] = sig; } return scopeV; } |