Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

Typedefs
ruby::backward::cxxanyargs Namespace Reference

Provides ANYARGS deprecation warnings. More...

## Typedefs
typedef VALUE | type(ANYARGS)
| ANYARGS-ed function type. More...
typedef void | void_type(ANYARGS)
| ANYARGS-ed function type, void variant. More...
typedef int | int_type(ANYARGS)
| ANYARGS-ed function type, int variant. More...

## Detailed Description

Provides ANYARGS deprecation warnings.

In C, ANYARGS means there is no function prototype. Literally anything, even including nothing, can be a valid ANYARGS. So passing a correctly prototyped function pointer to an ANYARGS-ed function parameter is valid, at the same time passing an ANYARGS-ed function pointer to a granular typed function parameter is also valid. However on the other hand in C++, ANYARGS doesn't actually mean any number of arguments. C++'s ANYARGS means variadic number of arguments. This is incompatible with ordinal, correct function prototypes.

Luckily, function prototypes being distinct each other means they can be overloaded. We can provide a compatibility layer for older Ruby APIs which used to have ANYARGS. This namespace includes such attempts.

## Typedef Documentation

## ◆ int_type

typedef int ruby::backward::cxxanyargs::int_type(ANYARGS)

ANYARGS-ed function type, int variant.

Definition at line 45 of file cxxanyargs.hpp.

## ◆ type

typedef VALUE ruby::backward::cxxanyargs::type(ANYARGS)

ANYARGS-ed function type.

Definition at line 39 of file cxxanyargs.hpp.

## ◆ void_type

typedef void ruby::backward::cxxanyargs::void_type(ANYARGS)

ANYARGS-ed function type, void variant.

Definition at line 42 of file cxxanyargs.hpp.

## Function Documentation

## ◆ rb_block_call()

VALUE ruby::backward::cxxanyargs::rb_block_call | ( | VALUE | q,
|  | ID | w,
|  | int | e,
|  | const VALUE * | r,
|  | type * | t,
|  | VALUE | y
| ) |  |
| inline

Call a method with a block.

Parameters

  [in] | q | The self.
  [in] | w | The method.
  [in] | e | The # of elems of `r`
  [in] | r | The arguments.
  [in] | t | What is to be yielded.
  [in] | y | Passed to `t`

Returns
  Return value of `q#w(*r,&t)`

Note
  't' can be nullptr.

Deprecated:
  Use glanular typed overload instead.

Definition at line 178 of file cxxanyargs.hpp.

## ◆ rb_catch()

VALUE ruby::backward::cxxanyargs::rb_catch | ( | const char * | q,
|  | type * | w,
|  | VALUE | e
| ) |  |
| inline

An equivalent of `Kernel#catch`.

Parameters

  [in] | q | The "tag" string.
  [in] | w | A function that can throw.
  [in] | e | Passed to `w`.

Returns
  What was thrown.

Note
  `q` can be a nullptr but makes no sense to pass nullptr to`w`.

See also
  rb_block_call()
  rb_protect()
  rb_rb_catch_obj()
  rb_rescue()

Deprecated:
  Use glanular typed overload instead.

Definition at line 269 of file cxxanyargs.hpp.

## ◆ rb_catch_obj()

VALUE ruby::backward::cxxanyargs::rb_catch_obj | ( | VALUE | q,
|  | type * | w,
|  | VALUE | e
| ) |  |
| inline

An equivalent of `Kernel#catch`.

Parameters

  [in] | q | The "tag" object.
  [in] | w | A function that can throw.
  [in] | e | Passed to `w`.

Returns
  What was thrown.

Note
  It makes no sense to pass nullptr to`w`.

See also
  rb_block_call()
  rb_protect()
  rb_rb_catch_obj()
  rb_rescue()

Deprecated:
  Use glanular typed overload instead.

Definition at line 288 of file cxxanyargs.hpp.

## ◆ rb_ensure()

VALUE ruby::backward::cxxanyargs::rb_ensure | ( | type * | q,
|  | VALUE | w,
|  | type * | e,
|  | VALUE | r
| ) |  |
| inline

An equivalent of `ensure` clause.

Parameters

  [in] | q | A function that can raise.
  [in] | w | Passed to `q`.
  [in] | e | A function that ensures.
  [in] | r | Passed to `e`.

Returns
  The return value of `q`.

Note
  It makes no sense to pass nullptr to `e`.

See also
  rb_rescue()
  rb_rescue2()
  rb_protect()

Deprecated:
  Use glanular typed overload instead.

Definition at line 248 of file cxxanyargs.hpp.

## ◆ rb_fiber_new()

VALUE ruby::backward::cxxanyargs::rb_fiber_new | ( | type * | q,
|  | VALUE | w
| ) |  |
| inline

Creates a rb_cFiber instance.

Parameters

  [in] | q | The fiber body.
  [in] | w | Passed to `q`.

Returns
  What was allocated.

Note
  It makes no sense to pass nullptr to`q`.

See also
  rb_proc_new()
  rb_thread_creatr()

Deprecated:
  Use glanular typed overload instead.

Definition at line 308 of file cxxanyargs.hpp.

## ◆ rb_hash_foreach()

void ruby::backward::cxxanyargs::rb_hash_foreach | ( | VALUE | q,
|  | int_type * | w,
|  | VALUE | e
| ) |  |
| inline

Iteration over the given hash.

Parameters

  [in] | q | A hash to scan.
  [in] | w | A function to iterate.
  [in] | e | Passed to `w`.

Note
  It makes no sense to pass nullptr to`w`.

See also
  st_foreach()

Deprecated:
  Use glanular typed overload instead.

Definition at line 412 of file cxxanyargs.hpp.

## ◆ rb_iterate()

VALUE ruby::backward::cxxanyargs::rb_iterate | ( | VALUE(*)(VALUE) | q,
|  | VALUE | w,
|  | type * | e,
|  | VALUE | r
| ) |  |
| inline

Old way to implement iterators.

Parameters

  [in] | q | A function that can yield.
  [in] | w | Passed to `q`.
  [in] | e | What is to be yielded.
  [in] | r | Passed to `e`.

Returns
  The return value of `q`.

Note
  `e` can be nullptr.

Deprecated:
  This function is obsolated since long before 2.x era. Do not use it any longer. rb_block_call() is provided instead.

Definition at line 160 of file cxxanyargs.hpp.

Referenced by rb_proc_new().

## ◆ rb_ivar_foreach()

void ruby::backward::cxxanyargs::rb_ivar_foreach | ( | VALUE | q,
|  | int_type * | w,
|  | VALUE | e
| ) |  |
| inline

Iteration over each instance variable of the object.

Parameters

  [in] | q | An object.
  [in] | w | A function to iterate.
  [in] | e | Passed to `w`.

Note
  It makes no sense to pass nullptr to`w`.

See also
  st_foreach()

Deprecated:
  Use glanular typed overload instead.

Definition at line 428 of file cxxanyargs.hpp.

## ◆ rb_proc_new()

VALUE ruby::backward::cxxanyargs::rb_proc_new | ( | type * | q,
|  | VALUE | w
| ) |  |
| inline

Creates a rb_cProc instance.

Parameters

  [in] | q | The proc body.
  [in] | w | Passed to `q`.

Returns
  What was allocated.

Note
  It makes no sense to pass nullptr to`q`.

See also
  rb_fiber_new()
  rb_thread_creatr()

Deprecated:
  Use glanular typed overload instead.

Definition at line 324 of file cxxanyargs.hpp.

## ◆ rb_rescue()

VALUE ruby::backward::cxxanyargs::rb_rescue | ( | type * | q,
|  | VALUE | w,
|  | type * | e,
|  | VALUE | r
| ) |  |
| inline

An equivalent of `rescue` clause.

Parameters

  [in] | q | A function that can raise.
  [in] | w | Passed to `q`.
  [in] | e | A function that cleans-up.
  [in] | r | Passed to `e`.

Returns
  The return value of `q` if no exception occurs, or the return value of `e` if otherwise.

Note
  `e` can be nullptr.

See also
  rb_ensure()
  rb_rescue2()
  rb_protect()

Deprecated:
  Use glanular typed overload instead.

Definition at line 198 of file cxxanyargs.hpp.

## ◆ rb_rescue2()

VALUE ruby::backward::cxxanyargs::rb_rescue2 | ( | type * | q,
|  | VALUE | w,
|  | type * | e,
|  | VALUE | r,
|  |  | ...
| ) |  |
| inline

An equivalent of `rescue` clause.

Parameters

  [in] | q | A function that can raise.
  [in] | w | Passed to `q`.
  [in] | e | A function that cleans-up.
  [in] | r | Passed to `e`.
  [in] | ... | 0-terminated list of subclass of rb_eException.

Returns
  The return value of `q` if no exception occurs, or the return value of `e` if otherwise.

Note
  `e` can be nullptr.

See also
  rb_ensure()
  rb_rescue()
  rb_protect()

Deprecated:
  Use glanular typed overload instead.

Definition at line 222 of file cxxanyargs.hpp.

References rb_vrescue2(), va_end, and va_start.

## ◆ rb_thread_create()

VALUE ruby::backward::cxxanyargs::rb_thread_create | ( | type * | q,
|  | void * | w
| ) |  |
| inline

Creates a rb_cThread instance.

Parameters

  [in] | q | The thread body.
  [in] | w | Passed to `q`.

Returns
  What was allocated.

Note
  It makes no sense to pass nullptr to`q`.

See also
  rb_proc_new()
  rb_fiber_new()

Deprecated:
  Use glanular typed overload instead.

Definition at line 340 of file cxxanyargs.hpp.

Referenced by rb_detach_process().

## ◆ st_foreach()

int ruby::backward::cxxanyargs::st_foreach | ( | st_table * | q,
|  | int_type * | w,
|  | st_data_t | e
| ) |  |
| inline

Iteration over the given table.

Parameters

  [in] | q | A table to scan.
  [in] | w | A function to iterate.
  [in] | e | Passed to `w`.

Return values

  0 | Always returns 0.

Note
  It makes no sense to pass nullptr to`w`.

See also
  st_foreach_check()
  rb_hash_foreach()

Deprecated:
  Use glanular typed overload instead.

Definition at line 362 of file cxxanyargs.hpp.

References st_foreach().

## ◆ st_foreach_check()

int ruby::backward::cxxanyargs::st_foreach_check | ( | st_table * | q,
|  | int_type * | w,
|  | st_data_t | e,
|  | st_data_t |
| ) |  |
| inline

Iteration over the given table.

Parameters

  [in] | q | A table to scan.
  [in] | w | A function to iterate.
  [in] | e | Passed to `w`.

Return values

  0 | Successful end of iteration.
  1 | Element removed during traversing.

Note
  It makes no sense to pass nullptr to`w`.

See also
  st_foreach()

Deprecated:
  Use glanular typed overload instead.

Definition at line 380 of file cxxanyargs.hpp.

References st_foreach_check().

## ◆ st_foreach_safe()

void ruby::backward::cxxanyargs::st_foreach_safe | ( | st_table * | q,
|  | int_type * | w,
|  | st_data_t | e
| ) |  |
| inline

Iteration over the given table.

Parameters

  [in] | q | A table to scan.
  [in] | w | A function to iterate.
  [in] | e | Passed to `w`.

Note
  It makes no sense to pass nullptr to`w`.

See also
  st_foreach_check()

Deprecated:
  Use glanular typed overload instead.

Definition at line 396 of file cxxanyargs.hpp.