1#ifndef INTERNAL_STRUCT_H
2#define INTERNAL_STRUCT_H
12#include "internal/gc.h"
29 const VALUE ary[RSTRUCT_EMBED_LEN_MAX];
33#define RSTRUCT(obj) ((struct RStruct *)(obj))
51#define RSTRUCT_LEN internal_RSTRUCT_LEN
52#define RSTRUCT_SET internal_RSTRUCT_SET
53#define RSTRUCT_GET internal_RSTRUCT_GET
56VALUE rb_struct_init_copy(VALUE copy, VALUE s);
57VALUE rb_struct_lookup(VALUE s, VALUE idx);
58VALUE rb_struct_s_keyword_init(VALUE klass);
59static inline const VALUE *rb_struct_const_heap_ptr(VALUE st);
60static inline bool RSTRUCT_TRANSIENT_P(VALUE st);
61static inline void RSTRUCT_TRANSIENT_SET(VALUE st);
62static inline void RSTRUCT_TRANSIENT_UNSET(VALUE st);
63static inline long RSTRUCT_EMBED_LEN(VALUE st);
65static inline int RSTRUCT_LENINT(VALUE st);
66static inline const VALUE *RSTRUCT_CONST_PTR(VALUE st);
67static inline void RSTRUCT_SET(VALUE st,
long k, VALUE v);
71RSTRUCT_TRANSIENT_P(VALUE st)
81RSTRUCT_TRANSIENT_SET(VALUE st)
89RSTRUCT_TRANSIENT_UNSET(VALUE st)
97RSTRUCT_EMBED_LEN(VALUE st)
100 ret >>= RSTRUCT_EMBED_LEN_SHIFT;
108 return RSTRUCT_EMBED_LEN(st);
111 return RSTRUCT(st)->as.heap.len;
116RSTRUCT_LENINT(VALUE st)
121static inline const VALUE *
122RSTRUCT_CONST_PTR(VALUE st)
124 const struct RStruct *p = RSTRUCT(st);
130 return p->as.heap.ptr;
143 return RSTRUCT_CONST_PTR(st)[k];
146static inline const VALUE *
147rb_struct_const_heap_ptr(VALUE st)
150 return RSTRUCT(st)->as.heap.ptr;
@ RUBY_FL_USHIFT
Number of bits in ruby_fl_type that are not open to users.
@ RUBY_FL_USER2
User-defined flag.
@ RUBY_FL_USER1
User-defined flag.
#define FL_UNSET_RAW
Old name of RB_FL_UNSET_RAW.
#define FL_USER3
Old name of RUBY_FL_USER3.
#define FL_TEST_RAW
Old name of RB_FL_TEST_RAW.
#define FL_SET_RAW
Old name of RB_FL_SET_RAW.
#define RB_OBJ_WRITE(old, slot, young)
Declaration of a "back" pointer.
#define rb_long2int
Just another name of rb_long2int_inline.
@ RVALUE_EMBED_LEN_MAX
Max possible number of objects that can be embedded.
static long RSTRUCT_LEN(VALUE st)
Returns the number of struct members.
static VALUE RSTRUCT_SET(VALUE st, int k, VALUE v)
Resembles Struct#[]=.
static VALUE RSTRUCT_GET(VALUE st, int k)
Resembles Struct#[].
Ruby's object's, base components.