Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

Data Structures | Macros | Enumerations | Functions | Variables
struct.c File Reference
`#include "internal.h"`
`#include "vm_core.h"`
`#include "id.h"`
`#include "transient_heap.h"`

Go to the source code of this file.

## Data Structures
struct | struct_hash_set_arg

## Macros
#define | N_REF_FUNC numberof(ref_func)

## Enumerations
enum | { AREF_HASH_UNIT = 5, AREF_HASH_THRESHOLD = 10 }

## Functions
const rb_iseq_t * | rb_method_for_self_aref (VALUE name, VALUE arg, rb_insn_func_t func)
const rb_iseq_t * | rb_method_for_self_aset (VALUE name, VALUE arg, rb_insn_func_t func)
VALUE | rb_struct_s_keyword_init (VALUE klass)
VALUE | rb_struct_s_members (VALUE klass)
VALUE | rb_struct_members (VALUE s)
VALUE | rb_struct_getmember (VALUE obj, ID id)
VALUE | rb_struct_alloc_noinit (VALUE klass)
VALUE | rb_struct_define_without_accessor_under (VALUE outer, const char *class_name, VALUE super, rb_alloc_func_t alloc,...)
VALUE | rb_struct_define_without_accessor (const char *class_name, VALUE super, rb_alloc_func_t alloc,...)
VALUE | rb_struct_define (const char *name,...)
VALUE | rb_struct_define_under (VALUE outer, const char *name,...)
VALUE | rb_struct_initialize (VALUE self, VALUE values)
void | rb_struct_transient_heap_evacuate (VALUE obj, int promote)
VALUE | rb_struct_alloc (VALUE klass, VALUE values)
VALUE | rb_struct_new (VALUE klass,...)
VALUE | rb_struct_init_copy (VALUE copy, VALUE s)
| NORETURN (static void invalid_struct_pos(VALUE s, VALUE idx))
VALUE | rb_struct_aref (VALUE s, VALUE idx)
VALUE | rb_struct_aset (VALUE s, VALUE idx, VALUE val)
| FUNC_MINIMIZED (VALUE rb_struct_lookup(VALUE s, VALUE idx))
| NOINLINE (static VALUE rb_struct_lookup_default(VALUE s, VALUE idx, VALUE notfound))
VALUE | rb_struct_lookup (VALUE s, VALUE idx)
VALUE | rb_struct_size (VALUE s)
void | InitVM_Struct (void)
void | Init_Struct (void)

## Variables
VALUE | rb_cStruct

## Macro Definition Documentation

## ◆ N_REF_FUNC

#define N_REF_FUNC numberof(ref_func)

Definition at line 234 of file struct.c.

## Enumeration Type Documentation

## ◆ anonymous enum

anonymous enum

Enumerator
AREF_HASH_UNIT |
AREF_HASH_THRESHOLD |

Definition at line 18 of file struct.c.

## Function Documentation

## ◆ FUNC_MINIMIZED()

FUNC_MINIMIZED | ( | VALUE | rb_struct_lookupVALUE s, VALUE idx | ) |

## ◆ Init_Struct()

void Init_Struct | ( | void |  | ) |

Definition at line 1393 of file struct.c.

## ◆ InitVM_Struct()

void InitVM_Struct | ( | void |  | ) |

Definition at line 1353 of file struct.c.

References rb_cObject, rb_cStruct, rb_define_class(), rb_define_singleton_method(), rb_include_module(), rb_mEnumerable, and rb_undef_alloc_func().

## ◆ NOINLINE()

NOINLINE | ( | static VALUE | rb_struct_lookup_defaultVALUE s, VALUE idx, VALUE notfound | ) |

## ◆ NORETURN()

NORETURN | ( | static void | invalid_struct_posVALUE s, VALUE idx | ) |

## ◆ rb_method_for_self_aref()

const rb_iseq_t* rb_method_for_self_aref | ( | VALUE | name,
|  | VALUE | arg,
|  | rb_insn_func_t | func
| ) |  |

Definition at line 9476 of file compile.c.

## ◆ rb_method_for_self_aset()

const rb_iseq_t* rb_method_for_self_aset | ( | VALUE | name,
|  | VALUE | arg,
|  | rb_insn_func_t | func
| ) |  |

Definition at line 9485 of file compile.c.

## ◆ rb_struct_alloc()

VALUE rb_struct_alloc | ( | VALUE | klass,
|  | VALUE | values
| ) |  |

Definition at line 727 of file struct.c.

References klass, RARRAY_CONST_PTR, RARRAY_LENINT, and rb_class_new_instance().

## ◆ rb_struct_alloc_noinit()

VALUE rb_struct_alloc_noinit | ( | VALUE | klass | ) |

Definition at line 352 of file struct.c.

## ◆ rb_struct_aref()

VALUE rb_struct_aref | ( | VALUE | s,
|  | VALUE | idx
| ) |  |

Definition at line 1064 of file struct.c.

References i.

Referenced by rb_vm_opt_struct_aref().

## ◆ rb_struct_aset()

VALUE rb_struct_aset | ( | VALUE | s,
|  | VALUE | idx,
|  | VALUE | val
| ) |  |

Definition at line 1091 of file struct.c.

References i.

Referenced by rb_vm_opt_struct_aset().

## ◆ rb_struct_define()

VALUE rb_struct_define | ( | const char * | name,
|  |  | ...
| ) |  |

Definition at line 434 of file struct.c.

References RString::ary, name, st, and va_start.

## ◆ rb_struct_define_under()

VALUE rb_struct_define_under | ( | VALUE | outer,
|  | const char * | name,
|  |  | ...
| ) |  |

Definition at line 449 of file struct.c.

References RString::ary, name, and va_start.

## ◆ rb_struct_define_without_accessor()

VALUE rb_struct_define_without_accessor | ( | const char * | class_name,
|  | VALUE | super,
|  | rb_alloc_func_t | alloc,
|  |  | ...
| ) |  |

Definition at line 421 of file struct.c.

References va_start.

## ◆ rb_struct_define_without_accessor_under()

VALUE rb_struct_define_without_accessor_under | ( | VALUE | outer,
|  | const char * | class_name,
|  | VALUE | super,
|  | rb_alloc_func_t | alloc,
|  |  | ...
| ) |  |

Definition at line 408 of file struct.c.

References va_start.

## ◆ rb_struct_getmember()

VALUE rb_struct_getmember | ( | VALUE | obj,
|  | ID | id
| ) |  |

Definition at line 211 of file struct.c.

References i, and ID2SYM.

## ◆ rb_struct_init_copy()

VALUE rb_struct_init_copy | ( | VALUE | copy,
|  | VALUE | s
| ) |  |

Definition at line 977 of file struct.c.

References i, len, OBJ_INIT_COPY, rb_eTypeError, rb_raise(), RSTRUCT_GET, RSTRUCT_LEN, and RSTRUCT_SET.

## ◆ rb_struct_initialize()

VALUE rb_struct_initialize | ( | VALUE | self,
|  | VALUE | values
| ) |  |

Definition at line 662 of file struct.c.

## ◆ rb_struct_lookup()

VALUE rb_struct_lookup | ( | VALUE | s,
|  | VALUE | idx
| ) |  |

Definition at line 1104 of file struct.c.

## ◆ rb_struct_members()

VALUE rb_struct_members | ( | VALUE | s | ) |

Definition at line 72 of file struct.c.

References RARRAY_LEN, rb_eTypeError, rb_obj_class(), rb_raise(), rb_struct_s_members(), and RSTRUCT_LEN.

## ◆ rb_struct_new()

VALUE rb_struct_new | ( | VALUE | klass,
|  |  | ...
| ) |  |

Definition at line 733 of file struct.c.

References i, N_REF_FUNC, rb_long2int, and size.

## ◆ rb_struct_s_keyword_init()

VALUE rb_struct_s_keyword_init | ( | VALUE | klass | ) |

Definition at line 52 of file struct.c.

## ◆ rb_struct_s_members()

VALUE rb_struct_s_members | ( | VALUE | klass | ) |

Definition at line 58 of file struct.c.

Referenced by rb_struct_members().

## ◆ rb_struct_size()

VALUE rb_struct_size | ( | VALUE | s | ) |

Definition at line 1294 of file struct.c.

References LONG2FIX, and RSTRUCT_LEN.

## ◆ rb_struct_transient_heap_evacuate()

void rb_struct_transient_heap_evacuate | ( | VALUE | obj,
|  | int | promote
| ) |  |

Definition at line 684 of file struct.c.

References obj, and RSTRUCT_TRANSIENT_P.