w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

method.c
Go to the documentation of this file.
1 #include "mruby.h"
2 #include "mruby/array.h"
3 #include "mruby/class.h"
4 #include "mruby/variable.h"
5 #include "mruby/proc.h"
6 #include "mruby/string.h"
7 #include "mruby/presym.h"
8 
9 static struct RObject *
10 method_object_alloc(mrb_state *mrb, struct RClass *mclass)
11 {
12  return (struct RObject*)mrb_obj_alloc(mrb, MRB_TT_OBJECT, mclass);
13 }
14 
15 static void
17 {
18  if (!mrb_module_p(owner) &&
19  mrb_class_ptr(owner) != mrb_obj_class(mrb, recv) &&
20  !mrb_obj_is_kind_of(mrb, recv, mrb_class_ptr(owner))) {
21  if (mrb_sclass_p(owner)) {
22  mrb_raise(mrb, E_TYPE_ERROR, "singleton method called for a different object");
23  } else {
24  mrb_raisef(mrb, E_TYPE_ERROR, "bind argument must be an instance of %v", owner);
25  }
26  }
27 }
28 
29 static mrb_value
31 {
32  struct RObject *me;
33  mrb_value owner = mrb_iv_get(mrb, self, MRB_SYM(_owner));
34  mrb_value name = mrb_iv_get(mrb, self, MRB_SYM(_name));
35  mrb_value proc = mrb_iv_get(mrb, self, MRB_SYM(_proc));
36  mrb_value klass = mrb_iv_get(mrb, self, MRB_SYM(_klass));
37  mrb_value recv = mrb_get_arg1(mrb);
38 
39  bind_check(mrb, recv, owner);
40  me = method_object_alloc(mrb, mrb_class_get_id(mrb, MRB_SYM(Method)));
41  mrb_obj_iv_set(mrb, me, MRB_SYM(_owner), owner);
42  mrb_obj_iv_set(mrb, me, MRB_SYM(_recv), recv);
43  mrb_obj_iv_set(mrb, me, MRB_SYM(_name), name);
44  mrb_obj_iv_set(mrb, me, MRB_SYM(_proc), proc);
45  mrb_obj_iv_set(mrb, me, MRB_SYM(_klass), klass);
46 
47  return mrb_obj_value(me);
48 }
49 
50 #define IV_GET(value, name) mrb_iv_get(mrb, value, name)
51 static mrb_value
53 {
55  mrb_value receiver, orig_proc, other_proc;
56  struct RClass *owner, *klass;
57  struct RProc *orig_rproc, *other_rproc;
58 
59  if (!mrb_obj_is_instance_of(mrb, other, mrb_class(mrb, self)))
60  return mrb_false_value();
61 
62  if (mrb_class(mrb, self) != mrb_class(mrb, other))
63  return mrb_false_value();
64 
65  klass = mrb_class_ptr(IV_GET(self, MRB_SYM(_klass)));
66  if (klass != mrb_class_ptr(IV_GET(other, MRB_SYM(_klass))))
67  return mrb_false_value();
68 
69  owner = mrb_class_ptr(IV_GET(self, MRB_SYM(_owner)));
70  if (owner != mrb_class_ptr(IV_GET(other, MRB_SYM(_owner))))
71  return mrb_false_value();
72 
73  receiver = IV_GET(self, MRB_SYM(_recv));
74  if (!mrb_obj_equal(mrb, receiver, IV_GET(other, MRB_SYM(_recv))))
75  return mrb_false_value();
76 
77  orig_proc = IV_GET(self, MRB_SYM(_proc));
78  other_proc = IV_GET(other, MRB_SYM(_proc));
79  if (mrb_nil_p(orig_proc) && mrb_nil_p(other_proc)) {
80  if (mrb_symbol(IV_GET(self, MRB_SYM(_name))) == mrb_symbol(IV_GET(other, MRB_SYM(_name))))
81  return mrb_true_value();
82  else
83  return mrb_false_value();
84  }
85 
86  if (mrb_nil_p(orig_proc))
87  return mrb_false_value();
88  if (mrb_nil_p(other_proc))
89  return mrb_false_value();
90 
91  orig_rproc = mrb_proc_ptr(orig_proc);
92  other_rproc = mrb_proc_ptr(other_proc);
93  if (MRB_PROC_CFUNC_P(orig_rproc)) {
94  if (!MRB_PROC_CFUNC_P(other_rproc))
95  return mrb_false_value();
96  if (orig_rproc->body.func != other_rproc->body.func)
97  return mrb_false_value();
98  }
99  else {
100  if (MRB_PROC_CFUNC_P(other_rproc))
101  return mrb_false_value();
102  if (orig_rproc->body.irep != other_rproc->body.irep)
103  return mrb_false_value();
104  }
105 
106  return mrb_true_value();
107 }
108 
109 #undef IV_GET
110 
111 static mrb_value
114 {
115  mrb_value ret;
116  mrb_sym orig_mid = mrb->c->ci->mid;
117 
118  mrb->c->ci->mid = mrb_symbol(name);
119  if (mrb_nil_p(proc)) {
120  mrb_value missing_argv = mrb_ary_new_from_values(mrb, argc, argv);
121  mrb_ary_unshift(mrb, missing_argv, name);
122  ret = mrb_funcall_argv(mrb, recv, MRB_SYM(method_missing), argc + 1, RARRAY_PTR(missing_argv));
123  }
124  else if (!mrb_nil_p(block)) {
125  /*
126  workaround since `mrb_yield_with_class` does not support passing block as parameter
127  need new API that initializes `mrb->c->stack[argc+1]` with block passed by argument
128  */
130  }
131  else {
132  ret = mrb_yield_with_class(mrb, proc, argc, argv, recv, owner);
133  }
134  mrb->c->ci->mid = orig_mid;
135  return ret;
136 }
137 
138 static mrb_value
140 {
141  mrb_value proc = mrb_iv_get(mrb, self, MRB_SYM(_proc));
142  mrb_value name = mrb_iv_get(mrb, self, MRB_SYM(_name));
143  mrb_value recv = mrb_iv_get(mrb, self, MRB_SYM(_recv));
144  struct RClass *owner = mrb_class_ptr(mrb_iv_get(mrb, self, MRB_SYM(_owner)));
145  mrb_int argc;
146  const mrb_value *argv;
148 
149  mrb_get_args(mrb, "*&", &argv, &argc, &block);
150  return mcall(mrb, recv, proc, name, owner, argc, argv, block);
151 }
152 
153 static mrb_value
155 {
156  mrb_value proc = mrb_iv_get(mrb, self, MRB_SYM(_proc));
157  mrb_value name = mrb_iv_get(mrb, self, MRB_SYM(_name));
158  mrb_value recv = mrb_iv_get(mrb, self, MRB_SYM(_recv));
159  mrb_value owner = mrb_iv_get(mrb, self, MRB_SYM(_owner));
160  mrb_int argc;
161  const mrb_value *argv;
163 
164  mrb_get_args(mrb, "o*&", &recv, &argv, &argc, &block);
165  bind_check(mrb, recv, owner);
166  return mcall(mrb, recv, proc, name, mrb_class_ptr(owner), argc, argv, block);
167 }
168 
169 static mrb_value
171 {
172  struct RObject *ume;
173  mrb_value owner = mrb_iv_get(mrb, self, MRB_SYM(_owner));
174  mrb_value name = mrb_iv_get(mrb, self, MRB_SYM(_name));
175  mrb_value proc = mrb_iv_get(mrb, self, MRB_SYM(_proc));
176  mrb_value klass = mrb_iv_get(mrb, self, MRB_SYM(_klass));
177 
178  ume = method_object_alloc(mrb, mrb_class_get(mrb, "UnboundMethod"));
179  mrb_obj_iv_set(mrb, ume, MRB_SYM(_owner), owner);
180  mrb_obj_iv_set(mrb, ume, MRB_SYM(_recv), mrb_nil_value());
181  mrb_obj_iv_set(mrb, ume, MRB_SYM(_name), name);
182  mrb_obj_iv_set(mrb, ume, MRB_SYM(_proc), proc);
183  mrb_obj_iv_set(mrb, ume, MRB_SYM(_klass), klass);
184 
185  return mrb_obj_value(ume);
186 }
187 
188 static struct RProc *
190 {
191  mrb_method_t m = mrb_method_search_vm(mrb, cp, mid);
192  if (MRB_METHOD_UNDEF_P(m))
193  return NULL;
194  if (MRB_METHOD_PROC_P(m))
195  return MRB_METHOD_PROC(m);
196  return mrb_proc_new_cfunc(mrb, MRB_METHOD_FUNC(m));
197 }
198 
199 static mrb_value
201 {
202  mrb_value recv = mrb_iv_get(mrb, self, MRB_SYM(_recv));
203  mrb_value klass = mrb_iv_get(mrb, self, MRB_SYM(_klass));
204  mrb_value owner = mrb_iv_get(mrb, self, MRB_SYM(_owner));
205  mrb_value name = mrb_iv_get(mrb, self, MRB_SYM(_name));
206  struct RClass *super, *rklass;
207  struct RProc *proc;
208  struct RObject *me;
209 
210  switch (mrb_type(klass)) {
211  case MRB_TT_SCLASS:
212  super = mrb_class_ptr(klass)->super->super;
213  break;
214  case MRB_TT_ICLASS:
215  super = mrb_class_ptr(klass)->super;
216  break;
217  default:
218  super = mrb_class_ptr(owner)->super;
219  break;
220  }
221 
222  proc = method_search_vm(mrb, &super, mrb_symbol(name));
223  if (!proc)
224  return mrb_nil_value();
225 
226  rklass = super;
227  while (super->tt == MRB_TT_ICLASS)
228  super = super->c;
229 
230  me = method_object_alloc(mrb, mrb_obj_class(mrb, self));
231  mrb_obj_iv_set(mrb, me, MRB_SYM(_owner), mrb_obj_value(super));
232  mrb_obj_iv_set(mrb, me, MRB_SYM(_recv), recv);
233  mrb_obj_iv_set(mrb, me, MRB_SYM(_name), name);
235  mrb_obj_iv_set(mrb, me, MRB_SYM(_klass), mrb_obj_value(rklass));
236 
237  return mrb_obj_value(me);
238 }
239 
240 static mrb_value
242 {
243  mrb_value proc = mrb_iv_get(mrb, self, MRB_SYM(_proc));
245  return mrb_fixnum_value(arity);
246 }
247 
248 static mrb_value
250 {
251  mrb_value proc = mrb_iv_get(mrb, self, MRB_SYM(_proc));
252  struct RProc *rproc;
253  struct RClass *orig;
254  mrb_value ret;
255 
256  if (mrb_nil_p(proc))
257  return mrb_nil_value();
258 
259  rproc = mrb_proc_ptr(proc);
260  orig = rproc->c;
261  rproc->c = mrb->proc_class;
262  ret = mrb_funcall_id(mrb, proc, MRB_SYM(source_location), 0);
263  rproc->c = orig;
264  return ret;
265 }
266 
267 static mrb_value
269 {
270  mrb_value proc = mrb_iv_get(mrb, self, MRB_SYM(_proc));
271  struct RProc *rproc;
272  struct RClass *orig;
273  mrb_value ret;
274 
275  if (mrb_nil_p(proc)) {
277  mrb_value arest = mrb_ary_new_from_values(mrb, 1, &rest);
278  return mrb_ary_new_from_values(mrb, 1, &arest);
279  }
280 
281  rproc = mrb_proc_ptr(proc);
282  orig = rproc->c;
283  rproc->c = mrb->proc_class;
285  rproc->c = orig;
286  return ret;
287 }
288 
289 static mrb_value
291 {
292  mrb_value owner = mrb_iv_get(mrb, self, MRB_SYM(_owner));
293  mrb_value klass = mrb_iv_get(mrb, self, MRB_SYM(_klass));
294  mrb_value name = mrb_iv_get(mrb, self, MRB_SYM(_name));
295  mrb_value str = mrb_str_new_lit(mrb, "#<");
296  struct RClass *rklass;
297 
298  mrb_str_cat_cstr(mrb, str, mrb_obj_classname(mrb, self));
299  mrb_str_cat_lit(mrb, str, ": ");
300  rklass = mrb_class_ptr(klass);
301  if (mrb_class_ptr(owner) == rklass) {
302  mrb_str_concat(mrb, str, owner);
303  mrb_str_cat_lit(mrb, str, "#");
304  mrb_str_concat(mrb, str, name);
305  }
306  else {
307  mrb_str_cat_cstr(mrb, str, mrb_class_name(mrb, rklass));
308  mrb_str_cat_lit(mrb, str, "(");
309  mrb_str_concat(mrb, str, owner);
310  mrb_str_cat_lit(mrb, str, ")#");
311  mrb_str_concat(mrb, str, name);
312  }
313  mrb_str_cat_lit(mrb, str, ">");
314  return str;
315 }
316 
317 static void
318 mrb_search_method_owner(mrb_state *mrb, struct RClass *c, mrb_value obj, mrb_sym name, struct RClass **owner, struct RProc **proc, mrb_bool unbound)
319 {
320  mrb_value ret;
321 
322  *owner = c;
323  *proc = method_search_vm(mrb, owner, name);
324  if (!*proc) {
325  if (unbound) {
326  goto name_error;
327  }
328  if (!mrb_respond_to(mrb, obj, MRB_SYM_Q(respond_to_missing))) {
329  goto name_error;
330  }
331  ret = mrb_funcall_id(mrb, obj, MRB_SYM_Q(respond_to_missing), 2, mrb_symbol_value(name), mrb_true_value());
332  if (!mrb_test(ret)) {
333  goto name_error;
334  }
335  *owner = c;
336  }
337 
338  while ((*owner)->tt == MRB_TT_ICLASS)
339  *owner = (*owner)->c;
340 
341  return;
342 
343 name_error:
344  mrb_raisef(mrb, E_NAME_ERROR, "undefined method '%n' for class '%C'", name, c);
345 }
346 
347 static mrb_value
349 {
350  struct RClass *owner;
351  struct RProc *proc;
352  struct RObject *me;
353  mrb_sym name;
354 
355  mrb_get_args(mrb, "n", &name);
356 
357  mrb_search_method_owner(mrb, mrb_class(mrb, self), self, name, &owner, &proc, FALSE);
358 
359  me = method_object_alloc(mrb, mrb_class_get(mrb, "Method"));
360  mrb_obj_iv_set(mrb, me, MRB_SYM(_owner), mrb_obj_value(owner));
361  mrb_obj_iv_set(mrb, me, MRB_SYM(_recv), self);
362  mrb_obj_iv_set(mrb, me, MRB_SYM(_name), mrb_symbol_value(name));
364  mrb_obj_iv_set(mrb, me, MRB_SYM(_klass), mrb_obj_value(mrb_class(mrb, self)));
365 
366  return mrb_obj_value(me);
367 }
368 
369 static mrb_value
371 {
372  struct RClass *owner;
373  struct RProc *proc;
374  struct RObject *ume;
375  mrb_sym name;
376 
377  mrb_get_args(mrb, "n", &name);
378 
379  mrb_search_method_owner(mrb, mrb_class_ptr(self), self, name, &owner, &proc, TRUE);
380 
381  ume = method_object_alloc(mrb, mrb_class_get(mrb, "UnboundMethod"));
382  mrb_obj_iv_set(mrb, ume, MRB_SYM(_owner), mrb_obj_value(owner));
383  mrb_obj_iv_set(mrb, ume, MRB_SYM(_recv), mrb_nil_value());
384  mrb_obj_iv_set(mrb, ume, MRB_SYM(_name), mrb_symbol_value(name));
386  mrb_obj_iv_set(mrb, ume, MRB_SYM(_klass), self);
387 
388  return mrb_obj_value(ume);
389 }
390 
391 static mrb_value
393 {
394  return mrb_iv_get(mrb, self, MRB_SYM(_owner));
395 }
396 
397 static mrb_value
399 {
400  return mrb_iv_get(mrb, self, MRB_SYM(_recv));
401 }
402 
403 static mrb_value
405 {
406  return mrb_iv_get(mrb, self, MRB_SYM(_name));
407 }
408 
409 void
411 {
412  struct RClass *unbound_method = mrb_define_class(mrb, "UnboundMethod", mrb->object_class);
413  struct RClass *method = mrb_define_class(mrb, "Method", mrb->object_class);
414 
415  mrb_undef_class_method(mrb, unbound_method, "new");
416  mrb_define_method(mrb, unbound_method, "bind", unbound_method_bind, MRB_ARGS_REQ(1));
417  mrb_define_method(mrb, unbound_method, "super_method", method_super_method, MRB_ARGS_NONE());
418  mrb_define_method(mrb, unbound_method, "==", method_eql, MRB_ARGS_REQ(1));
419  mrb_define_method(mrb, unbound_method, "eql?", method_eql, MRB_ARGS_REQ(1));
420  mrb_define_method(mrb, unbound_method, "to_s", method_to_s, MRB_ARGS_NONE());
421  mrb_define_method(mrb, unbound_method, "inspect", method_to_s, MRB_ARGS_NONE());
422  mrb_define_method(mrb, unbound_method, "arity", method_arity, MRB_ARGS_NONE());
423  mrb_define_method(mrb, unbound_method, "source_location", method_source_location, MRB_ARGS_NONE());
424  mrb_define_method(mrb, unbound_method, "parameters", method_parameters, MRB_ARGS_NONE());
425  mrb_define_method(mrb, unbound_method, "bind_call", method_bcall, MRB_ARGS_REQ(1)|MRB_ARGS_ANY());
426  mrb_define_method(mrb, unbound_method, "owner", method_owner, MRB_ARGS_NONE());
427  mrb_define_method(mrb, unbound_method, "name", method_name, MRB_ARGS_NONE());
428 
429  mrb_undef_class_method(mrb, method, "new");
430  mrb_define_method(mrb, method, "==", method_eql, MRB_ARGS_REQ(1));
431  mrb_define_method(mrb, method, "eql?", method_eql, MRB_ARGS_REQ(1));
432  mrb_define_method(mrb, method, "to_s", method_to_s, MRB_ARGS_NONE());
433  mrb_define_method(mrb, method, "inspect", method_to_s, MRB_ARGS_NONE());
434  mrb_define_method(mrb, method, "call", method_call, MRB_ARGS_ANY());
435  mrb_define_method(mrb, method, "[]", method_call, MRB_ARGS_ANY());
436  mrb_define_method(mrb, method, "unbind", method_unbind, MRB_ARGS_NONE());
437  mrb_define_method(mrb, method, "super_method", method_super_method, MRB_ARGS_NONE());
438  mrb_define_method(mrb, method, "arity", method_arity, MRB_ARGS_NONE());
439  mrb_define_method(mrb, method, "source_location", method_source_location, MRB_ARGS_NONE());
440  mrb_define_method(mrb, method, "parameters", method_parameters, MRB_ARGS_NONE());
441  mrb_define_method(mrb, method, "owner", method_owner, MRB_ARGS_NONE());
442  mrb_define_method(mrb, method, "receiver", method_receiver, MRB_ARGS_NONE());
443  mrb_define_method(mrb, method, "name", method_name, MRB_ARGS_NONE());
444 
446 
447  mrb_define_method(mrb, mrb->module_class, "instance_method", mrb_module_instance_method, MRB_ARGS_REQ(1));
448 }
449 
450 void
452 {
453 }
cp
Definition: action.c:1035
#define name
#define mrb_symbol(o)
Definition: boxing_nan.h:72
#define mrb_module_p(o)
Definition: boxing_word.h:160
#define mrb_nil_p(o)
Definition: boxing_word.h:146
#define mrb_sclass_p(o)
Definition: boxing_word.h:162
MRB_INLINE enum mrb_vtype mrb_type(mrb_value o)
Definition: boxing_word.h:195
mrb_method_t mrb_method_search_vm(mrb_state *, struct RClass **, mrb_sym)
Definition: class.c:1730
#define mrb_class_ptr(v)
Definition: class.h:24
static struct RClass * mrb_class(mrb_state *mrb, mrb_value v)
Definition: class.h:27
@ FALSE
Definition: dd.h:101
@ TRUE
Definition: dd.h:102
#define MRB_SYM(name)
Definition: disable.h:20
#define MRB_SYM_Q(name)
Definition: disable.h:18
#define c(n)
Definition: gpos-common.c:150
#define NULL
Definition: ftobjs.h:61
static int ret
Definition: convert.c:72
static mrb_value mcall(mrb_state *mrb, mrb_value recv, mrb_value proc, mrb_value name, struct RClass *owner, mrb_int argc, const mrb_value *argv, mrb_value block)
Definition: method.c:112
static mrb_value mrb_kernel_method(mrb_state *mrb, mrb_value self)
Definition: method.c:348
static mrb_value method_source_location(mrb_state *mrb, mrb_value self)
Definition: method.c:249
static void mrb_search_method_owner(mrb_state *mrb, struct RClass *c, mrb_value obj, mrb_sym name, struct RClass **owner, struct RProc **proc, mrb_bool unbound)
Definition: method.c:318
void mrb_mruby_method_gem_final(mrb_state *mrb)
Definition: method.c:451
static mrb_value method_owner(mrb_state *mrb, mrb_value self)
Definition: method.c:392
static mrb_value method_receiver(mrb_state *mrb, mrb_value self)
Definition: method.c:398
static struct RProc * method_search_vm(mrb_state *mrb, struct RClass **cp, mrb_sym mid)
Definition: method.c:189
static mrb_value method_parameters(mrb_state *mrb, mrb_value self)
Definition: method.c:268
static mrb_value method_eql(mrb_state *mrb, mrb_value self)
Definition: method.c:52
static mrb_value method_name(mrb_state *mrb, mrb_value self)
Definition: method.c:404
static void bind_check(mrb_state *mrb, mrb_value recv, mrb_value owner)
Definition: method.c:16
void mrb_mruby_method_gem_init(mrb_state *mrb)
Definition: method.c:410
static mrb_value mrb_module_instance_method(mrb_state *mrb, mrb_value self)
Definition: method.c:370
static mrb_value method_call(mrb_state *mrb, mrb_value self)
Definition: method.c:139
static mrb_value method_arity(mrb_state *mrb, mrb_value self)
Definition: method.c:241
static mrb_value method_to_s(mrb_state *mrb, mrb_value self)
Definition: method.c:290
static mrb_value method_unbind(mrb_state *mrb, mrb_value self)
Definition: method.c:170
static struct RObject * method_object_alloc(mrb_state *mrb, struct RClass *mclass)
Definition: method.c:10
static mrb_value unbound_method_bind(mrb_state *mrb, mrb_value self)
Definition: method.c:30
static mrb_value method_bcall(mrb_state *mrb, mrb_value self)
Definition: method.c:154
static mrb_value method_super_method(mrb_state *mrb, mrb_value self)
Definition: method.c:200
#define IV_GET(value, name)
Definition: method.c:50
mrb_bool mrb_obj_is_kind_of(mrb_state *mrb, mrb_value obj, struct RClass *c)
Definition: object.c:485
#define E_TYPE_ERROR
Definition: mruby.h:1308
mrb_bool mrb_obj_is_instance_of(mrb_state *mrb, mrb_value obj, struct RClass *c)
Definition: kernel.c:324
struct RBasic * mrb_obj_alloc(mrb_state *, enum mrb_vtype, struct RClass *)
Definition: gc.c:535
void mrb_raisef(mrb_state *mrb, struct RClass *c, const char *fmt,...)
Definition: error.c:400
mrb_value mrb_funcall_id(mrb_state *mrb, mrb_value val, mrb_sym mid, mrb_int argc,...)
Definition: vm.c:337
mrb_value mrb_funcall_argv(mrb_state *mrb, mrb_value val, mrb_sym name, mrb_int argc, const mrb_value *argv)
Definition: vm.c:481
#define mrb_str_new_lit(mrb, lit)
Definition: mruby.h:1136
#define E_NAME_ERROR
Definition: mruby.h:1313
const char * mrb_class_name(mrb_state *mrb, struct RClass *klass)
Definition: class.c:2102
mrb_value mrb_get_arg1(mrb_state *mrb)
Definition: class.c:840
struct RClass * mrb_class_get(mrb_state *mrb, const char *name)
Definition: class.c:633
mrb_int mrb_get_args(mrb_state *mrb, mrb_args_format format,...)
Definition: class.c:891
void mrb_raise(mrb_state *mrb, struct RClass *c, const char *msg)
Definition: error.c:214
struct RClass * mrb_class_get_id(mrb_state *mrb, mrb_sym name)
Definition: class.c:639
#define MRB_ARGS_ANY()
Definition: mruby.h:874
mrb_bool mrb_obj_equal(mrb_state *mrb, mrb_value a, mrb_value b)
Definition: object.c:39
mrb_bool mrb_respond_to(mrb_state *mrb, mrb_value obj, mrb_sym mid)
Definition: class.c:2067
#define MRB_ARGS_NONE()
Definition: mruby.h:879
#define MRB_ARGS_REQ(n)
Definition: mruby.h:837
mrb_value mrb_funcall_with_block(mrb_state *mrb, mrb_value val, mrb_sym name, mrb_int argc, const mrb_value *argv, mrb_value block)
Definition: vm.c:380
struct RClass * mrb_obj_class(mrb_state *mrb, mrb_value obj)
Definition: class.c:2186
uintptr_t mrb_method_t
Definition: mruby.h:206
mrb_value mrb_yield_with_class(mrb_state *mrb, mrb_value b, mrb_int argc, const mrb_value *argv, mrb_value self, struct RClass *c)
Definition: vm.c:670
void mrb_undef_class_method(mrb_state *mrb, struct RClass *cls, const char *name)
Definition: class.c:2308
const char * mrb_obj_classname(mrb_state *mrb, mrb_value obj)
Definition: class.c:2112
@ other
Definition: mtxline.h:22
struct _proc * proc
Definition: obx.h:95
integer parameters[30]
Definition: pbmtopk.c:75
logical rest[4800]
Definition: pmxab.c:91
#define RARRAY_PTR(a)
Definition: array.h:71
mrb_value mrb_ary_new_from_values(mrb_state *mrb, mrb_int size, const mrb_value *vals)
Definition: array.c:94
mrb_value mrb_ary_unshift(mrb_state *mrb, mrb_value self, mrb_value item)
Definition: array.c:587
#define mrb_define_method(mrb, c, name, f, a)
Definition: scanning.h:15
#define mrb_define_class(mrb, name, s)
Definition: scanning.h:18
struct RProc * mrb_proc_new_cfunc(mrb_state *, mrb_func_t)
Definition: proc.c:118
#define MRB_METHOD_PROC(m)
Definition: proc.h:114
#define mrb_proc_ptr(v)
Definition: proc.h:87
#define MRB_METHOD_FUNC(m)
Definition: proc.h:110
#define MRB_METHOD_UNDEF_P(m)
Definition: proc.h:115
#define MRB_PROC_CFUNC_P(p)
Definition: proc.h:64
#define MRB_METHOD_PROC_P(m)
Definition: proc.h:113
mrb_int mrb_proc_arity(const struct RProc *p)
Definition: proc.c:275
mrb_value mrb_iv_get(mrb_state *mrb, mrb_value obj, mrb_sym sym)
Definition: variable.c:320
void mrb_obj_iv_set(mrb_state *mrb, struct RObject *obj, mrb_sym sym, mrb_value v)
Definition: variable.c:342
#define str(s)
Definition: sh6.c:399
mrb_value mrb_str_cat_cstr(mrb_state *mrb, mrb_value str, const char *ptr)
Definition: string.c:2714
#define mrb_str_cat_lit(mrb, str, lit)
Definition: string.h:417
void mrb_str_concat(mrb_state *mrb, mrb_value self, mrb_value other)
Definition: string.c:863
Definition: class.h:17
struct RClass * super
Definition: class.h:21
Definition: object.h:30
Definition: proc.h:41
union RProc::@1663 body
const mrb_irep * irep
Definition: proc.h:44
struct RClass * c
Definition: proc.h:42
mrb_func_t func
Definition: proc.h:45
Definition: obx.h:103
mrb_sym mid
Definition: mruby.h:152
mrb_callinfo * ci
Definition: mruby.h:178
struct RClass * module_class
Definition: mruby.h:244
struct mrb_context * c
Definition: mruby.h:235
struct RClass * object_class
Definition: mruby.h:242
struct RClass * kernel_module
Definition: mruby.h:259
struct RClass * proc_class
Definition: mruby.h:245
m
Definition: tex4ht.c:3990
#define mrb_test(o)
Definition: value.h:265
static mrb_value mrb_true_value(void)
Definition: value.h:352
int32_t mrb_int
Definition: value.h:35
static mrb_value mrb_false_value(void)
Definition: value.h:342
static mrb_value mrb_nil_value(void)
Definition: value.h:332
@ MRB_TT_SCLASS
Definition: value.h:120
@ MRB_TT_OBJECT
Definition: value.h:116
@ MRB_TT_ICLASS
Definition: value.h:119
static mrb_value mrb_fixnum_value(mrb_int i)
Definition: value.h:301
static mrb_value mrb_symbol_value(mrb_sym i)
Definition: value.h:309
static mrb_value mrb_obj_value(void *p)
Definition: value.h:317
#define argv
Definition: xmain.c:270
#define argc
Definition: xmain.c:269