Ruby: internal/array.h File Reference

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

Macros | Functions
array.h File Reference

Internal header for Array. More...

`#include "ruby/internal/config.h"`
`#include <stddef.h>`
`#include "internal/static_assert.h"`
`#include "ruby/internal/stdbool.h"`
`#include "ruby/ruby.h"`

Go to the source code of this file.

## Macros
#define | ARRAY_DEBUG (0+RUBY_DEBUG)
#define | RARRAY_PTR_IN_USE_FLAG FL_USER14
#define | rb_ary_new_from_args(n, ...)

## Functions
VALUE | rb_ary_last (int, const VALUE *, VALUE)
void | rb_ary_set_len (VALUE, long)
void | rb_ary_delete_same (VALUE, VALUE)
VALUE | rb_ary_tmp_new_fill (long capa)
VALUE | rb_ary_at (VALUE, VALUE)
size_t | rb_ary_memsize (VALUE)
VALUE | rb_to_array_type (VALUE obj)
void | rb_ary_cancel_sharing (VALUE ary)
void | rb_ary_detransient (VALUE a)
VALUE * | rb_ary_ptr_use_start (VALUE ary)
void | rb_ary_ptr_use_end (VALUE ary)
VALUE | rb_ary_tmp_new_from_values (VALUE, long, const VALUE *)
VALUE | rb_check_to_array (VALUE ary)
VALUE | rb_ary_behead (VALUE, long)
VALUE | rb_ary_aref1 (VALUE ary, VALUE i)
VALUE | rb_ec_ary_new_from_values (struct rb_execution_context_struct *ec, long n, const VALUE *elts)

## Detailed Description

Internal header for Array.

Author
  Ruby developers ruby-.nosp@m.core.nosp@m.@ruby.nosp@m.-lan.nosp@m.g.org

Copyright
  This file is a part of the programming language Ruby. Permission is hereby granted, to either redistribute and/or modify this file, provided that the conditions mentioned in the file COPYING are met. Consult the file for details.

Definition in file array.h.

## Macro Definition Documentation

## ◆ ARRAY_DEBUG

#define ARRAY_DEBUG (0+RUBY_DEBUG)

Definition at line 19 of file array.h.

## ◆ RARRAY_PTR_IN_USE_FLAG

#define RARRAY_PTR_IN_USE_FLAG FL_USER14

Definition at line 22 of file array.h.

## ◆ rb_ary_new_from_args

#define rb_ary_new_from_args | ( |  | n,
|  |  | ...
| ) |  |

Value:
__extension__ ({ \
const VALUE args_to_new_ary[] = {__VA_ARGS__}; \
if (__builtin_constant_p(n)) { \
STATIC_ASSERT(rb_ary_new_from_args, numberof(args_to_new_ary) == (n)); \
} \
rb_ary_new_from_values(numberof(args_to_new_ary), args_to_new_ary); \
})
numberof
#define numberof(array)
Definition: etc.c:649
rb_ary_new_from_args
#define rb_ary_new_from_args(n,...)
Definition: array.h:98
VALUE
unsigned long VALUE
Definition: value.h:38

Definition at line 98 of file array.h.

## Function Documentation

## ◆ rb_ary_aref1()

VALUE rb_ary_aref1 | ( | VALUE | ary,
|  | VALUE | i
| ) |  |

Definition at line 1823 of file array.c.

References FIX2LONG, FIXNUM_P, len, NUM2LONG, Qfalse, Qnil, RARRAY_LEN, rb_arithmetic_sequence_beg_len_step(), rb_ary_entry(), and rb_ary_subseq_step().

Referenced by rb_ary_aref().

## ◆ rb_ary_at()

VALUE rb_ary_at | ( | VALUE | ary,
|  | VALUE | pos
| ) |  |

Definition at line 1855 of file array.c.

References NUM2LONG, and rb_ary_entry().

Referenced by Init_Array(), and rb_obj_dig().

## ◆ rb_ary_behead()

VALUE rb_ary_behead | ( | VALUE | ary,
|  | long | n
| ) |  |

Definition at line 1521 of file array.c.

References ARY_DEFAULT_SIZE, ARY_SHARED_P, and RARRAY_LEN.

## ◆ rb_ary_cancel_sharing()

void rb_ary_cancel_sharing | ( | VALUE | ary | ) |

Definition at line 565 of file array.c.

References ARY_EMBED_PTR, ARY_HEAP_PTR, ARY_SET_CAPA, ARY_SET_EMBED_LEN, ARY_SET_PTR, ARY_SHARED_P, ARY_SHARED_ROOT, ARY_SHARED_ROOT_OCCUPIED, ary_verify, FL_SET_EMBED, FL_UNSET_SHARED, len, MEMCPY, MEMMOVE, ptr, RARRAY_CONST_PTR_TRANSIENT, RARRAY_EMBED_LEN_MAX, RARRAY_LEN, RARRAY_PTR_USE_TRANSIENT, and rb_gc_writebarrier_remember().

Referenced by rb_ary_modify().

## ◆ rb_ary_delete_same()

void rb_ary_delete_same | ( | VALUE | ary,
|  | VALUE | item
| ) |  |

Definition at line 3987 of file array.c.

References select_bang_arg::ary, RARRAY_AREF, RARRAY_LEN, and rb_ary_store().

## ◆ rb_ary_detransient()

void rb_ary_detransient | ( | VALUE | a | ) |

Definition at line 432 of file array.c.

## ◆ rb_ary_last()

VALUE rb_ary_last | ( | int | argc,
|  | const VALUE * | argv,
|  | VALUE | ary
| ) |  |

Definition at line 1932 of file array.c.

References argc, argv, ARY_TAKE_LAST, len, Qnil, RARRAY_AREF, and RARRAY_LEN.

Referenced by Init_Array(), and rb_gc_register_mark_object().

## ◆ rb_ary_memsize()

size_t rb_ary_memsize | ( | VALUE | ary | ) |

Definition at line 894 of file array.c.

References ARY_CAPA, and ARY_OWNS_HEAP_P.

## ◆ rb_ary_ptr_use_end()

void rb_ary_ptr_use_end | ( | VALUE | ary | ) |

Definition at line 252 of file array.c.

References FL_UNSET_RAW, and RARRAY_PTR_IN_USE_FLAG.

## ◆ rb_ary_ptr_use_start()

VALUE * rb_ary_ptr_use_start | ( | VALUE | ary | ) |

Definition at line 243 of file array.c.

References FL_SET_RAW, RARRAY_CONST_PTR_TRANSIENT, and RARRAY_PTR_IN_USE_FLAG.

## ◆ rb_ary_set_len()

void rb_ary_set_len | ( | VALUE | ary,
|  | long | len
| ) |  |

Definition at line 2212 of file array.c.

References ARY_CAPA, ARY_SET_LEN, ARY_SHARED_P, len, rb_bug(), rb_eRuntimeError, and rb_raise().

Referenced by rb_hash_keys(), and rb_hash_values().

## ◆ rb_ary_tmp_new_fill()

VALUE rb_ary_tmp_new_fill | ( | long | capa | ) |

Definition at line 854 of file array.c.

References ARY_SET_LEN, Qnil, rb_ary_transient_heap_evacuate, and TRUE.

Referenced by rb_default_coverage().

## ◆ rb_ary_tmp_new_from_values()

VALUE rb_ary_tmp_new_from_values | ( | VALUE | klass,
|  | long | n,
|  | const VALUE * | elts
| ) |  |

Definition at line 774 of file array.c.

References ARY_SET_LEN.

Referenced by rb_ary_new_from_values().

## ◆ rb_check_to_array()

VALUE rb_check_to_array | ( | VALUE | ary | ) |

Definition at line 994 of file array.c.

References rb_check_convert_type_with_id(), and T_ARRAY.

Referenced by rb_Array().

## ◆ rb_ec_ary_new_from_values()

VALUE rb_ec_ary_new_from_values | ( | struct rb_execution_context_struct * | ec,
|  | long | n,
|  | const VALUE * | elts
| ) |  |

Definition at line 832 of file array.c.

References ARY_SET_LEN, and rb_cArray.

## ◆ rb_to_array_type()

VALUE rb_to_array_type | ( | VALUE | obj | ) |

Definition at line 981 of file array.c.

References rb_convert_type_with_id(), and T_ARRAY.