Ruby: include/ruby/internal/intern/proc.h File Reference

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

Functions
proc.h File Reference

Public APIs related to rb_cProc. More...

`#include "ruby/internal/dllexport.h"`
`#include "ruby/internal/iterator.h"`
`#include "ruby/internal/value.h"`

Go to the source code of this file.

## Functions
VALUE | rb_block_proc (void)
VALUE | rb_block_lambda (void)
VALUE | rb_proc_new (rb_block_call_func_t, VALUE)
VALUE | rb_obj_is_proc (VALUE)
VALUE | rb_proc_call (VALUE, VALUE)
VALUE | rb_proc_call_kw (VALUE, VALUE, int)
VALUE | rb_proc_call_with_block (VALUE, int argc, const VALUE *argv, VALUE)
VALUE | rb_proc_call_with_block_kw (VALUE, int argc, const VALUE *argv, VALUE, int)
int | rb_proc_arity (VALUE)
VALUE | rb_proc_lambda_p (VALUE)
VALUE | rb_binding_new (void)
VALUE | rb_obj_method (VALUE, VALUE)
VALUE | rb_obj_is_method (VALUE)
VALUE | rb_method_call (int, const VALUE *, VALUE)
VALUE | rb_method_call_kw (int, const VALUE *, VALUE, int)
VALUE | rb_method_call_with_block (int, const VALUE *, VALUE, VALUE)
VALUE | rb_method_call_with_block_kw (int, const VALUE *, VALUE, VALUE, int)
int | rb_mod_method_arity (VALUE, ID)
int | rb_obj_method_arity (VALUE, ID)
VALUE | rb_protect (VALUE(*)(VALUE), VALUE, int *)
| Protects a function call from potential global escapes from the function. More...

## Detailed Description

Public APIs related to rb_cProc.

Author
  Ruby developers ruby-.nosp@m.core.nosp@m.@ruby.nosp@m.-lan.nosp@m.g.org

Copyright
  This file is a part of the programming language Ruby. Permission is hereby granted, to either redistribute and/or modify this file, provided that the conditions mentioned in the file COPYING are met. Consult the file for details.

Warning
  Symbols prefixed with either `RBIMPL` or `rbimpl` are implementation details. Don't take them as canon. They could rapidly appear then vanish. The name (path) of this header file is also an implementation detail. Do not expect it to persist at the place it is now. Developers are free to move it anywhere anytime at will.

Note
  To ruby-core: remember that this header can be possibly recursively included from extension libraries written in C++. Do not expect for instance `__VA_ARGS__` is always available. We assume C99 for ruby itself but we don't assume languages of extension libraries. They could be written in C++98.

Definition in file proc.h.

## Function Documentation

## ◆ rb_binding_new()

VALUE rb_binding_new | ( | void |  | ) |

Definition at line 364 of file proc.c.

References rb_execution_context_struct::cfp, and rb_vm_make_binding().

Referenced by Init_VM().

## ◆ rb_block_lambda()

VALUE rb_block_lambda | ( | void |  | ) |

Definition at line 845 of file proc.c.

References FALSE, rb_cProc, and TRUE.

## ◆ rb_block_proc()

VALUE rb_block_proc | ( | void |  | ) |

Definition at line 826 of file proc.c.

References FALSE, and rb_cProc.

Referenced by rb_f_trace_var(), rb_method_call(), and rb_method_call_kw().

## ◆ rb_method_call()

VALUE rb_method_call | ( | int | argc,
|  | const VALUE * | argv,
|  | VALUE | method
| ) |  |

Definition at line 2398 of file proc.c.

References argc, argv, Qnil, rb_block_given_p(), rb_block_proc(), and rb_method_call_with_block().

## ◆ rb_method_call_kw()

VALUE rb_method_call_kw | ( | int | argc,
|  | const VALUE * | argv,
|  | VALUE | method,
|  | int | kw_splat
| ) |  |

Definition at line 2391 of file proc.c.

References argc, argv, Qnil, rb_block_given_p(), rb_block_proc(), and rb_method_call_with_block_kw().

## ◆ rb_method_call_with_block()

VALUE rb_method_call_with_block | ( | int | argc,
|  | const VALUE * | argv,
|  | VALUE | method,
|  | VALUE | passed_procval
| ) |  |

Definition at line 2434 of file proc.c.

References argc, argv, rb_method_call_with_block_kw(), and RB_NO_KEYWORDS.

Referenced by rb_method_call().

## ◆ rb_method_call_with_block_kw()

VALUE rb_method_call_with_block_kw | ( | int | argc,
|  | const VALUE * | argv,
|  | VALUE | method,
|  | VALUE | passed_procval,
|  | int | kw_splat
| ) |  |

Definition at line 2421 of file proc.c.

References argc, argv, Qundef, rb_eTypeError, rb_raise(), METHOD::recv, and TypedData_Get_Struct.

Referenced by rb_method_call_kw(), and rb_method_call_with_block().

## ◆ rb_mod_method_arity()

int rb_mod_method_arity | ( | VALUE | mod,
|  | ID | id
| ) |  |

Definition at line 2773 of file proc.c.

References METHOD::me, mod, and rb_method_entry_arity().

Referenced by rb_obj_method_arity().

## ◆ rb_obj_is_method()

VALUE rb_obj_is_method | ( | VALUE | m | ) |

Definition at line 1590 of file proc.c.

References Qfalse, Qtrue, and rb_typeddata_is_kind_of().

Referenced by rb_callable_receiver(), and rb_econv_prepare_options().

## ◆ rb_obj_is_proc()

VALUE rb_obj_is_proc | ( | VALUE | proc | ) |

Definition at line 152 of file proc.c.

References Qfalse, Qtrue, and rb_typeddata_is_kind_of().

Referenced by rb_callable_receiver(), rb_econv_prepare_options(), rb_hash_set_default_proc(), and rb_raw_obj_info().

## ◆ rb_obj_method()

VALUE rb_obj_method | ( | VALUE | obj,
|  | VALUE | vid
| ) |  |

Definition at line 1992 of file proc.c.

References FALSE.

Referenced by Init_Proc().

## ◆ rb_obj_method_arity()

int rb_obj_method_arity | ( | VALUE | obj,
|  | ID | id
| ) |  |

Definition at line 2781 of file proc.c.

References CLASS_OF, and rb_mod_method_arity().

## ◆ rb_proc_arity()

int rb_proc_arity | ( | VALUE | self | ) |

Definition at line 1126 of file proc.c.

References rb_proc_t::block, GetProcPtr, rb_proc_t::is_lambda, max, and UNLIMITED_ARGUMENTS.

## ◆ rb_proc_call()

VALUE rb_proc_call | ( | VALUE | self,
|  | VALUE | args
| ) |  |

Definition at line 981 of file proc.c.

References check_argc, GetProcPtr, RARRAY_CONST_PTR, RARRAY_LEN, RB_GC_GUARD, RB_NO_KEYWORDS, rb_vm_invoke_proc(), rb_captured_block::self, and VM_BLOCK_HANDLER_NONE.

Referenced by rb_call_end_proc().

## ◆ rb_proc_call_kw()

VALUE rb_proc_call_kw | ( | VALUE | self,
|  | VALUE | args,
|  | int | kw_splat
| ) |  |

Definition at line 966 of file proc.c.

References argc, argv, check_argc, GetProcPtr, RARRAY_CONST_PTR, RARRAY_LEN, RB_GC_GUARD, rb_vm_invoke_proc(), rb_captured_block::self, and VM_BLOCK_HANDLER_NONE.

## ◆ rb_proc_call_with_block()

VALUE rb_proc_call_with_block | ( | VALUE | self,
|  | int | argc,
|  | const VALUE * | argv,
|  | VALUE | passed_procval
| ) |  |

Definition at line 1013 of file proc.c.

References argc, argv, GetProcPtr, RB_GC_GUARD, RB_NO_KEYWORDS, rb_vm_invoke_proc(), and rb_captured_block::self.

## ◆ rb_proc_call_with_block_kw()

VALUE rb_proc_call_with_block_kw | ( | VALUE | self,
|  | int | argc,
|  | const VALUE * | argv,
|  | VALUE | passed_procval,
|  | int | kw_splat
| ) |  |

Definition at line 1001 of file proc.c.

References argc, argv, GetProcPtr, RB_GC_GUARD, rb_vm_invoke_proc(), and rb_captured_block::self.

## ◆ rb_proc_lambda_p()

VALUE rb_proc_lambda_p | ( | VALUE | procval | ) |

Definition at line 275 of file proc.c.

References GetProcPtr, rb_proc_t::is_lambda, Qfalse, and Qtrue.

Referenced by Init_Proc().

## ◆ rb_proc_new()

VALUE rb_proc_new | ( | rb_block_call_func_t | func,
|  | VALUE | val
| ) |  |

Definition at line 3145 of file proc.c.

References ruby::backward::cxxanyargs::rb_iterate().