About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

array.h File Reference
#include "common.h"
Include dependency graph for array.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


struct  mrb_shared_array
struct  RArray


#define MRB_ARY_EMBED_LEN_MAX   ((mrb_int)(sizeof(void*)*3/sizeof(mrb_value)))
#define mrb_ary_ptr(v)   ((struct RArray*)(mrb_ptr(v)))
#define mrb_ary_value(p)   mrb_obj_value((void*)(p))
#define RARRAY(v)   ((struct RArray*)(mrb_ptr(v)))
#define MRB_ARY_EMBED_MASK   7
#define ARY_EMBED_P(a)   ((a)->flags & MRB_ARY_EMBED_MASK)
#define ARY_UNSET_EMBED_FLAG(a)   ((a)->flags &= ~(MRB_ARY_EMBED_MASK))
#define ARY_EMBED_LEN(a)   ((mrb_int)(((a)->flags & MRB_ARY_EMBED_MASK) - 1))
#define ARY_SET_EMBED_LEN(a, len)   ((a)->flags = ((a)->flags&~MRB_ARY_EMBED_MASK) | ((uint32_t)(len) + 1))
#define ARY_EMBED_PTR(a)   ((a)->as.ary)
#define ARY_LEN(a)   (ARY_EMBED_P(a)?ARY_EMBED_LEN(a):(a)->as.heap.len)
#define ARY_PTR(a)   (ARY_EMBED_P(a)?ARY_EMBED_PTR(a):(a)->as.heap.ptr)
#define RARRAY_LEN(a)   ARY_LEN(RARRAY(a))
#define RARRAY_PTR(a)   ARY_PTR(RARRAY(a))
#define ARY_SET_LEN(a, n)
#define ARY_CAPA(a)   (ARY_EMBED_P(a)?MRB_ARY_EMBED_LEN_MAX:(a)->as.heap.aux.capa)
#define MRB_ARY_SHARED   256
#define ARY_SHARED_P(a)   ((a)->flags & MRB_ARY_SHARED)
#define ARY_SET_SHARED_FLAG(a)   ((a)->flags |= MRB_ARY_SHARED)
#define ARY_UNSET_SHARED_FLAG(a)   ((a)->flags &= ~MRB_ARY_SHARED)


typedef struct mrb_shared_array mrb_shared_array


 mrb_static_assert (((mrb_int)(sizeof(void *) *3/sizeof(mrb_value))) > 0, "MRB_ARY_EMBED_LEN_MAX > 0")
void mrb_ary_decref (mrb_state *, mrb_shared_array *)
void mrb_ary_modify (mrb_state *, struct RArray *)
mrb_value mrb_ary_new_capa (mrb_state *, mrb_int)
mrb_value mrb_ary_new (mrb_state *mrb)
mrb_value mrb_ary_new_from_values (mrb_state *mrb, mrb_int size, const mrb_value *vals)
mrb_value mrb_assoc_new (mrb_state *mrb, mrb_value car, mrb_value cdr)
void mrb_ary_concat (mrb_state *mrb, mrb_value self, mrb_value other)
mrb_value mrb_ary_splat (mrb_state *mrb, mrb_value value)
void mrb_ary_push (mrb_state *mrb, mrb_value array, mrb_value value)
mrb_value mrb_ary_pop (mrb_state *mrb, mrb_value ary)
mrb_value mrb_ary_ref (mrb_state *mrb, mrb_value ary, mrb_int n)
void mrb_ary_set (mrb_state *mrb, mrb_value ary, mrb_int n, mrb_value val)
void mrb_ary_replace (mrb_state *mrb, mrb_value self, mrb_value other)
mrb_value mrb_ensure_array_type (mrb_state *mrb, mrb_value self)
mrb_value mrb_check_array_type (mrb_state *mrb, mrb_value self)
mrb_value mrb_ary_unshift (mrb_state *mrb, mrb_value self, mrb_value item)
mrb_value mrb_ary_entry (mrb_value ary, mrb_int offset)
mrb_value mrb_ary_splice (mrb_state *mrb, mrb_value self, mrb_int head, mrb_int len, mrb_value rpl)
mrb_value mrb_ary_shift (mrb_state *mrb, mrb_value self)
mrb_value mrb_ary_clear (mrb_state *mrb, mrb_value self)
mrb_value mrb_ary_join (mrb_state *mrb, mrb_value ary, mrb_value sep)
mrb_value mrb_ary_resize (mrb_state *mrb, mrb_value ary, mrb_int new_len)
mrb_value mrb_ary_subseq (mrb_state *mrb, mrb_value ary, mrb_int beg, mrb_int len)

Detailed Description

See Copyright Notice in mruby.h

Definition in file array.h.

Macro Definition Documentation


#define ARY_CAPA (   a)    (ARY_EMBED_P(a)?MRB_ARY_EMBED_LEN_MAX:(a)->as.heap.aux.capa)

Definition at line 80 of file array.h.


#define ARY_EMBED_LEN (   a)    ((mrb_int)(((a)->flags & MRB_ARY_EMBED_MASK) - 1))

Definition at line 63 of file array.h.


#define ARY_EMBED_P (   a)    ((a)->flags & MRB_ARY_EMBED_MASK)

Definition at line 61 of file array.h.


#define ARY_EMBED_PTR (   a)    ((a)->as.ary)

Definition at line 65 of file array.h.


#define ARY_LEN (   a)    (ARY_EMBED_P(a)?ARY_EMBED_LEN(a):(a)->as.heap.len)

Definition at line 68 of file array.h.


#define ARY_PTR (   a)    (ARY_EMBED_P(a)?ARY_EMBED_PTR(a):(a)->as.heap.ptr)

Definition at line 69 of file array.h.


#define ARY_SET_EMBED_LEN (   a,
)    ((a)->flags = ((a)->flags&~MRB_ARY_EMBED_MASK) | ((uint32_t)(len) + 1))

Definition at line 64 of file array.h.


#define ARY_SET_LEN (   a,
do {\
if (ARY_EMBED_P(a)) {\
mrb_assert((n) <= MRB_ARY_EMBED_LEN_MAX); \
(a)->as.heap.len = (n);\
} while (0)
#define n
Definition: t4ht.c:1290
#define a(n)
Definition: gpos-common.c:148
char * as
Definition: fixwrites.c:8
Definition: array.h:28
#define ARY_EMBED_P(a)
Definition: array.h:61

Definition at line 72 of file array.h.


#define ARY_SET_SHARED_FLAG (   a)    ((a)->flags |= MRB_ARY_SHARED)

Definition at line 83 of file array.h.


#define ARY_SHARED_P (   a)    ((a)->flags & MRB_ARY_SHARED)

Definition at line 82 of file array.h.


#define ARY_UNSET_EMBED_FLAG (   a)    ((a)->flags &= ~(MRB_ARY_EMBED_MASK))

Definition at line 62 of file array.h.


#define ARY_UNSET_SHARED_FLAG (   a)    ((a)->flags &= ~MRB_ARY_SHARED)

Definition at line 84 of file array.h.


#define MRB_ARY_EMBED_LEN_MAX   ((mrb_int)(sizeof(void*)*3/sizeof(mrb_value)))

Definition at line 28 of file array.h.


#define MRB_ARY_EMBED_MASK   7

Definition at line 60 of file array.h.

◆ mrb_ary_ptr

#define mrb_ary_ptr (   v)    ((struct RArray*)(mrb_ptr(v)))

Definition at line 49 of file array.h.


#define MRB_ARY_SHARED   256

Definition at line 81 of file array.h.

◆ mrb_ary_value

#define mrb_ary_value (   p)    mrb_obj_value((void*)(p))

Definition at line 50 of file array.h.


#define RARRAY (   v)    ((struct RArray*)(mrb_ptr(v)))

Definition at line 51 of file array.h.


#define RARRAY_LEN (   a)    ARY_LEN(RARRAY(a))

Definition at line 70 of file array.h.


#define RARRAY_PTR (   a)    ARY_PTR(RARRAY(a))

Definition at line 71 of file array.h.

Typedef Documentation

◆ mrb_shared_array

Function Documentation

◆ mrb_ary_clear()

◆ mrb_ary_concat()

void mrb_ary_concat ( mrb_state mrb,
mrb_value  self,
mrb_value  other 

Definition at line 321 of file array.c.

References a2, ary_concat(), mrb_ary_ptr, and other.

Referenced by mrb_ary_concat_m(), and mrb_vm_exec().

◆ mrb_ary_decref()

void mrb_ary_decref ( mrb_state mrb,
mrb_shared_array shared 

◆ mrb_ary_entry()

mrb_value mrb_ary_entry ( mrb_value  ary,
mrb_int  offset 

Definition at line 1153 of file array.c.

References RArray::ary, mrb_nil_value(), offset, RARRAY_LEN, and RARRAY_PTR.

Referenced by mrb_ary_at(), and mrb_obj_ceqq().

◆ mrb_ary_join()

mrb_value mrb_ary_join ( mrb_state mrb,
mrb_value  ary,
mrb_value  sep 

Definition at line 1222 of file array.c.

References RArray::ary, join_ary(), mrb_ary_new(), mrb_nil_p, mrb_obj_as_string(), and sep.

Referenced by mrb_ary_join_m().

◆ mrb_ary_modify()

void mrb_ary_modify ( mrb_state mrb,
struct RArray a 

Definition at line 160 of file array.c.

References a, ary_modify(), and mrb_write_barrier().

Referenced by mrb_ary_shuffle_bang(), mrb_ary_slice_bang(), and mrb_gc_unregister().

◆ mrb_ary_new()

◆ mrb_ary_new_capa()

◆ mrb_ary_new_from_values()

◆ mrb_ary_pop()

mrb_value mrb_ary_pop ( mrb_state mrb,
mrb_value  ary 

◆ mrb_ary_push()

◆ mrb_ary_ref()

mrb_value mrb_ary_ref ( mrb_state mrb,
mrb_value  ary,
mrb_int  n 

Definition at line 657 of file array.c.

References a, RArray::ary, ARY_LEN, ARY_PTR, len, mrb_ary_ptr, mrb_nil_value(), and n.

Referenced by mrb_ary_aget(), mrb_ary_values_at(), mrb_pack_pack(), and mrb_vm_exec().

◆ mrb_ary_replace()

void mrb_ary_replace ( mrb_state mrb,
mrb_value  self,
mrb_value  other 

Definition at line 403 of file array.c.

References a1, a2, ary_replace(), mrb_ary_ptr, and other.

Referenced by mrb_ary_replace_m(), mrb_struct_init_copy(), and mrb_struct_s_members_m().

◆ mrb_ary_resize()

mrb_value mrb_ary_resize ( mrb_state mrb,
mrb_value  ary,
mrb_int  new_len 

◆ mrb_ary_set()

◆ mrb_ary_shift()

mrb_value mrb_ary_shift ( mrb_state mrb,
mrb_value  self 

◆ mrb_ary_splat()

◆ mrb_ary_splice()

◆ mrb_ary_subseq()

mrb_value mrb_ary_subseq ( mrb_state mrb,
mrb_value  ary,
mrb_int  beg,
mrb_int  len 

Definition at line 817 of file array.c.

References a, RArray::ary, ary_subseq(), len, and mrb_ary_ptr.

Referenced by mrb_f_send().

◆ mrb_ary_unshift()

◆ mrb_assoc_new()

mrb_value mrb_assoc_new ( mrb_state mrb,
mrb_value  car,
mrb_value  cdr 

◆ mrb_check_array_type()

mrb_value mrb_check_array_type ( mrb_state mrb,
mrb_value  self 

Definition at line 632 of file object.c.

References mrb_array_p, and mrb_nil_value().

Referenced by join_ary(), and mrb_ary_assoc().

◆ mrb_ensure_array_type()

mrb_value mrb_ensure_array_type ( mrb_state mrb,
mrb_value  self 

Definition at line 623 of file object.c.

References E_TYPE_ERROR, mrb_array_p, and mrb_raisef().

Referenced by mrb_ary_splat(), and mrb_obj_ceqq().

◆ mrb_static_assert()

mrb_static_assert ( ((mrb_int)(sizeof(void *) *3/sizeof(mrb_value)))  ,

Referenced by mrb_init_gc(), and mrb_init_string().