Method: RCSimCinterface.rcsim_make_event
- Defined in:
- ext/hruby_sim/hruby_rcsim_build.c
.rcsim_make_event(typeV, sigV) ⇒ Object
Creating an event C object.
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
# File 'ext/hruby_sim/hruby_rcsim_build.c', line 292 VALUE rcsim_make_event(VALUE mod, VALUE typeV, VALUE sigV) { // printf("rcsim_make_event\n"); /* Allocates the event. */ Event event = (Event)malloc(sizeof(EventS)); // printf("event=%p\n",event); /* Set it up. */ event->kind = EVENT; event->owner = NULL; /* Its type. */ ID id_edge = SYM2ID(typeV); if (id_edge == id_POSEDGE) { event->edge = POSEDGE; } else if (id_edge == id_NEGEDGE) { event->edge = NEGEDGE; } else if (id_edge == id_ANYEDGE) { event->edge = ANYEDGE; } else { perror("Invalid edge type."); } /* Its signal. */ value_to_rcsim(SignalIS,sigV,event->signal); /* Returns the C event embedded into a ruby VALUE. */ VALUE res; rcsim_to_value(EventS,event,res); return res; } |