1 #ifndef INTERNAL_OBJECT_H /*-*-C-*-vi:se ft=c:*/
2 #define INTERNAL_OBJECT_H
4 * @author Ruby developers <ruby-core@ruby-lang.org>
5 * @copyright This file is a part of the programming language Ruby.
6 * Permission is hereby granted, to either redistribute and/or
7 * modify this file, provided that the conditions mentioned in the
8 * file COPYING are met. Consult the file for details.
9 * @brief Internal header for Object.
11 #include "ruby/ruby.h" /* for VALUE */
14 size_t rb_obj_embedded_size(uint32_t fields_count
);
15 VALUE
rb_class_allocate_instance(VALUE klass
);
16 VALUE
rb_class_search_ancestor(VALUE klass
, VALUE super
);
17 NORETURN(void rb_undefined_alloc(VALUE klass
));
18 double 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
);
24 int rb_bool_expected(VALUE
, const char *, int raise
);
25 static inline void RBASIC_CLEAR_CLASS(VALUE obj
);
26 static inline void RBASIC_SET_CLASS_RAW(VALUE obj
, VALUE klass
);
27 static inline void RBASIC_SET_CLASS(VALUE obj
, VALUE klass
);
29 RUBY_SYMBOL_EXPORT_BEGIN
30 /* object.c (export) */
31 int rb_opts_exception_p(VALUE opts
, int default_value
);
32 RUBY_SYMBOL_EXPORT_END
34 CONSTFUNC(VALUE
rb_obj_equal(VALUE obj1
, VALUE obj2
));
35 CONSTFUNC(VALUE
rb_obj_not(VALUE obj
));
36 VALUE
rb_obj_not_equal(VALUE obj1
, VALUE obj2
);
37 void 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
);
44 RBASIC_SET_CLASS_RAW(VALUE obj
, VALUE klass
)
46 const VALUE
*ptr
= &RBASIC(obj
)->klass
;
47 *(VALUE
*)ptr
= klass
;
51 RBASIC_CLEAR_CLASS(VALUE obj
)
53 RBASIC_SET_CLASS_RAW(obj
, 0);
57 RBASIC_SET_CLASS(VALUE obj
, VALUE klass
)
59 VALUE oldv
= RBASIC_CLASS(obj
);
60 RBASIC_SET_CLASS_RAW(obj
, klass
);
61 RB_OBJ_WRITTEN(obj
, oldv
, klass
);
63 #endif /* INTERNAL_OBJECT_H */