Ruby 4.1.0dev (2026-09-25 revision d3f0a612d348635291699f614f22125b396b869b)
variable.h
1#ifndef INTERNAL_VARIABLE_H /*-*-C-*-vi:se ft=c:*/
2#define INTERNAL_VARIABLE_H
11#include "ruby/internal/config.h"
12#include <stddef.h> /* for size_t */
13#include "constant.h" /* for rb_const_entry_t */
14#include "ruby/internal/stdbool.h" /* for bool */
15#include "ruby/ruby.h" /* for VALUE */
16#include "shape.h" /* for shape_id_t */
17
18/* variable.c */
19void rb_gc_mark_global_tbl(void);
20void rb_gc_update_global_tbl(void);
21VALUE rb_search_class_path(VALUE);
22VALUE rb_attr_delete(VALUE, ID);
23void rb_autoload_str(VALUE mod, ID id, VALUE file);
24VALUE rb_autoload_at_p(VALUE, ID, int);
25NORETURN(VALUE rb_mod_const_missing(VALUE,VALUE));
26rb_gvar_getter_t *rb_gvar_getter_function_of(ID);
27rb_gvar_setter_t *rb_gvar_setter_function_of(ID);
29void rb_gvar_ractor_local(const char *name);
30void rb_gvar_box_ready(const char *name);
31void rb_gvar_box_dynamic(const char *name);
32
47VALUE rb_mod_set_temporary_name(VALUE, VALUE);
48
49void rb_obj_replace_fields(VALUE obj, VALUE fields_obj);
50VALUE rb_obj_complex_fields_build(VALUE obj);
51VALUE rb_obj_field_get(VALUE obj, shape_id_t target_shape_id);
52void rb_ivar_set_internal(VALUE obj, ID id, VALUE val);
53void rb_check_ivar_modifiable(VALUE obj);
54void rb_ivar_foreach_buffered(VALUE obj, int (*func)(ID name, VALUE val, st_data_t arg), st_data_t arg);
55attr_index_t rb_ivar_set_index(VALUE obj, ID id, VALUE val);
56attr_index_t rb_obj_field_set(VALUE obj, shape_id_t target_shape_id, ID field_name, VALUE val);
57VALUE rb_ivar_get_at(VALUE obj, attr_index_t index, ID id);
58VALUE rb_ivar_get_at_no_ractor_check(VALUE obj, attr_index_t index);
59void rb_generic_fields_lock_atfork(void);
60void rb_imemo_fields_record_shrefs(VALUE fields_obj);
61
62/* Call cb(tbl, arg) for the single global generic_fields table. Used by the global GC's weak
63 * pass and by compaction's reference update (gc.c). */
64void rb_generic_fields_tables_foreach(void (*cb)(struct st_table *tbl, void *arg), void *arg);
65void rb_generic_fields_shared_table_foreach(void (*cb)(struct st_table *tbl, void *arg), void *arg);
66
67RUBY_SYMBOL_EXPORT_BEGIN
68/* variable.c (export) */
69void rb_mark_generic_ivar(VALUE obj);
70VALUE rb_const_missing(VALUE klass, VALUE name);
71bool rb_class_ivar_set(VALUE klass, ID vid, VALUE value);
72void rb_fields_tbl_copy(VALUE dst, VALUE src);
73RUBY_SYMBOL_EXPORT_END
74
75VALUE rb_ivar_lookup(VALUE obj, ID id, VALUE undef);
76VALUE rb_gvar_get(ID);
77VALUE rb_gvar_set(ID, VALUE);
78VALUE rb_gvar_defined(ID);
79void rb_const_warn_if_deprecated(const rb_const_entry_t *, VALUE, ID);
80
81#endif /* INTERNAL_VARIABLE_H */
void rb_gvar_setter_t(VALUE val, ID id, VALUE *data)
Type that represents a global variable setter function.
Definition variable.h:46
rb_gvar_setter_t rb_gvar_readonly_setter
This function just raises rb_eNameError.
Definition variable.h:135
VALUE rb_gvar_getter_t(ID id, VALUE *data)
Type that represents a global variable getter function.
Definition variable.h:37
#define _(args)
This was a transition path from K&R to ANSI.
Definition stdarg.h:35
C99 shim for <stdbool.h>
Definition constant.h:33
Definition st.h:79
uintptr_t ID
Type that represents a Ruby identifier such as a variable name.
Definition value.h:52
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40