Ruby  3.1.4p223 (2023-03-30 revision HEAD)
object.h
Go to the documentation of this file.
1 #ifndef RBIMPL_INTERN_OBJECT_H /*-*-C++-*-vi:se ft=cpp:*/
2 #define RBIMPL_INTERN_OBJECT_H
28 #include "ruby/internal/value.h"
29 
31 
32 
38 #define RB_OBJ_INIT_COPY(obj, orig) \
39  ((obj) != (orig) && (rb_obj_init_copy((obj), (orig)), 1))
41 #define OBJ_INIT_COPY(obj, orig) RB_OBJ_INIT_COPY(obj, orig)
42 
43 /* object.c */
44 
57 VALUE rb_class_new_instance_pass_kw(int argc, const VALUE *argv, VALUE klass);
58 
71 VALUE rb_class_new_instance(int argc, const VALUE *argv, VALUE klass);
72 
88 VALUE rb_class_new_instance_kw(int argc, const VALUE *argv, VALUE klass, int kw_splat);
89 
100 int rb_eql(VALUE lhs, VALUE rhs);
101 
110 VALUE rb_any_to_s(VALUE obj);
111 
121 VALUE rb_inspect(VALUE obj);
122 
133 
144 VALUE rb_obj_is_kind_of(VALUE obj, VALUE klass);
145 
163 VALUE rb_obj_alloc(VALUE klass);
164 
180 
190 VALUE rb_obj_dup(VALUE obj);
191 
204 
205 RBIMPL_ATTR_DEPRECATED_EXT(("taintedness turned out to be a wrong idea."))
215 
217 RBIMPL_ATTR_DEPRECATED_EXT(("taintedness turned out to be a wrong idea."))
227 
228 RBIMPL_ATTR_DEPRECATED_EXT(("taintedness turned out to be a wrong idea."))
238 
239 RBIMPL_ATTR_DEPRECATED_EXT(("trustedness turned out to be a wrong idea."))
249 
251 RBIMPL_ATTR_DEPRECATED_EXT(("trustedness turned out to be a wrong idea."))
261 
262 RBIMPL_ATTR_DEPRECATED_EXT(("trustedness turned out to be a wrong idea."))
272 
281 
292 
293 /* gc.c */
294 
313 VALUE rb_obj_id(VALUE obj);
314 
335 
336 /* object.c */
337 
350 VALUE rb_class_real(VALUE klass);
351 
363 VALUE rb_class_inherited_p(VALUE scion, VALUE ascendant);
364 
379 
392 VALUE rb_convert_type(VALUE val, int type, const char *name, const char *mid);
393 
409 VALUE rb_check_convert_type(VALUE val, int type, const char *name, const char *mid);
410 
422 VALUE rb_check_to_integer(VALUE val, const char *mid);
423 
445 
454 VALUE rb_to_int(VALUE val);
455 
465 
480 VALUE rb_Integer(VALUE val);
481 
489 VALUE rb_to_float(VALUE val);
490 
504 VALUE rb_Float(VALUE val);
505 
514 VALUE rb_String(VALUE val);
515 
524 VALUE rb_Array(VALUE val);
525 
535 VALUE rb_Hash(VALUE val);
536 
554 double rb_cstr_to_dbl(const char *str, int mode);
555 
565 double rb_str_to_dbl(VALUE str, int mode);
566 
568 
569 #endif /* RBIMPL_INTERN_OBJECT_H */
Defines RBIMPL_ATTR_CONST.
Defines RBIMPL_ATTR_DEPRECATED.
#define RBIMPL_ATTR_DEPRECATED_EXT(msg)
This is when a function is used internally (for backwards compatibility etc.), but extension librarie...
Definition: deprecated.h:72
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
VALUE rb_class_superclass(VALUE klass)
Queries the parent of the given class.
Definition: object.c:1971
VALUE rb_obj_taint(VALUE obj)
Definition: object.c:1066
VALUE rb_obj_trust(VALUE obj)
Definition: object.c:1124
VALUE rb_convert_type(VALUE val, int type, const char *name, const char *mid)
Converts an object into another type.
Definition: object.c:2906
VALUE rb_Float(VALUE val)
This is the logic behind Kernel#Float.
Definition: object.c:3441
VALUE rb_check_to_int(VALUE val)
Identical to rb_check_to_integer(), except it uses #to_int for conversion.
Definition: object.c:3004
VALUE rb_check_convert_type(VALUE val, int type, const char *name, const char *mid)
Identical to rb_convert_type(), except it returns RUBY_Qnil instead of raising exceptions,...
Definition: object.c:2933
VALUE rb_any_to_s(VALUE obj)
Generates a textual representation of the given object.
Definition: object.c:553
VALUE rb_obj_alloc(VALUE klass)
Allocates an instance of the given class.
Definition: object.c:1909
VALUE rb_class_new_instance(int argc, const VALUE *argv, VALUE klass)
Allocates, then initialises an instance of the given class.
Definition: object.c:1950
VALUE rb_class_new_instance_kw(int argc, const VALUE *argv, VALUE klass, int kw_splat)
Identical to rb_class_new_instance(), except you can specify how to handle the last element of the gi...
Definition: object.c:1938
VALUE rb_class_new_instance_pass_kw(int argc, const VALUE *argv, VALUE klass)
Identical to rb_class_new_instance(), except it passes the passed keywords if any to the #initialize ...
Definition: object.c:1927
VALUE rb_check_to_float(VALUE val)
This is complicated.
Definition: object.c:3480
VALUE rb_Hash(VALUE val)
This is the logic behind Kernel#Hash.
Definition: object.c:3636
VALUE rb_obj_frozen_p(VALUE obj)
Just calls RB_OBJ_FROZEN() inside.
Definition: object.c:1173
VALUE rb_obj_init_copy(VALUE src, VALUE dst)
Default implementation of #initialize_copy, #initialize_dup and #initialize_clone.
Definition: object.c:500
int rb_eql(VALUE lhs, VALUE rhs)
Checks for equality of the passed objects, in terms of Object#eql?.
Definition: object.c:133
double rb_str_to_dbl(VALUE str, int mode)
Identical to rb_cstr_to_dbl(), except it accepts a Ruby's string instead of C's.
Definition: object.c:3325
VALUE rb_Integer(VALUE val)
This is the logic behind Kernel#Integer.
Definition: object.c:3070
VALUE rb_Array(VALUE val)
This is the logic behind Kernel#Array.
Definition: object.c:3593
VALUE rb_obj_dup(VALUE obj)
Duplicates the given object.
Definition: object.c:451
VALUE rb_inspect(VALUE obj)
Generates a human-readable textual representation of the given object.
Definition: object.c:564
VALUE rb_obj_untrust(VALUE obj)
Definition: object.c:1109
VALUE rb_class_inherited_p(VALUE scion, VALUE ascendant)
Determines if the given two modules are relatives.
Definition: object.c:1608
VALUE rb_obj_is_instance_of(VALUE obj, VALUE klass)
Queries if the given object is a direct instance of the given class.
Definition: object.c:695
VALUE rb_class_real(VALUE klass)
Finds a "real" class.
Definition: object.c:178
VALUE rb_to_float(VALUE val)
Identical to rb_check_to_float(), except it raises on error.
Definition: object.c:3470
VALUE rb_obj_clone(VALUE obj)
Produces a shallow copy of the given object.
Definition: object.c:405
VALUE rb_obj_is_kind_of(VALUE obj, VALUE klass)
Queries if the given object is an instance (of possibly descendants) of the given class.
Definition: object.c:731
double rb_cstr_to_dbl(const char *str, int mode)
Converts a textual representation of a real number into a numeric, which is the nearest value that th...
Definition: object.c:3284
VALUE rb_obj_freeze(VALUE obj)
Just calls rb_obj_freeze_inline() inside.
Definition: object.c:1161
VALUE rb_check_to_integer(VALUE val, const char *mid)
Identical to rb_check_convert_type(), except the return value type is fixed to rb_cInteger.
Definition: object.c:2985
VALUE rb_obj_untrusted(VALUE obj)
Definition: object.c:1095
VALUE rb_String(VALUE val)
This is the logic behind Kernel#String.
Definition: object.c:3564
VALUE rb_obj_untaint(VALUE obj)
Definition: object.c:1081
VALUE rb_obj_tainted(VALUE obj)
Definition: object.c:1052
VALUE rb_to_int(VALUE val)
Identical to rb_check_to_int(), except it raises in case of conversion mismatch.
Definition: object.c:2998
VALUE rb_obj_id(VALUE obj)
Finds or creates an integer primary key of the given object.
Definition: gc.c:4447
VALUE rb_memory_id(VALUE obj)
Identical to rb_obj_id(), except it hesitates from allocating a new instance of rb_cInteger.
Definition: gc.c:4414
RBIMPL_ATTR_CONST() int rb_io_oflags_fmode(int oflags)
Converts an oflags (that rb_io_modestr_oflags() returns) to a fmode (that rb_io_mode_flags() returns)...
RBIMPL_ATTR_PURE() int rb_io_read_pending(rb_io_t *fptr)
Queries if the passed IO has any pending reads.
VALUE type(ANYARGS)
ANYARGS-ed function type.
Definition: cxxanyargs.hpp:56
Defines RBIMPL_ATTR_NONNULL.
#define RBIMPL_ATTR_NONNULL(list)
Wraps (or simulates) __attribute__((nonnull))
Definition: nonnull.h:27
Defines RBIMPL_ATTR_PURE.
Defines VALUE and ID.
uintptr_t VALUE
Type that represents a Ruby object.
Definition: value.h:40