Method: RCSimCinterface.rcsim_add_print_args
- Defined in:
- ext/hruby_sim/hruby_rcsim_build.c
.rcsim_add_print_args(printV, argVs) ⇒ Object
Adds arguments to a C print.
1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 |
# File 'ext/hruby_sim/hruby_rcsim_build.c', line 1304
VALUE rcsim_add_print_args(VALUE mod, VALUE printV, VALUE argVs) {
/* Get the C print from the Ruby value. */
Print print;
value_to_rcsim(PrintS,printV,print);
// printf("rcsim_add_print_args with print=%p\n",print);
/* Prepare the size for the arguments. */
long num = RARRAY_LEN(argVs);
long old_num = print->num_args;
print->num_args += num;
// printf("first print->args=%p\n",print->args); fflush(stdout);
print->args = realloc(print->args,
sizeof(Expression[print->num_args]));
// print->args = (Expression*)my_realloc(print->args,
// sizeof(Expression[old_num]), sizeof(Expression[print->num_args]));
// printf("now print->args=%p\n",print->args); fflush(stdout);
// printf("access test: %p\n",print->args[0]); fflush(stdout);
/* Get and add the arguments from the Ruby value. */
for(long i=0; i< num; ++i) {
Expression arg;
// show_access(print->args,old_num+i);
value_to_rcsim(ExpressionS,rb_ary_entry(argVs,i),arg);
print->args[old_num + i] = arg;
}
return printV;
}
|