summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--README.EXT8
-rw-r--r--README.EXT.ja9
-rw-r--r--include/ruby/ruby.h6
-rw-r--r--vm_eval.c4
5 files changed, 29 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 0b65cde..1585d5f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Fri May 31 17:26:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_eval.c (rb_funcallv): add better names of rb_funcall2.
+
+ * vm_eval.c (rb_funcallv_public): ditto for rb_funcall3.
+
Fri May 31 17:04:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* array.c (rb_ary_new_capa): add better names of rb_ary_new2.
diff --git a/README.EXT b/README.EXT
index 8074775..0d2d922 100644
--- a/README.EXT
+++ b/README.EXT
@@ -1242,10 +1242,18 @@ rb_scan_args(int argc, VALUE *argv, const char *fmt, ...) ::
VALUE rb_funcall(VALUE recv, ID mid, int narg, ...) ::
Invokes a method. To retrieve mid from a method name, use rb_intern().
+ Able to call even private/protected methods.
VALUE rb_funcall2(VALUE recv, ID mid, int argc, VALUE *argv) ::
+VALUE rb_funcallv(VALUE recv, ID mid, int argc, VALUE *argv) ::
Invokes a method, passing arguments as an array of values.
+ Able to call even private/protected methods.
+
+VALUE rb_funcallv_public(VALUE recv, ID mid, int argc, VALUE *argv) ::
+
+ Invokes a method, passing arguments as an array of values.
+ Able to call only public methods.
VALUE rb_eval_string(const char *str) ::
diff --git a/README.EXT.ja b/README.EXT.ja
index 93170a6..6f9cb41 100644
--- a/README.EXT.ja
+++ b/README.EXT.ja
@@ -527,6 +527,7 @@ Cから文字列を経由せずにRubyのメソッドを呼び出すためには
します.その他に引数の指定の仕方が違う以下の関数もあります.
VALUE rb_funcall2(VALUE recv, ID mid, int argc, VALUE *argv)
+ VALUE rb_funcallv(VALUE recv, ID mid, int argc, VALUE *argv)
VALUE rb_apply(VALUE recv, ID mid, VALUE args)
applyには引数としてRubyの配列を与えます.
@@ -1258,10 +1259,18 @@ VALUE rb_funcall(VALUE recv, ID mid, int narg, ...) ::
メソッド呼び出し.文字列からmidを得るためにはrb_intern()を
使う.
+ private/protectedなメソッドでも呼び出せる.
VALUE rb_funcall2(VALUE recv, ID mid, int argc, VALUE *argv) ::
+VALUE rb_funcallv(VALUE recv, ID mid, int argc, VALUE *argv) ::
メソッド呼び出し.引数をargc, argv形式で渡す.
+ private/protectedなメソッドでも呼び出せる.
+
+VALUE rb_funcallv_public(VALUE recv, ID mid, int argc, VALUE *argv) ::
+
+ メソッド呼び出し.
+ publicなメソッドしか呼べない.
VALUE rb_eval_string(const char *str)
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index d13325f..dd140c3 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -1463,8 +1463,10 @@ VALUE rb_eval_string(const char*);
VALUE rb_eval_string_protect(const char*, int*);
VALUE rb_eval_string_wrap(const char*, int*);
VALUE rb_funcall(VALUE, ID, int, ...);
-VALUE rb_funcall2(VALUE, ID, int, const VALUE*);
-VALUE rb_funcall3(VALUE, ID, int, const VALUE*);
+VALUE rb_funcallv(VALUE, ID, int, const VALUE*);
+VALUE rb_funcallv_public(VALUE, ID, int, const VALUE*);
+#define rb_funcall2 rb_funcallv
+#define rb_funcall3 rb_funcallv_public
VALUE rb_funcall_passing_block(VALUE, ID, int, const VALUE*);
int rb_scan_args(int, const VALUE*, const char*, ...);
VALUE rb_call_super(int, const VALUE*);
diff --git a/vm_eval.c b/vm_eval.c
index 5ba8668..c27df07 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -802,7 +802,7 @@ rb_funcall(VALUE recv, ID mid, int n, ...)
* \param argv pointer to an array of method arguments
*/
VALUE
-rb_funcall2(VALUE recv, ID mid, int argc, const VALUE *argv)
+rb_funcallv(VALUE recv, ID mid, int argc, const VALUE *argv)
{
return rb_call(recv, mid, argc, argv, CALL_FCALL);
}
@@ -817,7 +817,7 @@ rb_funcall2(VALUE recv, ID mid, int argc, const VALUE *argv)
* \param argv pointer to an array of method arguments
*/
VALUE
-rb_funcall3(VALUE recv, ID mid, int argc, const VALUE *argv)
+rb_funcallv_public(VALUE recv, ID mid, int argc, const VALUE *argv)
{
return rb_call(recv, mid, argc, argv, CALL_PUBLIC);
}