Method: RCSimCinterface.rcsim_make_scope

Defined in:
ext/hruby_sim/hruby_rcsim_build.c

.rcsim_make_scope(name) ⇒ Object

Creating a scope C object.



231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'ext/hruby_sim/hruby_rcsim_build.c', line 231

VALUE rcsim_make_scope(VALUE mod, VALUE name) {
    // printf("rcsim_make_scope\n");
    /* Allocates the scope. */
    Scope scope = (Scope)malloc(sizeof(ScopeS));
    // printf("scope=%p\n",scope);
    /* Set it up. */
    scope->kind = SCOPE;
    scope->owner = NULL;
    scope->name = strdup(StringValueCStr(name));
    // printf("scope->name=%p\n",scope->name);
    scope->num_systemIs = 0;
    scope->systemIs = NULL;
    scope->num_inners = 0;
    scope->inners = NULL;
    scope->num_scopes = 0;
    scope->scopes = NULL;
    scope->num_behaviors = 0;
    scope->behaviors = NULL;
    scope->num_codes = 0;
    scope->codes = NULL;
    /* Returns the C scope embedded into a ruby VALUE. */
    VALUE res;
    rcsim_to_value(ScopeS,scope,res);
    return res;
}