Ruby  3.1.0dev(2021-09-10revisionb76ad15ed0da636161de0243c547ee1e6fc95681)
Data Structures | Macros | Typedefs | Enumerations | Functions
hash.h File Reference

(b76ad15ed0da636161de0243c547ee1e6fc95681)

Internal header for Hash. More...

#include "ruby/internal/config.h"
#include <stddef.h>
#include "ruby/internal/stdbool.h"
#include "ruby/ruby.h"
#include "ruby/st.h"
Include dependency graph for hash.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  RHash
 

Macros

#define RHASH_AR_TABLE_MAX_SIZE   SIZEOF_VALUE
 
#define RHASH_LEV_MASK
 
#define RHASH(obj)   ((struct RHash *)(obj))
 
#define RHASH_TBL_RAW(h)   rb_hash_tbl_raw(h, __FILE__, __LINE__)
 

Typedefs

typedef unsigned char ar_hint_t
 

Enumerations

enum  ruby_rhash_flags {
  RHASH_PASS_AS_KEYWORDS = FL_USER1, RHASH_PROC_DEFAULT = FL_USER2, RHASH_ST_TABLE_FLAG = FL_USER3, RHASH_AR_TABLE_SIZE_MASK = (FL_USER4|FL_USER5|FL_USER6|FL_USER7),
  RHASH_AR_TABLE_SIZE_SHIFT = (FL_USHIFT+4), RHASH_AR_TABLE_BOUND_MASK = (FL_USER8|FL_USER9|FL_USER10|FL_USER11), RHASH_AR_TABLE_BOUND_SHIFT = (FL_USHIFT+8), RHASH_TRANSIENT_FLAG = FL_USER12,
  RHASH_LEV_SHIFT = (FL_USHIFT + 13), RHASH_LEV_MAX = 127
}
 

Functions

void rb_hash_st_table_set (VALUE hash, st_table *st)
 
VALUE rb_hash_default_value (VALUE hash, VALUE key)
 
VALUE rb_hash_set_default_proc (VALUE hash, VALUE proc)
 
long rb_dbl_long_hash (double d)
 
st_tablerb_init_identtable (void)
 
VALUE rb_to_hash_type (VALUE obj)
 
VALUE rb_hash_key_str (VALUE)
 
VALUE rb_hash_values (VALUE hash)
 
VALUE rb_hash_rehash (VALUE hash)
 
int rb_hash_add_new_element (VALUE hash, VALUE key, VALUE val)
 
VALUE rb_hash_set_pair (VALUE hash, VALUE pair)
 
int rb_hash_stlike_delete (VALUE hash, st_data_t *pkey, st_data_t *pval)
 
int rb_hash_stlike_foreach_with_replace (VALUE hash, st_foreach_check_callback_func *func, st_update_callback_func *replace, st_data_t arg)
 
int rb_hash_stlike_update (VALUE hash, st_data_t key, st_update_callback_func *func, st_data_t arg)
 
st_tablerb_hash_st_table (VALUE hash)
 
VALUE rb_hash_delete_entry (VALUE hash, VALUE key)
 
VALUE rb_ident_hash_new (void)
 
int rb_hash_stlike_foreach (VALUE hash, st_foreach_callback_func *func, st_data_t arg)
 
VALUE rb_hash_new_with_size (st_index_t size)
 
VALUE rb_hash_resurrect (VALUE hash)
 
int rb_hash_stlike_lookup (VALUE hash, st_data_t key, st_data_t *pval)
 
VALUE rb_hash_keys (VALUE hash)
 
VALUE rb_hash_has_key (VALUE hash, VALUE key)
 
VALUE rb_hash_compare_by_id_p (VALUE hash)
 
st_tablerb_hash_tbl_raw (VALUE hash, const char *file, int line)
 

Detailed Description

Internal header for Hash.

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

Definition in file hash.h.

Macro Definition Documentation

◆ RHASH

#define RHASH (   obj)    ((struct RHash *)(obj))

Definition at line 57 of file hash.h.

◆ RHASH_AR_TABLE_MAX_SIZE

#define RHASH_AR_TABLE_MAX_SIZE   SIZEOF_VALUE

Definition at line 18 of file hash.h.

◆ RHASH_LEV_MASK

#define RHASH_LEV_MASK
Value:
(FL_USER13 | FL_USER14 | FL_USER15 | /* FL 13..19 */ \
FL_USER16 | FL_USER17 | FL_USER18 | FL_USER19)

Definition at line 37 of file hash.h.

◆ RHASH_TBL_RAW

#define RHASH_TBL_RAW (   h)    rb_hash_tbl_raw(h, __FILE__, __LINE__)

Definition at line 118 of file hash.h.

Typedef Documentation

◆ ar_hint_t

typedef unsigned char ar_hint_t

Definition at line 20 of file hash.h.

Enumeration Type Documentation

◆ ruby_rhash_flags

Enumerator
RHASH_PASS_AS_KEYWORDS 
RHASH_PROC_DEFAULT 
RHASH_ST_TABLE_FLAG 
RHASH_AR_TABLE_SIZE_MASK 
RHASH_AR_TABLE_SIZE_SHIFT 
RHASH_AR_TABLE_BOUND_MASK 
RHASH_AR_TABLE_BOUND_SHIFT 
RHASH_TRANSIENT_FLAG 
RHASH_LEV_SHIFT 
RHASH_LEV_MAX 

Definition at line 23 of file hash.h.

Function Documentation

◆ rb_dbl_long_hash()

long rb_dbl_long_hash ( double  d)

Definition at line 163 of file hash.c.

References rb_memhash().

Referenced by rb_iseq_cdhash_hash().

◆ rb_hash_add_new_element()

int rb_hash_add_new_element ( VALUE  hash,
VALUE  key,
VALUE  val 
)

Definition at line 4693 of file hash.c.

◆ rb_hash_compare_by_id_p()

VALUE rb_hash_compare_by_id_p ( VALUE  hash)

Definition at line 4396 of file hash.c.

◆ rb_hash_default_value()

VALUE rb_hash_default_value ( VALUE  hash,
VALUE  key 
)

Definition at line 2024 of file hash.c.

◆ rb_hash_delete_entry()

VALUE rb_hash_delete_entry ( VALUE  hash,
VALUE  key 
)

Definition at line 2333 of file hash.c.

◆ rb_hash_has_key()

VALUE rb_hash_has_key ( VALUE  hash,
VALUE  key 
)

Definition at line 3622 of file hash.c.

◆ rb_hash_key_str()

VALUE rb_hash_key_str ( VALUE  )

Definition at line 2843 of file hash.c.

◆ rb_hash_keys()

VALUE rb_hash_keys ( VALUE  hash)

Definition at line 3533 of file hash.c.

◆ rb_hash_new_with_size()

VALUE rb_hash_new_with_size ( st_index_t  size)

Definition at line 1543 of file hash.c.

References rb_hash_new(), ret, RHASH_AR_TABLE_MAX_SIZE, and size.

◆ rb_hash_rehash()

VALUE rb_hash_rehash ( VALUE  hash)

Definition at line 1985 of file hash.c.

◆ rb_hash_resurrect()

VALUE rb_hash_resurrect ( VALUE  hash)

Definition at line 1595 of file hash.c.

◆ rb_hash_set_default_proc()

VALUE rb_hash_set_default_proc ( VALUE  hash,
VALUE  proc 
)

Definition at line 2258 of file hash.c.

◆ rb_hash_set_pair()

VALUE rb_hash_set_pair ( VALUE  hash,
VALUE  pair 
)

Definition at line 3452 of file hash.c.

◆ rb_hash_st_table()

st_table* rb_hash_st_table ( VALUE  hash)

Definition at line 550 of file hash.c.

◆ rb_hash_st_table_set()

void rb_hash_st_table_set ( VALUE  hash,
st_table st 
)

Definition at line 557 of file hash.c.

◆ rb_hash_stlike_delete()

int rb_hash_stlike_delete ( VALUE  hash,
st_data_t pkey,
st_data_t pval 
)

Definition at line 2317 of file hash.c.

◆ rb_hash_stlike_foreach()

int rb_hash_stlike_foreach ( VALUE  hash,
st_foreach_callback_func func,
st_data_t  arg 
)

Definition at line 1440 of file hash.c.

Referenced by rb_execarg_extract_options().

◆ rb_hash_stlike_foreach_with_replace()

int rb_hash_stlike_foreach_with_replace ( VALUE  hash,
st_foreach_check_callback_func func,
st_update_callback_func replace,
st_data_t  arg 
)

Definition at line 1451 of file hash.c.

◆ rb_hash_stlike_lookup()

int rb_hash_stlike_lookup ( VALUE  hash,
st_data_t  key,
st_data_t pval 
)

Definition at line 2051 of file hash.c.

◆ rb_hash_stlike_update()

int rb_hash_stlike_update ( VALUE  hash,
st_data_t  key,
st_update_callback_func func,
st_data_t  arg 
)

Definition at line 1661 of file hash.c.

◆ rb_hash_tbl_raw()

st_table* rb_hash_tbl_raw ( VALUE  hash,
const char *  file,
int  line 
)

Definition at line 1608 of file hash.c.

◆ rb_hash_values()

VALUE rb_hash_values ( VALUE  hash)

Definition at line 3577 of file hash.c.

◆ rb_ident_hash_new()

VALUE rb_ident_hash_new ( void  )

Definition at line 4402 of file hash.c.

Referenced by Init_sym(), rb_ast_add_mark_object(), and rb_uninterruptible().

◆ rb_init_identtable()

st_table* rb_init_identtable ( void  )

Definition at line 4410 of file hash.c.

References identhash, and st_init_table().

◆ rb_to_hash_type()

VALUE rb_to_hash_type ( VALUE  obj)

Definition at line 1878 of file hash.c.

FL_USER18
#define FL_USER18
Definition: fl_type.h:90
FL_USER13
#define FL_USER13
Definition: fl_type.h:85
FL_USER14
#define FL_USER14
Definition: fl_type.h:86
FL_USER17
#define FL_USER17
Definition: fl_type.h:89
FL_USER15
#define FL_USER15
Definition: fl_type.h:87
FL_USER19
#define FL_USER19
Definition: fl_type.h:91