Ruby
3.4.0dev (2024-11-05 revision 348a53415339076afc4a02fcd09f3ae36e9c4c61)
|
Defines enum ruby_special_consts. More...
#include "ruby/internal/attr/artificial.h"
#include "ruby/internal/attr/const.h"
#include "ruby/internal/attr/constexpr.h"
#include "ruby/internal/attr/enum_extensibility.h"
#include "ruby/internal/stdbool.h"
#include "ruby/internal/value.h"
Go to the source code of this file.
Enumerations | |
enum | ruby_special_consts { RUBY_Qfalse , RUBY_Qtrue , RUBY_Qnil , RUBY_Qundef , RUBY_IMMEDIATE_MASK , RUBY_FIXNUM_FLAG , RUBY_FLONUM_MASK , RUBY_FLONUM_FLAG , RUBY_SYMBOL_FLAG , RUBY_SPECIAL_SHIFT = 8 } |
special constants - i.e. More... | |
Functions | |
static bool | RB_TEST (VALUE obj) |
Emulates Ruby's "if" statement. More... | |
static bool | RB_NIL_P (VALUE obj) |
Checks if the given object is nil. More... | |
static bool | RB_UNDEF_P (VALUE obj) |
Checks if the given object is undef. More... | |
static bool | RB_NIL_OR_UNDEF_P (VALUE obj) |
Checks if the given object is nil or undef. More... | |
static bool | RB_FIXNUM_P (VALUE obj) |
Checks if the given object is a so-called Fixnum. More... | |
static bool | RB_STATIC_SYM_P (VALUE obj) |
Checks if the given object is a static symbol. More... | |
static bool | RB_FLONUM_P (VALUE obj) |
Checks if the given object is a so-called Flonum. More... | |
static bool | RB_IMMEDIATE_P (VALUE obj) |
Checks if the given object is an immediate i.e. More... | |
static bool | RB_SPECIAL_CONST_P (VALUE obj) |
Checks if the given object is of enum ruby_special_consts. More... | |
static VALUE | rb_special_const_p (VALUE obj) |
Identical to RB_SPECIAL_CONST_P, except it returns a VALUE. More... | |
Defines enum ruby_special_consts.
RBIMPL
or rbimpl
are implementation details. Don't take them as canon. They could rapidly appear then vanish. The name (path) of this header file is also an implementation detail. Do not expect it to persist at the place it is now. Developers are free to move it anywhere anytime at will. __VA_ARGS__
is always available. We assume C99 for ruby itself but we don't assume languages of extension libraries. They could be written in C++98. Definition in file special_consts.h.
#define RTEST RB_TEST |
This is an old name of RB_TEST.
Not sure which name is preferred.
Definition at line 51 of file special_consts.h.
#define USE_FLONUM 1 |
Definition at line 45 of file special_consts.h.
enum ruby_special_consts |
special constants - i.e.
non-zero and non-fixnum constants
Enumerator | |
---|---|
RUBY_Qfalse |
|
RUBY_Qtrue |
|
RUBY_Qnil |
|
RUBY_Qundef | Represents so-called undef. |
RUBY_IMMEDIATE_MASK | Bit mask detecting special consts. |
RUBY_FIXNUM_FLAG | Flag to denote a fixnum. |
RUBY_FLONUM_MASK | Bit mask detecting a flonum. |
RUBY_FLONUM_FLAG | Flag to denote a flonum. |
RUBY_SYMBOL_FLAG | Flag to denote a static symbol. |
RUBY_SPECIAL_SHIFT | Least significant 8 bits are reserved. |
Definition at line 84 of file special_consts.h.
|
inlinestatic |
Checks if the given object is a so-called Fixnum.
[in] | obj | An arbitrary ruby object. |
true | obj is a Fixnum. |
false | Anything else. |
Definition at line 247 of file special_consts.h.
Referenced by rb_class_of(), rb_fiber_scheduler_io_result_apply(), RB_FIX2INT(), RB_FIX2UINT(), rb_fix2ulong(), RB_INT2FIX(), rb_integer_type_p(), rb_num2int_inline(), rb_num2ll_inline(), rb_num2long_inline(), rb_num2short_inline(), rb_num2ull_inline(), and rb_num2ulong_inline().
|
inlinestatic |
Checks if the given object is a so-called Flonum.
[in] | obj | An arbitrary ruby object. |
true | obj is a Flonum. |
false | Anything else. |
Definition at line 288 of file special_consts.h.
Referenced by rb_class_of(), and RB_FLOAT_TYPE_P().
|
inlinestatic |
Checks if the given object is an immediate i.e.
an object which has no corresponding storage inside of the object space.
[in] | obj | An arbitrary ruby object. |
true | obj is a Flonum. |
false | Anything else. |
Definition at line 311 of file special_consts.h.
Referenced by RB_SPECIAL_CONST_P().
|
inlinestatic |
Checks if the given object is nil or undef.
Can be used to see if a keyword argument is not given or given nil
.
[in] | obj | An arbitrary ruby object. |
true | obj is RUBY_Qnil or RUBY_Qundef. |
false | Anything else. |
Definition at line 206 of file special_consts.h.
|
inlinestatic |
Checks if the given object is nil.
[in] | obj | An arbitrary ruby object. |
true | obj is RUBY_Qnil. |
false | Anything else. |
Definition at line 173 of file special_consts.h.
|
inlinestatic |
Checks if the given object is of enum ruby_special_consts.
[in] | obj | An arbitrary ruby object. |
true | obj is a special constant. |
false | Anything else. |
Definition at line 327 of file special_consts.h.
Referenced by RB_BUILTIN_TYPE(), rb_class_of(), rb_define_const(), RB_DYNAMIC_SYM_P(), RB_FL_ABLE(), RB_FLOAT_TYPE_P(), rb_integer_type_p(), rb_ractor_shareable_p(), rb_special_const_p(), and RBASIC_CLASS().
Identical to RB_SPECIAL_CONST_P, except it returns a VALUE.
[in] | obj | An arbitrary ruby object. |
RUBY_Qtrue | obj is a special constant. |
RUBY_Qfalse | Anything else. |
Definition at line 347 of file special_consts.h.
|
inlinestatic |
Checks if the given object is a static symbol.
[in] | obj | An arbitrary ruby object. |
true | obj is a static symbol |
false | Anything else. |
Definition at line 267 of file special_consts.h.
Referenced by rb_class_of(), and RB_SYMBOL_P().
|
inlinestatic |
Emulates Ruby's "if" statement.
[in] | obj | An arbitrary ruby object. |
false | obj is either RUBY_Qfalse or RUBY_Qnil. |
true | Anything else. |
Definition at line 138 of file special_consts.h.
|
inlinestatic |
Checks if the given object is undef.
[in] | obj | An arbitrary ruby object. |
true | obj is RUBY_Qundef. |
false | Anything else. |
Definition at line 189 of file special_consts.h.