Ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e0ba6b95ab71a441357ed5484e33498)
vm.h
Go to the documentation of this file.
1#ifndef RBIMPL_INTERN_VM_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RBIMPL_INTERN_VM_H
26#include "ruby/internal/value.h"
27
29
30/* vm.c */
31
32
39int rb_sourceline(void);
40
49const char *rb_sourcefile(void);
50
62int rb_frame_method_id_and_class(ID *idp, VALUE *klassp);
63
64/* vm_eval.c */
65
77VALUE rb_check_funcall(VALUE recv, ID mid, int argc, const VALUE *argv);
78
96VALUE rb_check_funcall_kw(VALUE recv, ID mid, int argc, const VALUE *argv, int kw_splat);
97
112VALUE rb_eval_cmd_kw(VALUE cmd, VALUE arg, int kw_splat);
113
125VALUE rb_apply(VALUE recv, ID mid, VALUE args);
126
144VALUE rb_obj_instance_eval(int argc, const VALUE *argv, VALUE recv);
145
169VALUE rb_obj_instance_exec(int argc, const VALUE *argv, VALUE recv);
170
181VALUE rb_mod_module_eval(int argc, const VALUE *argv, VALUE mod);
182
193VALUE rb_mod_module_exec(int argc, const VALUE *argv, VALUE mod);
194
195/* vm_method.c */
196
204#define HAVE_RB_DEFINE_ALLOC_FUNC 1
205
216typedef VALUE (*rb_alloc_func_t)(VALUE klass);
217
225void rb_define_alloc_func(VALUE klass, rb_alloc_func_t func);
226
238void rb_undef_alloc_func(VALUE klass);
239
254
264void rb_clear_constant_cache(void);
265
278void rb_alias(VALUE klass, ID dst, ID src);
279
298void rb_attr(VALUE klass, ID name, int need_reader, int need_writer, int honour_visibility);
299
312void rb_remove_method(VALUE klass, const char *name);
313
324void rb_remove_method_id(VALUE klass, ID mid);
325
343int rb_method_boundp(VALUE klass, ID id, int ex);
344
355int rb_method_basic_definition_p(VALUE klass, ID mid);
356
370int rb_obj_respond_to(VALUE obj, ID mid, int private_p);
371
381int rb_respond_to(VALUE obj, ID mid);
382
403VALUE rb_f_notimplement(int argc, const VALUE *argv, VALUE obj, VALUE marker);
404#if !defined(RUBY_EXPORT) && defined(_WIN32)
405RUBY_EXTERN VALUE (*const rb_f_notimplement_)(int, const VALUE *, VALUE, VALUE marker);
406#define rb_f_notimplement (*rb_f_notimplement_)
407#endif
408
409/* vm_backtrace.c */
410
419void rb_backtrace(void);
420
431VALUE rb_make_backtrace(void);
432
434
435#endif /* RBIMPL_INTERN_VM_H */
Tweaking visibility of C variables/functions.
#define RUBY_EXTERN
Declaration of externally visible global variables.
Definition: dllexport.h:47
#define RBIMPL_SYMBOL_EXPORT_END()
Counterpart of RBIMPL_SYMBOL_EXPORT_BEGIN.
Definition: dllexport.h:106
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
Definition: dllexport.h:97
int rb_respond_to(VALUE obj, ID mid)
Queries if the object responds to the method.
Definition: vm_method.c:2765
VALUE(* rb_alloc_func_t)(VALUE klass)
This is the type of functions that ruby calls when trying to allocate an object.
Definition: vm.h:216
void rb_undef_alloc_func(VALUE klass)
Deletes the allocator function of a class.
Definition: vm_method.c:1117
const char * rb_sourcefile(void)
Resembles __FILE__.
Definition: vm.c:1606
void rb_alias(VALUE klass, ID dst, ID src)
Resembles alias.
Definition: vm_method.c:2100
int rb_method_basic_definition_p(VALUE klass, ID mid)
Well... Let us hesitate from describing what a "basic definition" is.
Definition: vm_method.c:2643
void rb_clear_constant_cache(void)
Clears the constant cache.
Definition: vm_method.c:130
void rb_attr(VALUE klass, ID name, int need_reader, int need_writer, int honour_visibility)
This function resembles now-deprecated Module#attr.
Definition: vm_method.c:1680
void rb_remove_method(VALUE klass, const char *name)
Removes a method.
Definition: vm_method.c:1529
VALUE rb_check_funcall(VALUE recv, ID mid, int argc, const VALUE *argv)
Identical to rb_funcallv(), except it returns RUBY_Qundef instead of raising rb_eNoMethodError.
Definition: vm_eval.c:664
int rb_frame_method_id_and_class(ID *idp, VALUE *klassp)
Resembles __method__.
Definition: vm.c:2496
rb_alloc_func_t rb_get_alloc_func(VALUE klass)
Queries the allocator function of a class.
Definition: vm_method.c:1123
VALUE rb_check_funcall_kw(VALUE recv, ID mid, int argc, const VALUE *argv, int kw_splat)
Identical to rb_check_funcall(), except you can specify how to handle the last element of the given a...
Definition: vm_eval.c:658
VALUE rb_mod_module_eval(int argc, const VALUE *argv, VALUE mod)
Identical to rb_obj_instance_eval(), except it evaluates within the context of module.
Definition: vm_eval.c:2138
void rb_remove_method_id(VALUE klass, ID mid)
Identical to rb_remove_method(), except it accepts the method name as ID.
Definition: vm_method.c:1523
VALUE rb_mod_module_exec(int argc, const VALUE *argv, VALUE mod)
Identical to rb_obj_instance_exec(), except it evaluates within the context of module.
Definition: vm_eval.c:2172
void rb_define_alloc_func(VALUE klass, rb_alloc_func_t func)
Sets the allocator function of a class.
VALUE rb_obj_instance_exec(int argc, const VALUE *argv, VALUE recv)
Executes the given block within the context of the receiver.
Definition: vm_eval.c:2099
VALUE rb_eval_cmd_kw(VALUE cmd, VALUE arg, int kw_splat)
This API is practically a variant of rb_proc_call_kw() now.
Definition: vm_eval.c:1900
VALUE rb_f_notimplement(int argc, const VALUE *argv, VALUE obj, VALUE marker)
Raises rb_eNotImpError.
Definition: vm_method.c:327
VALUE rb_apply(VALUE recv, ID mid, VALUE args)
Identical to rb_funcallv(), except it takes Ruby's array instead of C's.
Definition: vm_eval.c:1077
VALUE rb_make_backtrace(void)
Creates the good old fashioned array-of-strings style backtrace info.
int rb_method_boundp(VALUE klass, ID id, int ex)
Queries if the klass has this method.
Definition: vm_method.c:1641
void rb_backtrace(void)
Prints the backtrace out to the standard error.
VALUE rb_obj_instance_eval(int argc, const VALUE *argv, VALUE recv)
Evaluates a string containing Ruby source code, or the given block, within the context of the receive...
Definition: vm_eval.c:2069
int rb_sourceline(void)
Resembles __LINE__.
Definition: vm.c:1620
int rb_obj_respond_to(VALUE obj, ID mid, int private_p)
Identical to rb_respond_to(), except it additionally takes the visibility parameter.
Definition: vm_method.c:2749
RBIMPL_ATTR_NORETURN() void rb_eof_error(void)
Utility function to raise rb_eEOFError.
Defines RBIMPL_ATTR_NONNULL.
#define RBIMPL_ATTR_NONNULL(list)
Wraps (or simulates) __attribute__((nonnull))
Definition: nonnull.h:27
Defines RBIMPL_ATTR_NORETURN.
Defines VALUE and ID.
uintptr_t VALUE
Type that represents a Ruby object.
Definition: value.h:40