Method: RCSimCinterface.rcsim_make_behavior
- Defined in:
- ext/hruby_sim/hruby_rcsim_build.c
.rcsim_make_behavior(timed) ⇒ Object
Creating a behavior C object.
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
# File 'ext/hruby_sim/hruby_rcsim_build.c', line 259 VALUE rcsim_make_behavior(VALUE mod, VALUE timed) { // printf("rcsim_make_behavior\n"); /* Allocates the behavior. */ Behavior behavior = (Behavior)malloc(sizeof(BehaviorS)); // printf("behavior=%p\n",behavior); /* Set it up. */ behavior->kind = BEHAVIOR; behavior->owner = NULL; behavior->num_events = 0; behavior->events = NULL; behavior->block = NULL; behavior->enabled = 0; behavior->activated = 0; if (TYPE(timed) == T_TRUE) { /* The behavior is timed, set it up and register it. */ behavior->timed = 1; register_timed_behavior(behavior); } else { /* The behavior is not timed. */ behavior->timed = 0; /* It must be initialized though. */ register_init_behavior(behavior); } behavior->active_time = 0; behavior->thread = NULL; /* Returns the C behavior embedded into a ruby VALUE. */ VALUE res; rcsim_to_value(BehaviorS,behavior,res); return res; } |