|
Ruby 4.1.0dev (2026-11-16 revision 67814cf9b0f3a4bad6f7369b0c8e6fc69220de64)
|
Defines struct RArray. More...
#include "ruby/internal/arithmetic/len_t.h"#include "ruby/internal/attr/artificial.h"#include "ruby/internal/attr/constexpr.h"#include "ruby/internal/attr/maybe_unused.h"#include "ruby/internal/attr/pure.h"#include "ruby/internal/cast.h"#include "ruby/internal/core/rbasic.h"#include "ruby/internal/dllexport.h"#include "ruby/internal/fl_type.h"#include "ruby/internal/gc.h"#include "ruby/internal/stdbool.h"#include "ruby/internal/value.h"#include "ruby/internal/value_type.h"#include "ruby/assert.h"

Go to the source code of this file.
Data Structures | |
| struct | RArray |
| Ruby's array. More... | |
Macros | |
| #define | RARRAY(obj) |
| Convenient casting macro. | |
| #define | RARRAY_LEN rb_array_len |
| Just another name of rb_array_len. | |
| #define | RARRAY_CONST_PTR rb_array_const_ptr |
| Just another name of rb_array_const_ptr. | |
| #define | RBIMPL_RARRAY_STMT(ary, var, expr) |
| This is an implementation detail of RARRAY_PTR_USE. | |
| #define | RARRAY_PTR_USE(ary, ptr_name, expr) |
| Declares a section of code where raw pointers are used. | |
| #define | RARRAY_AREF(a, i) |
| References an object in an array. | |
Enumerations | |
| enum | ruby_rarray_consts { RARRAY_EMBED_LEN_SHIFT = RUBY_FL_USHIFT + 3 } |
| This is an enum because GDB wants it (rather than a macro). More... | |
Functions | |
| static rb_len_t | RARRAY_EMBED_LEN (VALUE ary) |
| Queries the length of the array. | |
| static rb_len_t | rb_array_len (VALUE a) |
| Queries the length of the array. | |
| static int | RARRAY_LENINT (VALUE ary) |
| Identical to rb_array_len(), except it differs for the return type. | |
| static VALUE * | RARRAY_PTR (VALUE ary) |
| Wild use of a C pointer. | |
| static void | RARRAY_ASET (VALUE ary, rb_len_t i, VALUE v) |
| Assigns an object in an array. | |
Defines struct RArray.
Definition in file rarray.h.
| #define RARRAY | ( | obj | ) |
| #define RARRAY_AREF | ( | a, | |
| i ) |
References an object in an array.
| [in] | ary | An object of RArray. |
| [in] | idx | Index to access ary |
Definition at line 421 of file rarray.h.
Referenced by rb_env_clear(), rb_find_file(), rb_find_file_ext(), rb_mod_init_copy(), rb_prepend_module(), rb_tracearg_eval_script(), and rb_tracearg_instruction_sequence().
| #define RARRAY_CONST_PTR rb_array_const_ptr |
Just another name of rb_array_const_ptr.
Definition at line 51 of file rarray.h.
Referenced by RARRAY_PTR(), rb_apply(), rb_eval_cmd_kw(), rb_struct_alloc(), rb_struct_initialize(), rb_yield_splat(), and rb_yield_splat_kw().
| #define RARRAY_LEN rb_array_len |
Just another name of rb_array_len.
Definition at line 50 of file rarray.h.
Referenced by RARRAY_LENINT(), rb_debug_inspector_open(), rb_env_clear(), rb_ext_resolve_symbol(), rb_find_file(), rb_find_file_ext(), rb_Hash(), rb_mod_init_copy(), rb_prepend_module(), rb_proc_call_kw(), and rb_struct_members().
| #define RARRAY_PTR_USE | ( | ary, | |
| ptr_name, | |||
| expr ) |
Declares a section of code where raw pointers are used.
In case you need to touch the raw C array instead of polite CAPIs, then that operation shall be wrapped using this macro.
| ary | An object of RArray. |
| ptr_name | A variable name which points the C array in expr. |
| expr | The expression that touches ptr_name. |
Definition at line 347 of file rarray.h.
Referenced by RARRAY_ASET().
| #define RBIMPL_RARRAY_STMT | ( | ary, | |
| var, | |||
| expr ) |
This is an implementation detail of RARRAY_PTR_USE.
People do not use it directly.
| enum ruby_rarray_consts |
Assigns an object in an array.
| [out] | ary | Destination array object. |
| [in] | i | Index of ary. |
| [in] | v | Arbitrary ruby object. |
Queries the length of the array.
| [in] | ary | Array in question. |
Definition at line 234 of file rarray.h.
Referenced by RARRAY_EMBED_LEN(), and rb_array_len().
|
inlinestatic |
Identical to rb_array_len(), except it differs for the return type.
| [in] | ary | Array in question. |
| rb_eRangeError | Too long. |
Definition at line 280 of file rarray.h.
Referenced by RARRAY_LENINT(), rb_apply(), rb_eval_cmd_kw(), rb_struct_alloc(), rb_struct_initialize(), rb_yield_splat(), and rb_yield_splat_kw().
Wild use of a C pointer.
This function accesses the backend storage directly. This is slower than RARRAY_PTR_USE. It exercises extra manoeuvres to protect our generational GC. Use of this function is considered archaic. Use a modern way instead.
| [in] | ary | An object of RArray. |
Definition at line 365 of file rarray.h.
Referenced by rb_proc_call_kw(), and rb_struct_new().