1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Overload variable definition functions

Define overloading functions of rb_define_virtual_variable and
rb_define_hooked_variable, for combinations with and without
ANYARGS casts.
This commit is contained in:
Nobuyoshi Nakada 2019-09-18 22:52:41 +09:00
parent 9c0d5e51cb
commit 17a1366399
Notes: git 2019-09-20 01:30:10 +09:00

View file

@ -63,6 +63,36 @@ rb_define_virtual_variable(const char *q, type *w, void_type *e)
::rb_define_virtual_variable(q, r, t);
}
RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprected")
/// @brief Define a function-backended global variable.
/// @param[in] q Name of the variable.
/// @param[in] w Getter function.
/// @param[in] e Setter function.
/// @note Both functions can be nullptr.
/// @see rb_define_hooked_variable()
/// @deprecated Use glanular typed overload instead.
inline void
rb_define_virtual_variable(const char *q, rb_gvar_getter_t *w, void_type *e)
{
rb_gvar_setter_t *t = reinterpret_cast<rb_gvar_setter_t*>(e);
::rb_define_virtual_variable(q, w, t);
}
RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprected")
/// @brief Define a function-backended global variable.
/// @param[in] q Name of the variable.
/// @param[in] w Getter function.
/// @param[in] e Setter function.
/// @note Both functions can be nullptr.
/// @see rb_define_hooked_variable()
/// @deprecated Use glanular typed overload instead.
inline void
rb_define_virtual_variable(const char *q, type *w, rb_gvar_setter_t *e)
{
rb_gvar_getter_t *r = reinterpret_cast<rb_gvar_getter_t*>(w);
::rb_define_virtual_variable(q, r, e);
}
RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprected")
/// @brief Define a function-backended global variable.
/// @param[in] q Name of the variable.
@ -80,6 +110,38 @@ rb_define_hooked_variable(const char *q, VALUE *w, type *e, void_type *r)
::rb_define_hooked_variable(q, w, t, y);
}
RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprected")
/// @brief Define a function-backended global variable.
/// @param[in] q Name of the variable.
/// @param[in] w Variable storage.
/// @param[in] e Getter function.
/// @param[in] r Setter function.
/// @note Both functions can be nullptr.
/// @see rb_define_virtual_variable()
/// @deprecated Use glanular typed overload instead.
inline void
rb_define_hooked_variable(const char *q, VALUE *w, rb_gvar_getter_t *e, void_type *r)
{
rb_gvar_setter_t *y = reinterpret_cast<rb_gvar_setter_t*>(r);
::rb_define_hooked_variable(q, w, e, y);
}
RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprected")
/// @brief Define a function-backended global variable.
/// @param[in] q Name of the variable.
/// @param[in] w Variable storage.
/// @param[in] e Getter function.
/// @param[in] r Setter function.
/// @note Both functions can be nullptr.
/// @see rb_define_virtual_variable()
/// @deprecated Use glanular typed overload instead.
inline void
rb_define_hooked_variable(const char *q, VALUE *w, type *e, rb_gvar_setter_t *r)
{
rb_gvar_getter_t *t = reinterpret_cast<rb_gvar_getter_t*>(e);
::rb_define_hooked_variable(q, w, t, r);
}
/// @}
/// @name Exceptions and tag jumps
/// @{