Ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e0ba6b95ab71a441357ed5484e33498)
|
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 = 0x00 , RUBY_Qtrue = 0x14 , RUBY_Qnil = 0x08 , RUBY_Qundef = 0x34 , RUBY_IMMEDIATE_MASK = 0x07 , RUBY_FIXNUM_FLAG = 0x01 , RUBY_FLONUM_MASK = 0x03 , RUBY_FLONUM_FLAG = 0x02 , RUBY_SYMBOL_FLAG = 0x0c , RUBY_SPECIAL_SHIFT = 8 , 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_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 82 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 180 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(), rb_num2ulong_inline(), and rb_type().
|
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 221 of file special_consts.h.
Referenced by rb_class_of(), RB_FLOAT_TYPE_P(), and rb_type().
|
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 244 of file special_consts.h.
Referenced by RB_SPECIAL_CONST_P().
|
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 162 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 260 of file special_consts.h.
Referenced by RB_BUILTIN_TYPE(), rb_class_of(), RB_DYNAMIC_SYM_P(), RB_FL_ABLE(), RB_FLOAT_TYPE_P(), rb_integer_type_p(), rb_ractor_shareable_p(), rb_special_const_p(), rb_type(), 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 280 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 200 of file special_consts.h.
Referenced by rb_class_of(), RB_SYMBOL_P(), and rb_type().
|
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 136 of file special_consts.h.
Referenced by RB_SPECIAL_CONST_P().