Ruby  3.1.4p223 (2023-03-30 revision HEAD)
newobj.h
Go to the documentation of this file.
1 #ifndef RBIMPL_NEWOBJ_H /*-*-C++-*-vi:se ft=cpp:*/
2 #define RBIMPL_NEWOBJ_H
24 #include "ruby/internal/cast.h"
27 #include "ruby/internal/fl_type.h"
29 #include "ruby/internal/value.h"
30 #include "ruby/assert.h"
31 
45 #define RB_NEWOBJ(obj,type) type *(obj) = RBIMPL_CAST((type *)rb_newobj())
46 
58 #define RB_NEWOBJ_OF(obj,type,klass,flags) type *(obj) = RBIMPL_CAST((type *)rb_newobj_of(klass, flags))
59 
60 #define NEWOBJ RB_NEWOBJ
61 #define NEWOBJ_OF RB_NEWOBJ_OF
62 #define OBJSETUP rb_obj_setup
63 #define CLONESETUP rb_clone_setup
64 #define DUPSETUP rb_dup_setup
73 VALUE rb_newobj(void);
74 
83 VALUE rb_newobj_of(VALUE klass, VALUE flags);
84 
106 VALUE rb_obj_setup(VALUE obj, VALUE klass, VALUE type);
107 
117 
132 
145 void rb_singleton_class_attached(VALUE klass, VALUE obj);
146 
158 void rb_copy_generic_ivar(VALUE clone, VALUE obj);
160 
161 RBIMPL_ATTR_DEPRECATED(("This is no longer how Object#clone works."))
172 static inline void
173 rb_clone_setup(VALUE clone, VALUE obj)
174 {
175  return;
176 }
177 
178 RBIMPL_ATTR_DEPRECATED(("This is no longer how Object#dup works."))
189 static inline void
190 rb_dup_setup(VALUE dup, VALUE obj)
191 {
192  return;
193 }
194 
195 #endif /* RBIMPL_NEWOBJ_H */
Defines RBIMPL_ATTR_DEPRECATED.
#define RBIMPL_ATTR_DEPRECATED(msg)
Wraps (or simulates) [[deprecated]]
Definition: deprecated.h:36
Tweaking visibility of C variables/functions.
#define RBIMPL_SYMBOL_EXPORT_END()
Counterpart of RBIMPL_SYMBOL_EXPORT_BEGIN.
Definition: dllexport.h:106
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
Definition: dllexport.h:97
Defines enum ruby_fl_type.
VALUE rb_singleton_class_clone(VALUE obj)
Clones a singleton class.
Definition: class.c:522
void rb_singleton_class_attached(VALUE klass, VALUE obj)
Attaches a singleton class to its corresponding object.
Definition: class.c:589
VALUE rb_obj_class(VALUE obj)
Queries the class of an object.
Definition: object.c:188
VALUE rb_obj_setup(VALUE obj, VALUE klass, VALUE type)
Fills common fields in the object.
Definition: object.c:100
VALUE type(ANYARGS)
ANYARGS-ed function type.
Definition: cxxanyargs.hpp:56
VALUE rb_newobj(void)
This is the implementation detail of RB_NEWOBJ.
Definition: gc.c:2595
void rb_copy_generic_ivar(VALUE clone, VALUE obj)
Copies the list of instance variables.
Definition: variable.c:1719
VALUE rb_newobj_of(VALUE klass, VALUE flags)
This is the implementation detail of RB_NEWOBJ_OF.
Definition: gc.c:2601
Defines struct RBasic.
Defines enum ruby_special_consts.
Defines VALUE and ID.
uintptr_t VALUE
Type that represents a Ruby object.
Definition: value.h:40