summaryrefslogtreecommitdiffhomepage
path: root/include/mruby.h
diff options
context:
space:
mode:
authorfelixjones <[email protected]>2015-08-16 23:41:21 +0100
committerfelixjones <[email protected]>2015-08-16 23:41:21 +0100
commit8e72558bacf1e9c8f5439c677c9282070b913998 (patch)
treed696d767921df0464680647f858fbe7a3ec5b286 /include/mruby.h
parenta1731254bee12c831ea1d509bf43520db1d0d9af (diff)
downloadmruby-8e72558bacf1e9c8f5439c677c9282070b913998.tar.gz
mruby-8e72558bacf1e9c8f5439c677c9282070b913998.zip
Added mrb_get_argc and mrb_get_mid
Diffstat (limited to 'include/mruby.h')
-rw-r--r--include/mruby.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/mruby.h b/include/mruby.h
index 1b792ce90..e5d19b170 100644
--- a/include/mruby.h
+++ b/include/mruby.h
@@ -255,6 +255,18 @@ MRB_API struct RClass * mrb_define_module_under(mrb_state *mrb, struct RClass *o
MRB_API mrb_int mrb_get_args(mrb_state *mrb, const char *format, ...);
+static inline mrb_sym
+mrb_get_mid(mrb_state *mrb) /* get method symbol */
+{
+ return mrb->c->ci->mid;
+}
+
+static inline int
+mrb_get_argc(mrb_state *mrb) /* get argc */
+{
+ return mrb->c->ci->argc;
+}
+
/* `strlen` for character string literals (use with caution or `strlen` instead)
Adjacent string literals are concatenated in C/C++ in translation phase 6.
If `lit` is not one, the compiler will report a syntax error: