Ruby: internal/object.h Source File

Ruby 3.2.5p208 (2024-07-26 revision 31d0f1a2e7dbfb60731d1f05b868e1d578cda493)

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