Ruby: internal/object.h Source File

Ruby 3.4.6p54 (2025-09-16 revision dbd83256b1cec76c69756ecb8758b9e1079833de)

object.h
1#ifndef INTERNAL_OBJECT_H /*-*-C-*-vi:se ft=c:*/
2#define INTERNAL_OBJECT_H
11#include "ruby/ruby.h" /* for VALUE */
12
13/* object.c */
14size_t rb_obj_embedded_size(uint32_t numiv);
15 VALUE rb_class_allocate_instance(VALUE klass);
16 VALUE rb_class_search_ancestor(VALUE klass, VALUE super);
17NORETURN(void rb_undefined_alloc(VALUE klass));
18double rb_num_to_dbl(VALUE val);
19 VALUE rb_obj_dig(int argc, VALUE *argv, VALUE self, VALUE notfound);
20 VALUE rb_obj_clone_setup(VALUE obj, VALUE clone, VALUE kwfreeze);
21 VALUE rb_obj_dup_setup(VALUE obj, VALUE dup);
22 VALUE rb_immutable_obj_clone(int, VALUE *, VALUE);
23 VALUE rb_check_convert_type_with_id(VALUE,int,const char*,ID);
24int rb_bool_expected(VALUE, const char *, int raise);
25static inline void RBASIC_CLEAR_CLASS(VALUE obj);
26static inline void RBASIC_SET_CLASS_RAW(VALUE obj, VALUE klass);
27static inline void RBASIC_SET_CLASS(VALUE obj, VALUE klass);
28
29RUBY_SYMBOL_EXPORT_BEGIN
30/* object.c (export) */
31int rb_opts_exception_p(VALUE opts, int default_value);
32RUBY_SYMBOL_EXPORT_END
33
34CONSTFUNC(VALUE rb_obj_equal(VALUE obj1, VALUE obj2));
35CONSTFUNC(VALUE rb_obj_not(VALUE obj));
36 VALUE rb_obj_not_equal(VALUE obj1, VALUE obj2);
37void rb_obj_copy_ivar(VALUE dest, VALUE obj);
38 VALUE rb_false(VALUE obj);
39 VALUE rb_convert_type_with_id(VALUE v, int t, const char* nam, ID mid);
40 VALUE rb_obj_size(VALUE self, VALUE args, VALUE obj);
41 VALUE rb_get_freeze_opt(int argc, VALUE *argv);
42
43static inline void
44RBASIC_SET_CLASS_RAW(VALUE obj, VALUE klass)
45{
46 const VALUE *ptr = &RBASIC(obj)->klass;
47 *(VALUE *)ptr = klass;
48}
49
50static inline void
51RBASIC_CLEAR_CLASS(VALUE obj)
52{
53 RBASIC_SET_CLASS_RAW(obj, 0);
54}
55
56static inline void
57RBASIC_SET_CLASS(VALUE obj, VALUE klass)
58{
59 VALUE oldv = RBASIC_CLASS(obj);
60 RBASIC_SET_CLASS_RAW(obj, klass);
61 RB_OBJ_WRITTEN(obj, oldv, klass);
62}
63#endif /* INTERNAL_OBJECT_H */
rb_obj_embedded_size
size_t rb_obj_embedded_size(uint32_t numiv)
Internal header for Object.
Definition object.c:98
RB_OBJ_WRITTEN
#define RB_OBJ_WRITTEN(old, oldv, young)
Identical to RB_OBJ_WRITE(), except it doesn't write any values, but only a WB declaration.
Definition gc.h:615
RBASIC_CLASS
static VALUE RBASIC_CLASS(VALUE obj)
Queries the class of an object.
Definition rbasic.h:150
RBASIC
#define RBASIC(obj)
Convenient casting macro.
Definition rbasic.h:40
ruby.h
ID
uintptr_t ID
Type that represents a Ruby identifier such as a variable name.
Definition value.h:52
VALUE
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40