Method: RCSimCinterface.rcsim_add_systemT_inputs
- Defined in:
- ext/hruby_sim/hruby_rcsim_build.c
.rcsim_add_systemT_inputs(systemTV, sigVs) ⇒ Object
Adds inputs to a C systemT.
921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 |
# File 'ext/hruby_sim/hruby_rcsim_build.c', line 921 VALUE rcsim_add_systemT_inputs(VALUE mod, VALUE systemTV, VALUE sigVs) { /* Get the C systemT from the Ruby value. */ SystemT systemT; value_to_rcsim(SystemTS,systemTV,systemT); // printf("rcsim_add_systemT_inputs with systemT=%p\n",systemT); // printf("Adding to systemT with kind=%d and name=%s\n",systemT->kind, systemT->name); /* Prepare the size for the inputs. */ long num = RARRAY_LEN(sigVs); long old_num = systemT->num_inputs; systemT->num_inputs += num; // printf("first systemT->inputs=%p\n",systemT->inputs); fflush(stdout); systemT->inputs=realloc(systemT->inputs, sizeof(SignalI[systemT->num_inputs])); // systemT->inputs=(SignalI*)my_realloc(systemT->inputs, // sizeof(SignalI[old_num]), sizeof(SignalI[systemT->num_inputs])); // printf("now systemT->inputs=%p\n",systemT->inputs); fflush(stdout); // printf("access test: %p\n",systemT->inputs[0]); fflush(stdout); /* Get and add the signals from the Ruby value. */ for(long i=0; i< num; ++i) { SignalI sig; // show_access(systemT->inputs,old_num+i); value_to_rcsim(SignalIS,rb_ary_entry(sigVs,i),sig); systemT->inputs[old_num + i] = sig; } return systemTV; } |