Ruby: internal/object.h Source File

Ruby 3.3.6p108 (2024-11-05 revision 75015d4c1f6965b5e85e96fb309f1f2129f933c0)

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_search_ancestor(VALUE klass, VALUE super);
16NORETURN(void rb_undefined_alloc(VALUE klass));
17double rb_num_to_dbl(VALUE val);
18 VALUE rb_obj_dig(int argc, VALUE *argv, VALUE self, VALUE notfound);
19 VALUE rb_obj_clone_setup(VALUE obj, VALUE clone, VALUE kwfreeze);
20 VALUE rb_obj_dup_setup(VALUE obj, VALUE dup);
21 VALUE rb_immutable_obj_clone(int, VALUE *, VALUE);
22 VALUE rb_check_convert_type_with_id(VALUE,int,const char*,ID);
23int rb_bool_expected(VALUE, const char *, int raise);
24static inline void RBASIC_CLEAR_CLASS(VALUE obj);
25static inline void RBASIC_SET_CLASS_RAW(VALUE obj, VALUE klass);
26static inline void RBASIC_SET_CLASS(VALUE obj, VALUE klass);
27
28RUBY_SYMBOL_EXPORT_BEGIN
29/* object.c (export) */
30int rb_opts_exception_p(VALUE opts, int default_value);
31RUBY_SYMBOL_EXPORT_END
32
33CONSTFUNC(VALUE rb_obj_equal(VALUE obj1, VALUE obj2));
34CONSTFUNC(VALUE rb_obj_not(VALUE obj));
35 VALUE rb_obj_not_equal(VALUE obj1, VALUE obj2);
36void rb_obj_copy_ivar(VALUE dest, VALUE obj);
37 VALUE rb_false(VALUE obj);
38 VALUE rb_convert_type_with_id(VALUE v, int t, const char* nam, ID mid);
39 VALUE rb_obj_size(VALUE self, VALUE args, VALUE obj);
40 VALUE rb_get_freeze_opt(int argc, VALUE *argv);
41
42static inline void
43RBASIC_SET_CLASS_RAW(VALUE obj, VALUE klass)
44{
45 const VALUE *ptr = &RBASIC(obj)->klass;
46 *(VALUE *)ptr = klass;
47}
48
49static inline void
50RBASIC_CLEAR_CLASS(VALUE obj)
51{
52 RBASIC_SET_CLASS_RAW(obj, 0);
53}
54
55static inline void
56RBASIC_SET_CLASS(VALUE obj, VALUE klass)
57{
58 VALUE oldv = RBASIC_CLASS(obj);
59 RBASIC_SET_CLASS_RAW(obj, klass);
60 RB_OBJ_WRITTEN(obj, oldv, klass);
61}
62#endif /* INTERNAL_OBJECT_H */
rb_obj_embedded_size
size_t rb_obj_embedded_size(uint32_t numiv)
Internal header for Object.
Definition object.c:96
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:631
RBASIC_CLASS
static VALUE RBASIC_CLASS(VALUE obj)
Queries the class of an object.
Definition rbasic.h:152
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