Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

cxxanyargs.hpp
Go to the documentation of this file.
1 #ifndef RUBY_BACKWARD_CXXANYARGS_HPP // -*- C++ -*-
2 #define RUBY_BACKWARD_CXXANYARGS_HPP
3
17 namespace ruby {
18
20 namespace backward {
21
36 namespace cxxanyargs {
37
39 typedef VALUE type(ANYARGS);
40
42 typedef void void_type(ANYARGS);
43
45 typedef int int_type(ANYARGS);
46
49
50 RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
58 inline void
59 rb_define_virtual_variable(const char *q, type *w, void_type *e)
60 {
61 rb_gvar_getter_t *r = reinterpret_cast<rb_gvar_getter_t*>(w);
62 rb_gvar_setter_t *t = reinterpret_cast<rb_gvar_setter_t*>(e);
63 ::rb_define_virtual_variable(q, r, t);
64 }
65
66 RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
74 inline void
75 rb_define_virtual_variable(const char *q, rb_gvar_getter_t *w, void_type *e)
76 {
77 rb_gvar_setter_t *t = reinterpret_cast<rb_gvar_setter_t*>(e);
78 ::rb_define_virtual_variable(q, w, t);
79 }
80
81 RUBY_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 RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
105 inline void
106 rb_define_hooked_variable(const char *q, VALUE *w, type *e, void_type *r)
107 {
108 rb_gvar_getter_t *t = reinterpret_cast<rb_gvar_getter_t*>(e);
109 rb_gvar_setter_t *y = reinterpret_cast<rb_gvar_setter_t*>(r);
110 ::rb_define_hooked_variable(q, w, t, y);
111 }
112
113 RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
122 inline void
123 rb_define_hooked_variable(const char *q, VALUE *w, rb_gvar_getter_t *e, void_type *r)
124 {
125 rb_gvar_setter_t *y = reinterpret_cast<rb_gvar_setter_t*>(r);
126 ::rb_define_hooked_variable(q, w, e, y);
127 }
128
129 RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
138 inline void
139 rb_define_hooked_variable(const char *q, VALUE *w, type *e, rb_gvar_setter_t *r)
140 {
141 rb_gvar_getter_t *t = reinterpret_cast<rb_gvar_getter_t*>(e);
142 ::rb_define_hooked_variable(q, w, t, r);
143 }
144
148
149 RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
159 inline VALUE
160 rb_iterate(VALUE(*q)(VALUE), VALUE w, type *e, VALUE r)
161 {
162 rb_block_call_func_t t = reinterpret_cast<rb_block_call_func_t>(e);
163 return ::rb_iterate(q, w, t, r);
164 }
165
166 RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
177 inline VALUE
178 rb_block_call(VALUE q, ID w, int e, const VALUE *r, type *t, VALUE y)
179 {
180 rb_block_call_func_t u = reinterpret_cast<rb_block_call_func_t>(t);
181 return ::rb_block_call(q, w, e, r, u, y);
182 }
183
184 RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
197 inline VALUE
198 rb_rescue(type *q, VALUE w, type *e, VALUE r)
199 {
200 typedef VALUE func1_t(VALUE);
201 typedef VALUE func2_t(VALUE, VALUE);
202 func1_t *t = reinterpret_cast<func1_t*>(q);
203 func2_t *y = reinterpret_cast<func2_t*>(e);
204 return ::rb_rescue(t, w, y, r);
205 }
206
207 RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
221 inline VALUE
222 rb_rescue2(type *q, VALUE w, type *e, VALUE r, ...)
223 {
224 typedef VALUE func1_t(VALUE);
225 typedef VALUE func2_t(VALUE, VALUE);
226 func1_t *t = reinterpret_cast<func1_t*>(q);
227 func2_t *y = reinterpret_cast<func2_t*>(e);
228 va_list ap;
229 va_start(ap, r);
230 VALUE ret = ::rb_vrescue2(t, w, y, r, ap);
231 va_end(ap);
232 return ret;
233 }
234
235 RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
247 inline VALUE
248 rb_ensure(type *q, VALUE w, type *e, VALUE r)
249 {
250 typedef VALUE func1_t(VALUE);
251 func1_t *t = reinterpret_cast<func1_t*>(q);
252 func1_t *y = reinterpret_cast<func1_t*>(e);
253 return ::rb_ensure(t, w, y, r);
254 }
255
256 RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
268 inline VALUE
269 rb_catch(const char *q, type *w, VALUE e)
270 {
271 rb_block_call_func_t r = reinterpret_cast<rb_block_call_func_t>(w);
272 return ::rb_catch(q, r, e);
273 }
274
275 RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
287 inline VALUE
288 rb_catch_obj(VALUE q, type *w, VALUE e)
289 {
290 rb_block_call_func_t r = reinterpret_cast<rb_block_call_func_t>(w);
291 return ::rb_catch_obj(q, r, e);
292 }
293
297
298 RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
307 inline VALUE
308 rb_fiber_new(type *q, VALUE w)
309 {
310 rb_block_call_func_t e = reinterpret_cast<rb_block_call_func_t>(q);
311 return ::rb_fiber_new(e, w);
312 }
313
314 RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
323 inline VALUE
324 rb_proc_new(type *q, VALUE w)
325 {
326 rb_block_call_func_t e = reinterpret_cast<rb_block_call_func_t>(q);
327 return ::rb_proc_new(e, w);
328 }
329
330 RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
339 inline VALUE
340 rb_thread_create(type *q, void *w)
341 {
342 typedef VALUE ptr_t(void*);
343 ptr_t *e = reinterpret_cast<ptr_t*>(q);
344 return ::rb_thread_create(e, w);
345 }
346
350
351 RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
361 inline int
362 st_foreach(st_table *q, int_type *w, st_data_t e)
363 {
364 st_foreach_callback_func *r =
365 reinterpret_cast<st_foreach_callback_func*>(w);
366 return ::st_foreach(q, r, e);
367 }
368
369 RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
379 inline int
380 st_foreach_check(st_table *q, int_type *w, st_data_t e, st_data_t)
381 {
382 st_foreach_check_callback_func *t =
383 reinterpret_cast<st_foreach_check_callback_func*>(w);
384 return ::st_foreach_check(q, t, e, 0);
385 }
386
387 RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
395 inline void
396 st_foreach_safe(st_table *q, int_type *w, st_data_t e)
397 {
398 st_foreach_callback_func *r =
399 reinterpret_cast<st_foreach_callback_func*>(w);
400 ::st_foreach_safe(q, r, e);
401 }
402
403 RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
411 inline void
412 rb_hash_foreach(VALUE q, int_type *w, VALUE e)
413 {
414 st_foreach_callback_func *r =
415 reinterpret_cast<st_foreach_callback_func*>(w);
416 ::rb_hash_foreach(q, r, e);
417 }
418
419 RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated")
427 inline void
428 rb_ivar_foreach(VALUE q, int_type *w, VALUE e)
429 {
430 st_foreach_callback_func *r =
431 reinterpret_cast<st_foreach_callback_func*>(w);
432 ::rb_ivar_foreach(q, r, e);
433 }
434
436 }}}
437
438 using namespace ruby::backward::cxxanyargs;
439 #endif // RUBY_BACKWARD_CXXANYARGS_HPP
ID
unsigned long ID
Definition: ruby.h:103
ruby::backward::cxxanyargs::rb_proc_new
VALUE rb_proc_new(type *q, VALUE w)
Creates a rb_cProc instance.
Definition: cxxanyargs.hpp:324
ruby::backward::cxxanyargs::int_type
int int_type(ANYARGS)
ANYARGS-ed function type, int variant.
Definition: cxxanyargs.hpp:45
VALUE
unsigned long VALUE
Definition: ruby.h:102
st_foreach_check
int st_foreach_check(st_table *tab, st_foreach_check_callback_func *func, st_data_t arg, st_data_t never ATTRIBUTE_UNUSED)
Definition: st.c:1726
ruby::backward::cxxanyargs::rb_fiber_new
VALUE rb_fiber_new(type *q, VALUE w)
Creates a rb_cFiber instance.
Definition: cxxanyargs.hpp:308
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:396
ruby::backward::cxxanyargs::rb_rescue
VALUE rb_rescue(type *q, VALUE w, type *e, VALUE r)
An equivalent of rescue clause.
Definition: cxxanyargs.hpp:198
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:362
rb_gvar_getter_t
VALUE rb_gvar_getter_t(ID id, VALUE *data)
Definition: ruby.h:1782
rb_gvar_setter_t
void rb_gvar_setter_t(VALUE val, ID id, VALUE *data)
Definition: ruby.h:1783
ruby::backward::cxxanyargs::rb_thread_create
VALUE rb_thread_create(type *q, void *w)
Creates a rb_cThread instance.
Definition: cxxanyargs.hpp:340
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:428
ruby::backward::cxxanyargs::rb_catch_obj
VALUE rb_catch_obj(VALUE q, type *w, VALUE e)
An equivalent of Kernel#catch.
Definition: cxxanyargs.hpp:288
const
#define const
Definition: strftime.c:103
st_foreach_check_callback_func
int st_foreach_check_callback_func(st_data_t, st_data_t, st_data_t, int)
Definition: st.h:138
ruby
The main namespace.
Definition: cxxanyargs.hpp:17
ruby::backward::cxxanyargs
Provides ANYARGS deprecation warnings.
Definition: cxxanyargs.hpp:36
st_foreach_callback_func
int st_foreach_callback_func(st_data_t, st_data_t, st_data_t)
Definition: st.h:137
ruby::backward::cxxanyargs::rb_catch
VALUE rb_catch(const char *q, type *w, VALUE e)
An equivalent of Kernel#catch.
Definition: cxxanyargs.hpp:269
ruby::backward::cxxanyargs::rb_rescue2
VALUE rb_rescue2(type *q, VALUE w, type *e, VALUE r,...)
An equivalent of rescue clause.
Definition: cxxanyargs.hpp:222
va_end
#define va_end(v)
Definition: rb_mjit_min_header-2.7.0.h:3979
rb_vrescue2
VALUE rb_vrescue2(VALUE(*b_proc)(VALUE), VALUE data1, VALUE(*r_proc)(VALUE, VALUE), VALUE data2, va_list args)
An equivalent of rescue clause.
Definition: eval.c:976
st_foreach
int st_foreach(st_table *tab, st_foreach_callback_func *func, st_data_t arg)
Definition: st.c:1718
rb_block_call_func_t
rb_block_call_func * rb_block_call_func_t
Definition: ruby.h:1967
ANYARGS
#define ANYARGS
Definition: defines.h:201
st_data_t
unsigned long st_data_t
Definition: rb_mjit_min_header-2.7.0.h:5363
RUBY_CXX_DEPRECATED
#define RUBY_CXX_DEPRECATED(mesg)
Definition: defines.h:42
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:178
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:380
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:412
ruby::backward::cxxanyargs::rb_iterate
VALUE rb_iterate(VALUE(*q)(VALUE), VALUE w, type *e, VALUE r)
Old way to implement iterators.
Definition: cxxanyargs.hpp:160
ruby::backward::cxxanyargs::void_type
void void_type(ANYARGS)
ANYARGS-ed function type, void variant.
Definition: cxxanyargs.hpp:42
va_start
#define va_start(v, l)
Definition: rb_mjit_min_header-2.7.0.h:3978
va_list
__gnuc_va_list va_list
Definition: rb_mjit_min_header-2.7.0.h:836
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:106
ruby::backward::cxxanyargs::rb_ensure
VALUE rb_ensure(type *q, VALUE w, type *e, VALUE r)
An equivalent of ensure clause.
Definition: cxxanyargs.hpp:248
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:59
st_table
Definition: st.h:79
ruby::backward::cxxanyargs::type
VALUE type(ANYARGS)
ANYARGS-ed function type.
Definition: cxxanyargs.hpp:39