Example #1
0
mrb_value
mrb_mod_const_get(mrb_state *mrb, mrb_value mod)
{
  mrb_value sym;
  mrb_get_args(mrb, "o", &sym);

  check_const_name(mrb, mrb_sym_value(mrb,sym));
  return mrb_const_get(mrb, mod, mrb_sym_value(mrb, sym));
}
Example #2
0
File: class.c Project: takkaw/mruby
mrb_value
mrb_mod_const_get(mrb_state *mrb, mrb_value mod)
{
  mrb_sym id;

  mrb_get_args(mrb, "n", &id);
  check_const_name(mrb, id);
  return mrb_const_get(mrb, mod, id);
}
Example #3
0
mrb_value
mrb_mod_const_set(mrb_state *mrb, mrb_value mod)
{
  mrb_value sym, value;
  mrb_get_args(mrb, "oo", &sym, &value);

  check_const_name(mrb, mrb_sym_value(mrb,sym));
  mrb_const_set(mrb, mod, mrb_sym_value(mrb, sym), value);
  return value;
}
Example #4
0
File: class.c Project: takkaw/mruby
mrb_value
mrb_mod_const_set(mrb_state *mrb, mrb_value mod)
{
  mrb_sym id;
  mrb_value value;

  mrb_get_args(mrb, "no", &id, &value);
  check_const_name(mrb, id);
  mrb_const_set(mrb, mod, id, value);
  return value;
}
Example #5
0
mrb_value
mrb_mod_const_defined(mrb_state *mrb, mrb_value mod)
{
  mrb_value sym;
  mrb_get_args(mrb, "o", &sym);

  check_const_name(mrb, mrb_sym_value(mrb,sym));
  if(mrb_const_defined(mrb, mod, mrb_sym_value(mrb, sym))) {
    return mrb_true_value();
  }
  return mrb_false_value();
}
Example #6
0
File: class.c Project: takkaw/mruby
mrb_value
mrb_mod_const_defined(mrb_state *mrb, mrb_value mod)
{
  mrb_sym id;
  mrb_bool const_defined_p;

  mrb_get_args(mrb, "n", &id);
  check_const_name(mrb, id);
  const_defined_p = mrb_const_defined(mrb, mod, id);

  return mrb_bool_value(const_defined_p);
}
Example #7
0
File: class.c Project: takkaw/mruby
mrb_value
mrb_mod_remove_const(mrb_state *mrb, mrb_value mod)
{
  mrb_sym id;
  mrb_value val;

  mrb_get_args(mrb, "n", &id);
  check_const_name(mrb, id);
  val = mrb_iv_remove(mrb, mod, id);
  if (mrb_undef_p(val)) {
    mrb_name_error(mrb, id, "constant %S not defined", mrb_sym2str(mrb, id));
  }
  return val;
}