1#ifndef RUBY_BACKWARD_CXXANYARGS_HPP
2#define RUBY_BACKWARD_CXXANYARGS_HPP
207 return ::rb_iterate(q, w,
t, r);
214 return ::rb_iterate(q, w, e, r);
233 return ::rb_block_call(q, w, e, r, u, y);
240 return ::rb_block_call(q, w, e, r,
t, y);
262 func1_t *
t =
reinterpret_cast<func1_t*
>(q);
263 func2_t *y =
reinterpret_cast<func2_t*
>(e);
264 return ::rb_rescue(
t, w, y, r);
286 func1_t *
t =
reinterpret_cast<func1_t*
>(q);
287 func2_t *y =
reinterpret_cast<func2_t*
>(e);
311 func1_t *
t =
reinterpret_cast<func1_t*
>(q);
312 func1_t *y =
reinterpret_cast<func1_t*
>(e);
313 return ::rb_ensure(
t, w, y, r);
332 return ::rb_catch(q, r, e);
339 return ::rb_catch(q, w, e);
359 return ::rb_catch_obj(q, r, e);
379 return ::rb_fiber_new(e, w);
395 return ::rb_proc_new(e, w);
410 typedef VALUE ptr_t(
void*);
411 ptr_t *e =
reinterpret_cast<ptr_t*
>(q);
412 return ::rb_thread_create(e, w);
434 return ::st_foreach(q, r, e);
452 return ::st_foreach_check(q,
t, e, 0);
512namespace define_method {
520template<
typename T,
void (*F)(VALUE klass, T m
id, type *func,
int arity)>
526 template<
int N,
typename U>
538#if (RUBY_API_VERSION_MAJOR * 100 + RUBY_API_VERSION_MINOR) >= 301
546 F(klass, mid, func,
N);
556 F(klass, mid,
reinterpret_cast<type *
>(func),
N);
563 F(klass, mid,
reinterpret_cast<type *
>(func),
N);
568 template<
int N,
bool = false>
struct specific :
public engine<N, type *> {};
569 template<
bool b>
struct specific<15, b> :
public engine<15, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
570 template<
bool b>
struct specific<14, b> :
public engine<14, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
571 template<
bool b>
struct specific<13, b> :
public engine<13, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
572 template<
bool b>
struct specific<12, b> :
public engine<12, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
573 template<
bool b>
struct specific<11, b> :
public engine<11, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
574 template<
bool b>
struct specific<10, b> :
public engine<10, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
575 template<
bool b>
struct specific< 9, b> :
public engine< 9, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
576 template<
bool b>
struct specific< 8, b> :
public engine< 8, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
577 template<
bool b>
struct specific< 7, b> :
public engine< 7, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
578 template<
bool b>
struct specific< 6, b> :
public engine< 6, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
579 template<
bool b>
struct specific< 5, b> :
public engine< 5, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
580 template<
bool b>
struct specific< 4, b> :
public engine< 4, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE)> {};
581 template<
bool b>
struct specific< 3, b> :
public engine< 3, VALUE(*)(VALUE, VALUE, VALUE, VALUE)> {};
582 template<
bool b>
struct specific< 2, b> :
public engine< 2, VALUE(*)(VALUE, VALUE, VALUE)> {};
583 template<
bool b>
struct specific< 1, b> :
public engine< 1, VALUE(*)(VALUE, VALUE)> {};
584 template<
bool b>
struct specific< 0, b> :
public engine< 0, VALUE(*)(VALUE)> {};
585 template<
bool b>
struct specific<-1, b> :
public engine<-1, VALUE(*)(int argc, VALUE *argv, VALUE self)> {
589 template<
bool b>
struct specific<-2, b> :
public engine<-2, VALUE(*)(VALUE, VALUE)> {};
595template<
typename T,
void (*F)(T m
id, type func,
int arity)>
597 template<
int N,
typename U>
608 F(mid,
reinterpret_cast<type *
>(func),
N);
613 F(mid,
reinterpret_cast<type *
>(func),
N);
617 template<
int N,
bool = false>
struct specific :
public engine<N, type *> {};
618 template<
bool b>
struct specific<15, b> :
public engine<15, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
619 template<
bool b>
struct specific<14, b> :
public engine<14, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
620 template<
bool b>
struct specific<13, b> :
public engine<13, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
621 template<
bool b>
struct specific<12, b> :
public engine<12, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
622 template<
bool b>
struct specific<11, b> :
public engine<11, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
623 template<
bool b>
struct specific<10, b> :
public engine<10, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
624 template<
bool b>
struct specific< 9, b> :
public engine< 9, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
625 template<
bool b>
struct specific< 8, b> :
public engine< 8, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
626 template<
bool b>
struct specific< 7, b> :
public engine< 7, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
627 template<
bool b>
struct specific< 6, b> :
public engine< 6, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
628 template<
bool b>
struct specific< 5, b> :
public engine< 5, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
629 template<
bool b>
struct specific< 4, b> :
public engine< 4, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE)> {};
630 template<
bool b>
struct specific< 3, b> :
public engine< 3, VALUE(*)(VALUE, VALUE, VALUE, VALUE)> {};
631 template<
bool b>
struct specific< 2, b> :
public engine< 2, VALUE(*)(VALUE, VALUE, VALUE)> {};
632 template<
bool b>
struct specific< 1, b> :
public engine< 1, VALUE(*)(VALUE, VALUE)> {};
633 template<
bool b>
struct specific< 0, b> :
public engine< 0, VALUE(*)(VALUE)> {};
634 template<
bool b>
struct specific<-1, b> :
public engine<-1, VALUE(*)(int argc, VALUE *argv, VALUE self)> {
638 template<
bool b>
struct specific<-2, b> :
public engine<-2, VALUE(*)(VALUE, VALUE)> {};
653#define rb_define_method(klass, mid, func, arity) ruby::backward::cxxanyargs::define_method::rb_define_method::specific<arity>::define(klass, mid, func)
656#define rb_define_method_id(klass, mid, func, arity) ruby::backward::cxxanyargs::define_method::rb_define_method_id::specific<arity>::define(klass, mid, func)
660#define rb_define_private_method(klass, mid, func, arity) ruby::backward::cxxanyargs::define_method::rb_define_private_method::specific<arity>::define(klass, mid, func)
664#define rb_define_protected_method(klass, mid, func, arity) ruby::backward::cxxanyargs::define_method::rb_define_protected_method::specific<arity>::define(klass, mid, func)
668#define rb_define_singleton_method(klass, mid, func, arity) ruby::backward::cxxanyargs::define_method::rb_define_singleton_method::specific<arity>::define(klass, mid, func)
672#define rb_define_module_function(klass, mid, func, arity) ruby::backward::cxxanyargs::define_method::rb_define_module_function::specific<arity>::define(klass, mid, func)
678#define rb_define_global_function(mid, func, arity) ruby::backward::cxxanyargs::define_method::rb_define_global_function::specific<arity>::define(mid, func)
#define RUBY_CXX_DEPRECATED(mseg)
VALUE rb_vrescue2(VALUE(*b_proc)(VALUE), VALUE data1, VALUE(*r_proc)(VALUE, VALUE), VALUE data2, va_list args)
An equivalent of rescue clause.
Thin wrapper to ruby/config.h.
Public APIs related to rb_cClass/rb_cModule.
Public APIs related to rb_cFiber.
Public APIs related to rb_cHash.
Public APIs related to rb_cProc.
Public APIs related to rb_cThread.
Public APIs related to names inside of a Ruby program.
Public APIs related to rb_cRubyVM.
Creation and modification of Ruby methods.
C-function backended Ruby-global variables.
void rb_gvar_setter_t(VALUE val, ID id, VALUE *data)
VALUE rb_gvar_getter_t(ID id, VALUE *data)
rb_block_call_func * rb_block_call_func_t
VALUE notimpl_type(int, const VALUE *, VALUE, VALUE)
Type of rb_f_notimplement().
Provides ANYARGS deprecation warnings.
VALUE onearg_type(VALUE)
Single-argumented function type.
VALUE rb_catch_obj(VALUE q, type *w, VALUE e)
An equivalent of Kernel#catch.
VALUE rb_catch(const char *q, type *w, VALUE e)
An equivalent of Kernel#catch.
void rb_define_hooked_variable(const char *q, VALUE *w, type *e, void_type *r)
Define a function-backended global variable.
VALUE rb_thread_create(type *q, void *w)
Creates a rb_cThread instance.
int int_type(ANYARGS)
ANYARGS-ed function type, int variant.
void void_type(ANYARGS)
ANYARGS-ed function type, void variant.
VALUE rb_block_call(VALUE q, ID w, int e, const VALUE *r, type *t, VALUE y)
Call a method with a block.
VALUE rb_proc_new(type *q, VALUE w)
Creates a rb_cProc instance.
VALUE rb_iterate(onearg_type *q, VALUE w, type *e, VALUE r)
Old way to implement iterators.
VALUE type(ANYARGS)
ANYARGS-ed function type.
VALUE rb_fiber_new(type *q, VALUE w)
Creates a rb_cFiber instance.
void rb_hash_foreach(VALUE q, int_type *w, VALUE e)
Iteration over the given hash.
void rb_define_virtual_variable(const char *q, type *w, void_type *e)
Define a function-backended global variable.
void rb_ivar_foreach(VALUE q, int_type *w, VALUE e)
Iteration over each instance variable of the object.
VALUE rb_rescue2(type *q, VALUE w, type *e, VALUE r,...)
An equivalent of rescue clause.
VALUE rb_rescue(type *q, VALUE w, type *e, VALUE r)
An equivalent of rescue clause.
VALUE rb_ensure(type *q, VALUE w, type *e, VALUE r)
An equivalent of ensure clause.
int st_foreach_check_callback_func(st_data_t, st_data_t, st_data_t, int)
int st_foreach_callback_func(st_data_t, st_data_t, st_data_t)
static void define(T mid, type func)
static void define(T mid, notimpl_type func)
static void define(T mid, U func)
static void define(VALUE klass, T mid, type func)
Defines klass::mid as func, whose arity is N.
static void define(VALUE klass, T mid, U func)
Defines klass::mid as func, whose arity is N.
static void define(VALUE klass, T mid, notimpl_type func)
Defines klass::mid as func, whose arity is N.
Template metaprogramming to generate function prototypes.
Dispatches appropriate driver for rb_define_global_function.
Dispatches appropriate driver for rb_define_method_id.
Dispatches appropriate driver for rb_define_method.
Dispatches appropriate driver for rb_define_module_function.
Dispatches appropriate driver for rb_define_private_method.
Dispatches appropriate driver for rb_define_protected_method.
Dispatches appropriate driver for rb_define_singleton_method.