Ruby: include/ruby/internal/intern/array.h Source File

Ruby 3.4.6p54 (2025-09-16 revision dbd83256b1cec76c69756ecb8758b9e1079833de)

array.h
Go to the documentation of this file.
1#ifndef RBIMPL_INTERN_ARRAY_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RBIMPL_INTERN_ARRAY_H
23#include "ruby/internal/attr/noalias.h"
24#include "ruby/internal/attr/noexcept.h"
25#include "ruby/internal/attr/nonnull.h"
26#include "ruby/internal/attr/pure.h"
27#include "ruby/internal/dllexport.h"
28#include "ruby/internal/value.h"
29
30 RBIMPL_SYMBOL_EXPORT_BEGIN()
31
32/* array.c */
33
34 RBIMPL_ATTR_NONNULL(())
35 RBIMPL_ATTR_NOALIAS()
43void rb_mem_clear(VALUE *buf, long len)
44 RBIMPL_ATTR_NOEXCEPT(true)
45 ;
46
56 VALUE rb_assoc_new(VALUE car, VALUE cdr);
57
70 VALUE rb_check_array_type(VALUE obj);
71
77 VALUE rb_ary_new(void);
78
89 VALUE rb_ary_new_capa(long capa);
90
98 VALUE rb_ary_new_from_args(long n, ...);
99
107 VALUE rb_ary_new_from_values(long n, const VALUE *elts);
108
116 VALUE rb_ary_hidden_new(long capa);
117#define rb_ary_tmp_new rb_ary_hidden_new
118
134void rb_ary_free(VALUE ary);
135
145void rb_ary_modify(VALUE ary);
146
154 VALUE rb_ary_freeze(VALUE obj);
155
156 RBIMPL_ATTR_PURE()
172 VALUE rb_ary_shared_with_p(VALUE lhs, VALUE rhs);
173
200 VALUE rb_ary_aref(int argc, const VALUE *argv, VALUE ary);
201
214 VALUE rb_ary_subseq(VALUE ary, long beg, long len);
215
231void rb_ary_store(VALUE ary, long key, VALUE val);
232
244 VALUE rb_ary_dup(VALUE ary);
245
254 VALUE rb_ary_resurrect(VALUE ary);
255
267 VALUE rb_ary_to_ary(VALUE obj);
268
278 VALUE rb_ary_to_s(VALUE ary);
279
291 VALUE rb_ary_cat(VALUE ary, const VALUE *train, long len);
292
302 VALUE rb_ary_push(VALUE ary, VALUE elem);
303
316 VALUE rb_ary_pop(VALUE ary);
317
333 VALUE rb_ary_shift(VALUE ary);
334
346 VALUE rb_ary_unshift(VALUE ary, VALUE elem);
347
348 RBIMPL_ATTR_PURE()
359 VALUE rb_ary_entry(VALUE ary, long off);
360
370 VALUE rb_ary_each(VALUE ary);
371
385 VALUE rb_ary_join(VALUE ary, VALUE sep);
386
396 VALUE rb_ary_reverse(VALUE ary);
397
410 VALUE rb_ary_rotate(VALUE ary, long rot);
411
423 VALUE rb_ary_sort(VALUE ary);
424
437 VALUE rb_ary_sort_bang(VALUE ary);
438
460 VALUE rb_ary_delete(VALUE ary, VALUE elem);
461
475 VALUE rb_ary_delete_at(VALUE ary, long pos);
476
485 VALUE rb_ary_clear(VALUE ary);
486
504 VALUE rb_ary_plus(VALUE lhs, VALUE rhs);
505
517 VALUE rb_ary_concat(VALUE lhs, VALUE rhs);
518
552 VALUE rb_ary_assoc(VALUE alist, VALUE key);
553
564 VALUE rb_ary_rassoc(VALUE alist, VALUE key);
565
582 VALUE rb_ary_includes(VALUE ary, VALUE elem);
583
594 VALUE rb_ary_cmp(VALUE lhs, VALUE rhs);
595
607 VALUE rb_ary_replace(VALUE copy, VALUE orig);
608
636 VALUE rb_get_values_at(VALUE obj, long olen, int argc, const VALUE *argv, VALUE (*func)(VALUE obj, long oidx));
637
655 VALUE rb_ary_resize(VALUE ary, long len);
656
657#define rb_ary_new2 rb_ary_new_capa
658#define rb_ary_new3 rb_ary_new_from_args
659#define rb_ary_new4 rb_ary_new_from_values
660
661 RBIMPL_SYMBOL_EXPORT_END()
662
663#endif /* RBIMPL_INTERN_ARRAY_H */
dllexport.h
Tweaking visibility of C variables/functions.
RBIMPL_SYMBOL_EXPORT_END
#define RBIMPL_SYMBOL_EXPORT_END()
Counterpart of RBIMPL_SYMBOL_EXPORT_BEGIN.
Definition dllexport.h:74
RBIMPL_SYMBOL_EXPORT_BEGIN
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
Definition dllexport.h:65
rb_ary_new_from_values
VALUE rb_ary_new_from_values(long n, const VALUE *elts)
Identical to rb_ary_new_from_args(), except how objects are passed.
Definition array.c:780
rb_ary_free
void rb_ary_free(VALUE ary)
Destroys the given array for no reason.
Definition array.c:869
rb_ary_modify
void rb_ary_modify(VALUE ary)
Declares that the array is about to be modified.
Definition array.c:570
rb_ary_new_capa
VALUE rb_ary_new_capa(long capa)
Identical to rb_ary_new(), except it additionally specifies how many rooms of objects it should alloc...
Definition array.c:735
rb_ary_freeze
VALUE rb_ary_freeze(VALUE obj)
Freeze an array, preventing further modifications.
Definition array.c:642
rb_ary_new_from_args
VALUE rb_ary_new_from_args(long n,...)
Constructs an array from the passed objects.
Definition array.c:747
capa
int capa
Designed capacity of the buffer.
Definition io.h:11
off
int off
Offset inside of ptr.
Definition io.h:5
len
int len
Length of the buffer.
Definition io.h:8
noalias.h
Defines RBIMPL_ATTR_NOALIAS.
RBIMPL_ATTR_NOALIAS
#define RBIMPL_ATTR_NOALIAS()
Wraps (or simulates) __declspec((noalias))
Definition noalias.h:66
noexcept.h
Defines RBIMPL_ATTR_NOEXCEPT.
RBIMPL_ATTR_NOEXCEPT
#define RBIMPL_ATTR_NOEXCEPT(_)
Wraps (or simulates) C++11 noexcept
Definition noexcept.h:85
nonnull.h
Defines RBIMPL_ATTR_NONNULL.
RBIMPL_ATTR_NONNULL
#define RBIMPL_ATTR_NONNULL(list)
Wraps (or simulates) __attribute__((nonnull))
Definition nonnull.h:30
pure.h
Defines RBIMPL_ATTR_PURE.
RBIMPL_ATTR_PURE
#define RBIMPL_ATTR_PURE()
Wraps (or simulates) __attribute__((pure))
Definition pure.h:33
value.h
Defines VALUE and ID.
VALUE
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40