Ruby: include/ruby/backward/cxxanyargs.hpp Source File

Ruby 3.4.9p82 (2026-03-11 revision 76cca827ab52ab1d346a728f068d5b8da3e2952b)

cxxanyargs.hpp
Go to the documentation of this file.
1#ifndef RUBY_BACKWARD_CXXANYARGS_HPP //-*-C++-*-vi:ft=cpp
2#define RUBY_BACKWARD_CXXANYARGS_HPP
13#include "ruby/internal/config.h"
14#include "ruby/internal/intern/class.h"
15#include "ruby/internal/intern/cont.h"
16#include "ruby/internal/intern/hash.h"
17#include "ruby/internal/intern/proc.h"
18#include "ruby/internal/intern/thread.h"
19#include "ruby/internal/intern/variable.h"
20#include "ruby/internal/intern/vm.h"
21#include "ruby/internal/iterator.h"
22#include "ruby/internal/method.h"
23#include "ruby/internal/value.h"
24#include "ruby/internal/variable.h"
25#include "ruby/backward/2/stdarg.h"
26#include "ruby/st.h"
27
28extern "C++" {
29
30#ifdef HAVE_NULLPTR
31#include <cstddef>
32#endif
33
37 namespace ruby {
38
40 namespace backward {
41
54 namespace cxxanyargs {
55
56 typedef VALUE type(ANYARGS);
57 typedef void void_type(ANYARGS);
58 typedef int int_type(ANYARGS);
59 typedef VALUE onearg_type(VALUE);
60
63
64RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
72 inline void
73rb_define_virtual_variable(const char *q, type *w, void_type *e)
74{
75 rb_gvar_getter_t *r = reinterpret_cast<rb_gvar_getter_t*>(w);
76 rb_gvar_setter_t *t = reinterpret_cast<rb_gvar_setter_t*>(e);
77 ::rb_define_virtual_variable(q, r, t);
78}
79
80RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
81 inline void
82 rb_define_virtual_variable(const char *q, rb_gvar_getter_t *w, void_type *e)
83{
84 rb_gvar_setter_t *t = reinterpret_cast<rb_gvar_setter_t*>(e);
85 ::rb_define_virtual_variable(q, w, t);
86}
87
88RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
89 inline void
90 rb_define_virtual_variable(const char *q, type *w, rb_gvar_setter_t *e)
91{
92 rb_gvar_getter_t *r = reinterpret_cast<rb_gvar_getter_t*>(w);
93 ::rb_define_virtual_variable(q, r, e);
94}
95
96#ifdef HAVE_NULLPTR
97inline void
98 rb_define_virtual_variable(const char *q, rb_gvar_getter_t *w, std::nullptr_t e)
99{
100 ::rb_define_virtual_variable(q, w, e);
101}
102
103RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
104 inline void
105 rb_define_virtual_variable(const char *q, type *w, std::nullptr_t e)
106{
107 rb_gvar_getter_t *r = reinterpret_cast<rb_gvar_getter_t *>(w);
108 ::rb_define_virtual_variable(q, r, e);
109}
110
111inline void
112 rb_define_virtual_variable(const char *q, std::nullptr_t w, rb_gvar_setter_t *e)
113{
114 ::rb_define_virtual_variable(q, w, e);
115}
116
117RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
118 inline void
119 rb_define_virtual_variable(const char *q, std::nullptr_t w, void_type *e)
120{
121 rb_gvar_setter_t *r = reinterpret_cast<rb_gvar_setter_t *>(e);
122 ::rb_define_virtual_variable(q, w, r);
123}
124#endif
125
126RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
135 inline void
136rb_define_hooked_variable(const char *q, VALUE *w, type *e, void_type *r)
137{
138 rb_gvar_getter_t *t = reinterpret_cast<rb_gvar_getter_t*>(e);
139 rb_gvar_setter_t *y = reinterpret_cast<rb_gvar_setter_t*>(r);
140 ::rb_define_hooked_variable(q, w, t, y);
141}
142
143RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
144 inline void
145 rb_define_hooked_variable(const char *q, VALUE *w, rb_gvar_getter_t *e, void_type *r)
146{
147 rb_gvar_setter_t *y = reinterpret_cast<rb_gvar_setter_t*>(r);
148 ::rb_define_hooked_variable(q, w, e, y);
149}
150
151RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
152 inline void
153 rb_define_hooked_variable(const char *q, VALUE *w, type *e, rb_gvar_setter_t *r)
154{
155 rb_gvar_getter_t *t = reinterpret_cast<rb_gvar_getter_t*>(e);
156 ::rb_define_hooked_variable(q, w, t, r);
157}
158
159#ifdef HAVE_NULLPTR
160inline void
161 rb_define_hooked_variable(const char *q, VALUE *w, rb_gvar_getter_t *e, std::nullptr_t r)
162{
163 ::rb_define_hooked_variable(q, w, e, r);
164}
165
166RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
167 inline void
168 rb_define_hooked_variable(const char *q, VALUE *w, type *e, std::nullptr_t r)
169{
170 rb_gvar_getter_t *y = reinterpret_cast<rb_gvar_getter_t *>(e);
171 ::rb_define_hooked_variable(q, w, y, r);
172}
173
174inline void
175 rb_define_hooked_variable(const char *q, VALUE *w, std::nullptr_t e, rb_gvar_setter_t *r)
176{
177 ::rb_define_hooked_variable(q, w, e, r);
178}
179
180RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
181 inline void
182 rb_define_hooked_variable(const char *q, VALUE *w, std::nullptr_t e, void_type *r)
183{
184 rb_gvar_setter_t *y = reinterpret_cast<rb_gvar_setter_t *>(r);
185 ::rb_define_hooked_variable(q, w, e, y);
186}
187#endif
188
192
193// RUBY_CXX_DEPRECATED("by rb_block_call since 1.9")
194RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
204 inline VALUE
205rb_iterate(onearg_type *q, VALUE w, type *e, VALUE r)
206{
207 rb_block_call_func_t t = reinterpret_cast<rb_block_call_func_t>(e);
208 return backward::rb_iterate_deprecated(q, w, t, r);
209}
210
211#ifdef HAVE_NULLPTR
212RUBY_CXX_DEPRECATED("by rb_block_call since 1.9")
213 inline VALUE
214 rb_iterate(onearg_type *q, VALUE w, std::nullptr_t e, VALUE r)
215{
216 return backward::rb_iterate_deprecated(q, w, e, r);
217}
218#endif
219
220RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
231 inline VALUE
232rb_block_call(VALUE q, ID w, int e, const VALUE *r, type *t, VALUE y)
233{
234 rb_block_call_func_t u = reinterpret_cast<rb_block_call_func_t>(t);
235 return ::rb_block_call(q, w, e, r, u, y);
236}
237
238#ifdef HAVE_NULLPTR
239inline VALUE
240 rb_block_call(VALUE q, ID w, int e, const VALUE *r, std::nullptr_t t, VALUE y)
241{
242 return ::rb_block_call(q, w, e, r, t, y);
243}
244#endif
245
246RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
259 inline VALUE
260rb_rescue(type *q, VALUE w, type *e, VALUE r)
261{
262 typedef VALUE func1_t(VALUE);
263 typedef VALUE func2_t(VALUE, VALUE);
264 func1_t *t = reinterpret_cast<func1_t*>(q);
265 func2_t *y = reinterpret_cast<func2_t*>(e);
266 return ::rb_rescue(t, w, y, r);
267}
268
269RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
283 inline VALUE
284rb_rescue2(type *q, VALUE w, type *e, VALUE r, ...)
285{
286 typedef VALUE func1_t(VALUE);
287 typedef VALUE func2_t(VALUE, VALUE);
288 func1_t *t = reinterpret_cast<func1_t*>(q);
289 func2_t *y = reinterpret_cast<func2_t*>(e);
290 va_list ap;
291 va_start(ap, r);
292 VALUE ret = ::rb_vrescue2(t, w, y, r, ap);
293 va_end(ap);
294 return ret;
295}
296
297RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
309 inline VALUE
310rb_ensure(type *q, VALUE w, type *e, VALUE r)
311{
312 typedef VALUE func1_t(VALUE);
313 func1_t *t = reinterpret_cast<func1_t*>(q);
314 func1_t *y = reinterpret_cast<func1_t*>(e);
315 return ::rb_ensure(t, w, y, r);
316}
317
318RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
330 inline VALUE
331rb_catch(const char *q, type *w, VALUE e)
332{
333 rb_block_call_func_t r = reinterpret_cast<rb_block_call_func_t>(w);
334 return ::rb_catch(q, r, e);
335}
336
337#ifdef HAVE_NULLPTR
338inline VALUE
339 rb_catch(const char *q, std::nullptr_t w, VALUE e)
340{
341 return ::rb_catch(q, w, e);
342}
343#endif
344
345RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
357 inline VALUE
358rb_catch_obj(VALUE q, type *w, VALUE e)
359{
360 rb_block_call_func_t r = reinterpret_cast<rb_block_call_func_t>(w);
361 return ::rb_catch_obj(q, r, e);
362}
363
367
368RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
377 inline VALUE
378rb_fiber_new(type *q, VALUE w)
379{
380 rb_block_call_func_t e = reinterpret_cast<rb_block_call_func_t>(q);
381 return ::rb_fiber_new(e, w);
382}
383
384RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
393 inline VALUE
394rb_proc_new(type *q, VALUE w)
395{
396 rb_block_call_func_t e = reinterpret_cast<rb_block_call_func_t>(q);
397 return ::rb_proc_new(e, w);
398}
399
400RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
409 inline VALUE
410rb_thread_create(type *q, void *w)
411{
412 typedef VALUE ptr_t(void*);
413 ptr_t *e = reinterpret_cast<ptr_t*>(q);
414 return ::rb_thread_create(e, w);
415}
416
420
421RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
431 inline int
432st_foreach(st_table *q, int_type *w, st_data_t e)
433{
434 st_foreach_callback_func *r =
435 reinterpret_cast<st_foreach_callback_func*>(w);
436 return ::st_foreach(q, r, e);
437}
438
439RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
449 inline int
450st_foreach_check(st_table *q, int_type *w, st_data_t e, st_data_t)
451{
452 st_foreach_check_callback_func *t =
453 reinterpret_cast<st_foreach_check_callback_func*>(w);
454 return ::st_foreach_check(q, t, e, 0);
455}
456
457RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
465 inline void
466st_foreach_safe(st_table *q, int_type *w, st_data_t e)
467{
468 st_foreach_callback_func *r =
469 reinterpret_cast<st_foreach_callback_func*>(w);
470 ::st_foreach_safe(q, r, e);
471}
472
473RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
481 inline void
482rb_hash_foreach(VALUE q, int_type *w, VALUE e)
483{
484 st_foreach_callback_func *r =
485 reinterpret_cast<st_foreach_callback_func*>(w);
486 ::rb_hash_foreach(q, r, e);
487}
488
489RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
497 inline void
498rb_ivar_foreach(VALUE q, int_type *w, VALUE e)
499{
500 st_foreach_callback_func *r =
501 reinterpret_cast<st_foreach_callback_func*>(w);
502 ::rb_ivar_foreach(q, r, e);
503}
504
506
514 namespace define_method {
515
517 typedef VALUE notimpl_type(int, const VALUE *, VALUE, VALUE);
518
522template<typename T, void (*F)(VALUE klass, T mid, type *func, int arity)>
523 struct driver {
524
528 template<int N, typename U>
529 struct engine {
530
531 /* :TODO: Following deprecation attribute renders tons of warnings (one
532 * per every method definitions), which is annoying. Of course
533 * annoyance is the core feature of deprecation warnings... But that
534 * could be too much, especially when the warnings happen inside of
535 * machine-generated programs. And SWIG is known to do such thing.
536 * The new (granular) API was introduced in API version 2.7. As of
537 * this writing the version is 2.8. Let's warn this later, some time
538 * during 3.x. Hopefully codes in old (ANYARGS-ed) format should be
539 * less than now. */
540#if (RUBY_API_VERSION_MAJOR * 100 + RUBY_API_VERSION_MINOR) >= 301
541 RUBY_CXX_DEPRECATED("use of ANYARGS is deprecated")
542#endif
545 static inline void
546 define(VALUE klass, T mid, type func)
547 {
548 F(klass, mid, func, N);
549 }
550
555 static inline void
556 define(VALUE klass, T mid, U func)
557 {
558 F(klass, mid, reinterpret_cast<type *>(func), N);
559 }
560
562 static inline void
563 define(VALUE klass, T mid, notimpl_type func)
564 {
565 F(klass, mid, reinterpret_cast<type *>(func), N);
566 }
567 };
568
570 template<int N, bool = false> struct specific : public engine<N, type *> {};
571 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)> {};
572 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)> {};
573 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)> {};
574 template<bool b> struct specific<12, b> : public engine<12, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
575 template<bool b> struct specific<11, b> : public engine<11, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
576 template<bool b> struct specific<10, b> : public engine<10, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
577 template<bool b> struct specific< 9, b> : public engine< 9, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
578 template<bool b> struct specific< 8, b> : public engine< 8, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
579 template<bool b> struct specific< 7, b> : public engine< 7, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
580 template<bool b> struct specific< 6, b> : public engine< 6, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
581 template<bool b> struct specific< 5, b> : public engine< 5, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
582 template<bool b> struct specific< 4, b> : public engine< 4, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE)> {};
583 template<bool b> struct specific< 3, b> : public engine< 3, VALUE(*)(VALUE, VALUE, VALUE, VALUE)> {};
584 template<bool b> struct specific< 2, b> : public engine< 2, VALUE(*)(VALUE, VALUE, VALUE)> {};
585 template<bool b> struct specific< 1, b> : public engine< 1, VALUE(*)(VALUE, VALUE)> {};
586 template<bool b> struct specific< 0, b> : public engine< 0, VALUE(*)(VALUE)> {};
587 template<bool b> struct specific<-1, b> : public engine<-1, VALUE(*)(int argc, VALUE *argv, VALUE self)> {
588 using engine<-1, VALUE(*)(int argc, VALUE *argv, VALUE self)>::define;
589 static inline void define(VALUE c, T m, VALUE(*f)(int argc, const VALUE *argv, VALUE self)) { F(c, m, reinterpret_cast<type *>(f), -1); }
590 };
591 template<bool b> struct specific<-2, b> : public engine<-2, VALUE(*)(VALUE, VALUE)> {};
593};
594
595/* We could perhaps merge this struct into the one above using variadic
596 * template parameters if we could assume C++11, but sadly we cannot. */
598template<typename T, void (*F)(T mid, type func, int arity)>
599 struct driver0 {
600
604 template<int N, typename U>
605 struct engine {
606 RUBY_CXX_DEPRECATED("use of ANYARGS is deprecated")
609 static inline void
610 define(T mid, type func)
611 {
612 F(mid, func, N);
613 }
614
618 static inline void
619 define(T mid, U func)
620 {
621 F(mid, reinterpret_cast<type *>(func), N);
622 }
623
626 static inline void
627 define(T mid, notimpl_type func)
628 {
629 F(mid, reinterpret_cast<type *>(func), N);
630 }
631 };
632
634 template<int N, bool = false> struct specific : public engine<N, type *> {};
635 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)> {};
636 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)> {};
637 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)> {};
638 template<bool b> struct specific<12, b> : public engine<12, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
639 template<bool b> struct specific<11, b> : public engine<11, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
640 template<bool b> struct specific<10, b> : public engine<10, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
641 template<bool b> struct specific< 9, b> : public engine< 9, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
642 template<bool b> struct specific< 8, b> : public engine< 8, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
643 template<bool b> struct specific< 7, b> : public engine< 7, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
644 template<bool b> struct specific< 6, b> : public engine< 6, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
645 template<bool b> struct specific< 5, b> : public engine< 5, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)> {};
646 template<bool b> struct specific< 4, b> : public engine< 4, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE)> {};
647 template<bool b> struct specific< 3, b> : public engine< 3, VALUE(*)(VALUE, VALUE, VALUE, VALUE)> {};
648 template<bool b> struct specific< 2, b> : public engine< 2, VALUE(*)(VALUE, VALUE, VALUE)> {};
649 template<bool b> struct specific< 1, b> : public engine< 1, VALUE(*)(VALUE, VALUE)> {};
650 template<bool b> struct specific< 0, b> : public engine< 0, VALUE(*)(VALUE)> {};
651 template<bool b> struct specific<-1, b> : public engine<-1, VALUE(*)(int argc, VALUE *argv, VALUE self)> {
652 using engine<-1, VALUE(*)(int argc, VALUE *argv, VALUE self)>::define;
653 static inline void define(T m, VALUE(*f)(int argc, const VALUE *argv, VALUE self)) { F(m, reinterpret_cast<type *>(f), -1); }
654 };
655 template<bool b> struct specific<-2, b> : public engine<-2, VALUE(*)(VALUE, VALUE)> {};
657};
658
659 struct rb_define_method : public driver <const char *, ::rb_define_method> {};
660 struct rb_define_method_id : public driver <ID, ::rb_define_method_id> {};
661 struct rb_define_private_method : public driver <const char *, ::rb_define_private_method> {};
662 struct rb_define_protected_method : public driver <const char *, ::rb_define_protected_method> {};
663 struct rb_define_singleton_method : public driver <const char *, ::rb_define_singleton_method> {};
664 struct rb_define_module_function : public driver <const char *, ::rb_define_module_function> {};
665 struct rb_define_global_function : public driver0<const char *, ::rb_define_global_function> {};
666
670#define rb_define_method(klass, mid, func, arity) ::ruby::backward::cxxanyargs::define_method::rb_define_method::specific<arity>::define(klass, mid, func)
671
673#define rb_define_method_id(klass, mid, func, arity) ::ruby::backward::cxxanyargs::define_method::rb_define_method_id::specific<arity>::define(klass, mid, func)
674
677#define rb_define_private_method(klass, mid, func, arity) ::ruby::backward::cxxanyargs::define_method::rb_define_private_method::specific<arity>::define(klass, mid, func)
678
681#define rb_define_protected_method(klass, mid, func, arity) ::ruby::backward::cxxanyargs::define_method::rb_define_protected_method::specific<arity>::define(klass, mid, func)
682
685#define rb_define_singleton_method(klass, mid, func, arity) ::ruby::backward::cxxanyargs::define_method::rb_define_singleton_method::specific<arity>::define(klass, mid, func)
686
689#define rb_define_module_function(klass, mid, func, arity) ::ruby::backward::cxxanyargs::define_method::rb_define_module_function::specific<arity>::define(klass, mid, func)
690
695#define rb_define_global_function(mid, func, arity) ::ruby::backward::cxxanyargs::define_method::rb_define_global_function::specific<arity>::define(mid, func)
696
697}}}}}
698
699using namespace ruby::backward::cxxanyargs;
700#endif // RUBY_BACKWARD_CXXANYARGS_HPP
rb_vrescue2
VALUE rb_vrescue2(VALUE(*b_proc)(VALUE), VALUE data1, VALUE(*r_proc)(VALUE, VALUE), VALUE data2, va_list args)
Identical to rb_rescue2(), except it takes va_list instead of variadic number of arguments.
Definition eval.c:977
class.h
Public APIs related to rb_cClass/rb_cModule.
cont.h
Public APIs related to rb_cFiber.
hash.h
Public APIs related to rb_cHash.
st_foreach_safe
#define st_foreach_safe
Just another name of rb_st_foreach_safe.
Definition hash.h:51
proc.h
Public APIs related to rb_cProc.
thread.h
Public APIs related to rb_cThread.
variable.h
Public APIs related to names inside of a Ruby program.
vm.h
Public APIs related to rb_cRubyVM.
method.h
Creation and modification of Ruby methods.
variable.h
Declares rb_define_variable().
rb_gvar_setter_t
void rb_gvar_setter_t(VALUE val, ID id, VALUE *data)
Type that represents a global variable setter function.
Definition variable.h:46
rb_gvar_getter_t
VALUE rb_gvar_getter_t(ID id, VALUE *data)
Type that represents a global variable getter function.
Definition variable.h:37
iterator.h
Block related APIs.
rb_block_call_func_t
rb_block_call_func * rb_block_call_func_t
Shorthand type that represents an iterator-written-in-C function pointer.
Definition iterator.h:88
ruby::backward::cxxanyargs::define_method
Driver for *_define_method.
Definition cxxanyargs.hpp:514
ruby::backward::cxxanyargs::define_method::notimpl_type
VALUE notimpl_type(int, const VALUE *, VALUE, VALUE)
Type of rb_f_notimplement().
Definition cxxanyargs.hpp:517
ruby::backward::cxxanyargs
Provides ANYARGS deprecation warnings.
Definition cxxanyargs.hpp:54
ruby::backward::cxxanyargs::onearg_type
VALUE onearg_type(VALUE)
Single-argumented function type.
Definition cxxanyargs.hpp:59
ruby::backward::cxxanyargs::rb_catch_obj
VALUE rb_catch_obj(VALUE q, type *w, VALUE e)
An equivalent of Kernel#catch.
Definition cxxanyargs.hpp:358
ruby::backward::cxxanyargs::rb_catch
VALUE rb_catch(const char *q, type *w, VALUE e)
An equivalent of Kernel#catch.
Definition cxxanyargs.hpp:331
ruby::backward::cxxanyargs::rb_define_hooked_variable
void rb_define_hooked_variable(const char *q, VALUE *w, type *e, void_type *r)
Define a function-backended global variable.
Definition cxxanyargs.hpp:136
ruby::backward::cxxanyargs::rb_thread_create
VALUE rb_thread_create(type *q, void *w)
Creates a rb_cThread instance.
Definition cxxanyargs.hpp:410
ruby::backward::cxxanyargs::int_type
int int_type(ANYARGS)
ANYARGS-ed function type, int variant.
Definition cxxanyargs.hpp:58
ruby::backward::cxxanyargs::void_type
void void_type(ANYARGS)
ANYARGS-ed function type, void variant.
Definition cxxanyargs.hpp:57
ruby::backward::cxxanyargs::rb_block_call
VALUE rb_block_call(VALUE q, ID w, int e, const VALUE *r, type *t, VALUE y)
Call a method with a block.
Definition cxxanyargs.hpp:232
ruby::backward::cxxanyargs::rb_proc_new
VALUE rb_proc_new(type *q, VALUE w)
Creates a rb_cProc instance.
Definition cxxanyargs.hpp:394
ruby::backward::cxxanyargs::rb_iterate
VALUE rb_iterate(onearg_type *q, VALUE w, type *e, VALUE r)
Old way to implement iterators.
Definition cxxanyargs.hpp:205
ruby::backward::cxxanyargs::type
VALUE type(ANYARGS)
ANYARGS-ed function type.
Definition cxxanyargs.hpp:56
ruby::backward::cxxanyargs::rb_fiber_new
VALUE rb_fiber_new(type *q, VALUE w)
Creates a rb_cFiber instance.
Definition cxxanyargs.hpp:378
ruby::backward::cxxanyargs::st_foreach_safe
void st_foreach_safe(st_table *q, int_type *w, st_data_t e)
Iteration over the given table.
Definition cxxanyargs.hpp:466
ruby::backward::cxxanyargs::st_foreach
int st_foreach(st_table *q, int_type *w, st_data_t e)
Iteration over the given table.
Definition cxxanyargs.hpp:432
ruby::backward::cxxanyargs::rb_hash_foreach
void rb_hash_foreach(VALUE q, int_type *w, VALUE e)
Iteration over the given hash.
Definition cxxanyargs.hpp:482
ruby::backward::cxxanyargs::rb_define_virtual_variable
void rb_define_virtual_variable(const char *q, type *w, void_type *e)
Define a function-backended global variable.
Definition cxxanyargs.hpp:73
ruby::backward::cxxanyargs::rb_ivar_foreach
void rb_ivar_foreach(VALUE q, int_type *w, VALUE e)
Iteration over each instance variable of the object.
Definition cxxanyargs.hpp:498
ruby::backward::cxxanyargs::rb_rescue2
VALUE rb_rescue2(type *q, VALUE w, type *e, VALUE r,...)
An equivalent of rescue clause.
Definition cxxanyargs.hpp:284
ruby::backward::cxxanyargs::rb_rescue
VALUE rb_rescue(type *q, VALUE w, type *e, VALUE r)
An equivalent of rescue clause.
Definition cxxanyargs.hpp:260
ruby::backward::cxxanyargs::rb_ensure
VALUE rb_ensure(type *q, VALUE w, type *e, VALUE r)
An equivalent of ensure clause.
Definition cxxanyargs.hpp:310
ruby::backward::cxxanyargs::st_foreach_check
int st_foreach_check(st_table *q, int_type *w, st_data_t e, st_data_t)
Iteration over the given table.
Definition cxxanyargs.hpp:450
ruby::backward
Backwards compatibility layer.
Definition cxxanyargs.hpp:40
ruby::backward::rb_iterate_deprecated
static VALUE rb_iterate_deprecated(VALUE(*iter)(VALUE), VALUE data1, rb_block_call_func_t bl, VALUE data2)
Old way to iterate a block.
Definition iterator.h:301
ruby
The main namespace.
Definition cxxanyargs.hpp:37
inline
#define inline
Old Visual Studio versions do not support the inline keyword, so we need to define it to be __inline.
Definition defines.h:91
stdarg.h
Defines old _.
ANYARGS
#define ANYARGS
Functions declared using this macro take arbitrary arguments, including void.
Definition stdarg.h:64
ruby::backward::cxxanyargs::define_method::driver0::engine
Defines a method.
Definition cxxanyargs.hpp:605
ruby::backward::cxxanyargs::define_method::driver0::engine::define
static void define(T mid, type func)
Defines Kernel::mid as func, whose arity is N.
Definition cxxanyargs.hpp:610
ruby::backward::cxxanyargs::define_method::driver0::engine::define
static void define(T mid, notimpl_type func)
Defines Kernel::mid as func, whose arity is N.
Definition cxxanyargs.hpp:627
ruby::backward::cxxanyargs::define_method::driver0::engine::define
static void define(T mid, U func)
Defines Kernel::mid as func, whose arity is N.
Definition cxxanyargs.hpp:619
ruby::backward::cxxanyargs::define_method::driver0
Template metaprogramming to generate function prototypes.
Definition cxxanyargs.hpp:599
ruby::backward::cxxanyargs::define_method::driver::engine
Defines a method.
Definition cxxanyargs.hpp:529
ruby::backward::cxxanyargs::define_method::driver::engine::define
static void define(VALUE klass, T mid, type func)
Defines klass::mid as func, whose arity is N.
Definition cxxanyargs.hpp:546
ruby::backward::cxxanyargs::define_method::driver::engine::define
static void define(VALUE klass, T mid, U func)
Defines klass::mid as func, whose arity is N.
Definition cxxanyargs.hpp:556
ruby::backward::cxxanyargs::define_method::driver::engine::define
static void define(VALUE klass, T mid, notimpl_type func)
Defines klass::mid as func, whose arity is N.
Definition cxxanyargs.hpp:563
ruby::backward::cxxanyargs::define_method::driver
Template metaprogramming to generate function prototypes.
Definition cxxanyargs.hpp:523
ruby::backward::cxxanyargs::define_method::rb_define_global_function
Dispatches appropriate driver for rb_define_global_function.
Definition cxxanyargs.hpp:665
ruby::backward::cxxanyargs::define_method::rb_define_method_id
Dispatches appropriate driver for rb_define_method_id.
Definition cxxanyargs.hpp:660
ruby::backward::cxxanyargs::define_method::rb_define_method
Dispatches appropriate driver for rb_define_method.
Definition cxxanyargs.hpp:659
ruby::backward::cxxanyargs::define_method::rb_define_module_function
Dispatches appropriate driver for rb_define_module_function.
Definition cxxanyargs.hpp:664
ruby::backward::cxxanyargs::define_method::rb_define_private_method
Dispatches appropriate driver for rb_define_private_method.
Definition cxxanyargs.hpp:661
ruby::backward::cxxanyargs::define_method::rb_define_protected_method
Dispatches appropriate driver for rb_define_protected_method.
Definition cxxanyargs.hpp:662
ruby::backward::cxxanyargs::define_method::rb_define_singleton_method
Dispatches appropriate driver for rb_define_singleton_method.
Definition cxxanyargs.hpp:663
st_table
Definition st.h:79
U
Definition dtoa.c:305
value.h
Defines VALUE and ID.
ID
uintptr_t ID
Type that represents a Ruby identifier such as a variable name.
Definition value.h:52
VALUE
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40