Ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a25176072e02db9254f0e0c84c805cd)
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
st.h File Reference
#include "ruby/defines.h"

Go to the source code of this file.

Data Structures

struct  st_hash_type
 
struct  st_table
 

Macros

#define ST_DATA_T_DEFINED
 
#define CHAR_BIT   8
 
#define MAX_ST_INDEX_VAL   (~(st_index_t) 0)
 
#define SIZEOF_ST_INDEX_T   SIZEOF_VOIDP
 
#define ST_INDEX_BITS   (SIZEOF_ST_INDEX_T * CHAR_BIT)
 
#define ST_DATA_COMPATIBLE_P(type)   0
 
#define st_is_member(table, key)   st_lookup((table),(key),(st_data_t *)0)
 
#define st_init_table   rb_st_init_table
 
#define st_init_table_with_size   rb_st_init_table_with_size
 
#define st_init_numtable   rb_st_init_numtable
 
#define st_init_numtable_with_size   rb_st_init_numtable_with_size
 
#define st_init_strtable   rb_st_init_strtable
 
#define st_init_strtable_with_size   rb_st_init_strtable_with_size
 
#define st_init_strcasetable   rb_st_init_strcasetable
 
#define st_init_strcasetable_with_size   rb_st_init_strcasetable_with_size
 
#define st_delete   rb_st_delete
 
#define st_delete_safe   rb_st_delete_safe
 
#define st_shift   rb_st_shift
 
#define st_insert   rb_st_insert
 
#define st_insert2   rb_st_insert2
 
#define st_lookup   rb_st_lookup
 
#define st_get_key   rb_st_get_key
 
#define st_update   rb_st_update
 
#define st_foreach_with_replace   rb_st_foreach_with_replace
 
#define st_foreach   rb_st_foreach
 
#define st_foreach_check   rb_st_foreach_check
 
#define st_keys   rb_st_keys
 
#define st_keys_check   rb_st_keys_check
 
#define st_values   rb_st_values
 
#define st_values_check   rb_st_values_check
 
#define st_add_direct   rb_st_add_direct
 
#define st_free_table   rb_st_free_table
 
#define st_cleanup_safe   rb_st_cleanup_safe
 
#define st_clear   rb_st_clear
 
#define st_copy   rb_st_copy
 
#define st_numcmp   rb_st_numcmp
 
#define st_numhash   rb_st_numhash
 
#define st_locale_insensitive_strcasecmp   rb_st_locale_insensitive_strcasecmp
 
#define st_locale_insensitive_strncasecmp   rb_st_locale_insensitive_strncasecmp
 
#define st_strcasecmp   rb_st_locale_insensitive_strcasecmp
 
#define st_strncasecmp   rb_st_locale_insensitive_strncasecmp
 
#define st_memsize   rb_st_memsize
 
#define st_hash   rb_st_hash
 
#define st_hash_uint32   rb_st_hash_uint32
 
#define st_hash_uint   rb_st_hash_uint
 
#define st_hash_end   rb_st_hash_end
 
#define st_hash_start(h)   ((st_index_t)(h))
 

Typedefs

typedef struct st_table st_table
 
typedef st_data_t st_index_t
 
typedef int st_compare_func(st_data_t, st_data_t)
 
typedef st_index_t st_hash_func(st_data_t)
 
typedef char st_check_for_sizeof_st_index_t[SIZEOF_VOIDP==(int) sizeof(st_index_t) ? 1 :-1]
 
typedef struct st_table_entry st_table_entry
 
typedef int st_update_callback_func(st_data_t *key, st_data_t *value, st_data_t arg, int existing)
 
typedef int st_foreach_callback_func(st_data_t, st_data_t, st_data_t)
 
typedef int st_foreach_check_callback_func(st_data_t, st_data_t, st_data_t, int)
 

Enumerations

enum  st_retval {
  ST_CONTINUE , ST_STOP , ST_DELETE , ST_CHECK ,
  ST_REPLACE , ST_CONTINUE , ST_STOP , ST_DELETE ,
  ST_CHECK , ST_REPLACE
}
 

Functions

st_tablerb_st_init_table (const struct st_hash_type *)
 
st_tablerb_st_init_table_with_size (const struct st_hash_type *, st_index_t)
 
st_tablerb_st_init_numtable (void)
 
st_tablerb_st_init_numtable_with_size (st_index_t)
 
st_tablerb_st_init_strtable (void)
 
st_tablerb_st_init_strtable_with_size (st_index_t)
 
st_tablerb_st_init_strcasetable (void)
 
st_tablerb_st_init_strcasetable_with_size (st_index_t)
 
int rb_st_delete (st_table *, st_data_t *, st_data_t *)
 
int rb_st_delete_safe (st_table *, st_data_t *, st_data_t *, st_data_t)
 
int rb_st_shift (st_table *, st_data_t *, st_data_t *)
 
int rb_st_insert (st_table *, st_data_t, st_data_t)
 
int rb_st_insert2 (st_table *, st_data_t, st_data_t, st_data_t(*)(st_data_t))
 
int rb_st_lookup (st_table *, st_data_t, st_data_t *)
 
int rb_st_get_key (st_table *, st_data_t, st_data_t *)
 
int rb_st_update (st_table *table, st_data_t key, st_update_callback_func *func, st_data_t arg)
 
int rb_st_foreach_with_replace (st_table *tab, st_foreach_check_callback_func *func, st_update_callback_func *replace, st_data_t arg)
 
int rb_st_foreach (st_table *, st_foreach_callback_func *, st_data_t)
 
int rb_st_foreach_check (st_table *, st_foreach_check_callback_func *, st_data_t, st_data_t)
 
st_index_t rb_st_keys (st_table *table, st_data_t *keys, st_index_t size)
 
st_index_t rb_st_keys_check (st_table *table, st_data_t *keys, st_index_t size, st_data_t never)
 
st_index_t rb_st_values (st_table *table, st_data_t *values, st_index_t size)
 
st_index_t rb_st_values_check (st_table *table, st_data_t *values, st_index_t size, st_data_t never)
 
void rb_st_add_direct (st_table *, st_data_t, st_data_t)
 
void rb_st_free_table (st_table *)
 
void rb_st_cleanup_safe (st_table *, st_data_t)
 
void rb_st_clear (st_table *)
 
st_tablerb_st_copy (st_table *)
 
 CONSTFUNC (int rb_st_numcmp(st_data_t, st_data_t))
 
 CONSTFUNC (st_index_t rb_st_numhash(st_data_t))
 
 PUREFUNC (int rb_st_locale_insensitive_strcasecmp(const char *s1, const char *s2))
 
 PUREFUNC (int rb_st_locale_insensitive_strncasecmp(const char *s1, const char *s2, size_t n))
 
 PUREFUNC (size_t rb_st_memsize(const st_table *))
 
 PUREFUNC (st_index_t rb_st_hash(const void *ptr, size_t len, st_index_t h))
 
 CONSTFUNC (st_index_t rb_st_hash_uint32(st_index_t h, uint32_t i))
 
 CONSTFUNC (st_index_t rb_st_hash_uint(st_index_t h, st_index_t i))
 
 CONSTFUNC (st_index_t rb_st_hash_end(st_index_t h))
 
void rb_hash_bulk_insert_into_st_table (long, const VALUE *, VALUE)
 

Variables

RUBY_SYMBOL_EXPORT_BEGIN typedef unsigned long st_data_t
 

Macro Definition Documentation

◆ CHAR_BIT

#define CHAR_BIT   8

Definition at line 34 of file st.h.

◆ MAX_ST_INDEX_VAL

#define MAX_ST_INDEX_VAL   (~(st_index_t) 0)

Definition at line 53 of file st.h.

◆ SIZEOF_ST_INDEX_T

#define SIZEOF_ST_INDEX_T   SIZEOF_VOIDP

Definition at line 59 of file st.h.

◆ st_add_direct

#define st_add_direct   rb_st_add_direct

Definition at line 154 of file st.h.

◆ st_cleanup_safe

#define st_cleanup_safe   rb_st_cleanup_safe

Definition at line 158 of file st.h.

◆ st_clear

#define st_clear   rb_st_clear

Definition at line 160 of file st.h.

◆ st_copy

#define st_copy   rb_st_copy

Definition at line 162 of file st.h.

◆ ST_DATA_COMPATIBLE_P

#define ST_DATA_COMPATIBLE_P (   type)    0

Definition at line 72 of file st.h.

◆ ST_DATA_T_DEFINED

#define ST_DATA_T_DEFINED

Definition at line 28 of file st.h.

◆ st_delete

#define st_delete   rb_st_delete

Definition at line 118 of file st.h.

◆ st_delete_safe

#define st_delete_safe   rb_st_delete_safe

Definition at line 120 of file st.h.

◆ st_foreach

#define st_foreach   rb_st_foreach

Definition at line 142 of file st.h.

◆ st_foreach_check

#define st_foreach_check   rb_st_foreach_check

Definition at line 144 of file st.h.

◆ st_foreach_with_replace

#define st_foreach_with_replace   rb_st_foreach_with_replace

Definition at line 140 of file st.h.

◆ st_free_table

#define st_free_table   rb_st_free_table

Definition at line 156 of file st.h.

◆ st_get_key

#define st_get_key   rb_st_get_key

Definition at line 130 of file st.h.

◆ st_hash

#define st_hash   rb_st_hash

Definition at line 176 of file st.h.

◆ st_hash_end

#define st_hash_end   rb_st_hash_end

Definition at line 182 of file st.h.

◆ st_hash_start

#define st_hash_start (   h)    ((st_index_t)(h))

Definition at line 184 of file st.h.

◆ st_hash_uint

#define st_hash_uint   rb_st_hash_uint

Definition at line 180 of file st.h.

◆ st_hash_uint32

#define st_hash_uint32   rb_st_hash_uint32

Definition at line 178 of file st.h.

◆ ST_INDEX_BITS

#define ST_INDEX_BITS   (SIZEOF_ST_INDEX_T * CHAR_BIT)

Definition at line 66 of file st.h.

◆ st_init_numtable

#define st_init_numtable (   void)    rb_st_init_numtable

Definition at line 106 of file st.h.

◆ st_init_numtable_with_size

#define st_init_numtable_with_size   rb_st_init_numtable_with_size

Definition at line 108 of file st.h.

◆ st_init_strcasetable

#define st_init_strcasetable (   void)    rb_st_init_strcasetable

Definition at line 114 of file st.h.

◆ st_init_strcasetable_with_size

#define st_init_strcasetable_with_size   rb_st_init_strcasetable_with_size

Definition at line 116 of file st.h.

◆ st_init_strtable

#define st_init_strtable (   void)    rb_st_init_strtable

Definition at line 110 of file st.h.

◆ st_init_strtable_with_size

#define st_init_strtable_with_size   rb_st_init_strtable_with_size

Definition at line 112 of file st.h.

◆ st_init_table

#define st_init_table   rb_st_init_table

Definition at line 102 of file st.h.

◆ st_init_table_with_size

#define st_init_table_with_size   rb_st_init_table_with_size

Definition at line 104 of file st.h.

◆ st_insert

#define st_insert   rb_st_insert

Definition at line 124 of file st.h.

◆ st_insert2

#define st_insert2   rb_st_insert2

Definition at line 126 of file st.h.

◆ st_is_member

#define st_is_member (   table,
  key 
)    st_lookup((table),(key),(st_data_t *)0)

Definition at line 97 of file st.h.

◆ st_keys

#define st_keys   rb_st_keys

Definition at line 146 of file st.h.

◆ st_keys_check

#define st_keys_check   rb_st_keys_check

Definition at line 148 of file st.h.

◆ st_locale_insensitive_strcasecmp

#define st_locale_insensitive_strcasecmp   rb_st_locale_insensitive_strcasecmp

Definition at line 168 of file st.h.

◆ st_locale_insensitive_strncasecmp

#define st_locale_insensitive_strncasecmp   rb_st_locale_insensitive_strncasecmp

Definition at line 170 of file st.h.

◆ st_lookup

#define st_lookup   rb_st_lookup

Definition at line 128 of file st.h.

◆ st_memsize

#define st_memsize   rb_st_memsize

Definition at line 174 of file st.h.

◆ st_numcmp

#define st_numcmp   rb_st_numcmp

Definition at line 164 of file st.h.

◆ st_numhash

#define st_numhash   rb_st_numhash

Definition at line 166 of file st.h.

◆ st_shift

#define st_shift   rb_st_shift

Definition at line 122 of file st.h.

◆ st_strcasecmp

#define st_strcasecmp   rb_st_locale_insensitive_strcasecmp

Definition at line 171 of file st.h.

◆ st_strncasecmp

#define st_strncasecmp   rb_st_locale_insensitive_strncasecmp

Definition at line 172 of file st.h.

◆ st_update

#define st_update   rb_st_update

Definition at line 136 of file st.h.

◆ st_values

#define st_values   rb_st_values

Definition at line 150 of file st.h.

◆ st_values_check

#define st_values_check   rb_st_values_check

Definition at line 152 of file st.h.

Typedef Documentation

◆ st_check_for_sizeof_st_index_t

typedef char st_check_for_sizeof_st_index_t[SIZEOF_VOIDP==(int) sizeof(st_index_t) ? 1 :-1]

Definition at line 58 of file st.h.

◆ st_compare_func

typedef int st_compare_func(st_data_t, st_data_t)

Definition at line 55 of file st.h.

◆ st_foreach_callback_func

typedef int st_foreach_callback_func(st_data_t, st_data_t, st_data_t)

Definition at line 137 of file st.h.

◆ st_foreach_check_callback_func

typedef int st_foreach_check_callback_func(st_data_t, st_data_t, st_data_t, int)

Definition at line 138 of file st.h.

◆ st_hash_func

typedef st_index_t st_hash_func(st_data_t)

Definition at line 56 of file st.h.

◆ st_index_t

Definition at line 50 of file st.h.

◆ st_table

typedef struct st_table st_table

Definition at line 48 of file st.h.

◆ st_table_entry

Definition at line 75 of file st.h.

◆ st_update_callback_func

typedef int st_update_callback_func(st_data_t *key, st_data_t *value, st_data_t arg, int existing)

Definition at line 131 of file st.h.

Enumeration Type Documentation

◆ st_retval

enum st_retval
Enumerator
ST_CONTINUE 
ST_STOP 
ST_DELETE 
ST_CHECK 
ST_REPLACE 
ST_CONTINUE 
ST_STOP 
ST_DELETE 
ST_CHECK 
ST_REPLACE 

Definition at line 99 of file st.h.

Function Documentation

◆ CONSTFUNC() [1/5]

CONSTFUNC ( int   rb_st_numcmpst_data_t, st_data_t)

◆ CONSTFUNC() [2/5]

CONSTFUNC ( st_index_t   rb_st_hash_endst_index_t h)

◆ CONSTFUNC() [3/5]

CONSTFUNC ( st_index_t   rb_st_hash_uintst_index_t h, st_index_t i)

◆ CONSTFUNC() [4/5]

CONSTFUNC ( st_index_t   rb_st_hash_uint32st_index_t h, uint32_t i)

◆ CONSTFUNC() [5/5]

CONSTFUNC ( st_index_t   rb_st_numhashst_data_t)

◆ PUREFUNC() [1/4]

PUREFUNC ( int   rb_st_locale_insensitive_strcasecmpconst char *s1, const char *s2)

◆ PUREFUNC() [2/4]

PUREFUNC ( int   rb_st_locale_insensitive_strncasecmpconst char *s1, const char *s2, size_t n)

◆ PUREFUNC() [3/4]

PUREFUNC ( size_t   rb_st_memsizeconst st_table *)

◆ PUREFUNC() [4/4]

PUREFUNC ( st_index_t   rb_st_hashconst void *ptr, size_t len, st_index_t h)

◆ rb_hash_bulk_insert_into_st_table()

void rb_hash_bulk_insert_into_st_table ( long  argc,
const VALUE argv,
VALUE  hash 
)

Definition at line 2379 of file st.c.

◆ rb_st_add_direct()

void rb_st_add_direct ( st_table ,
st_data_t  ,
st_data_t   
)

◆ rb_st_cleanup_safe()

void rb_st_cleanup_safe ( st_table ,
st_data_t   
)

◆ rb_st_clear()

void rb_st_clear ( st_table )

◆ rb_st_copy()

st_table * rb_st_copy ( st_table )

◆ rb_st_delete()

int rb_st_delete ( st_table ,
st_data_t ,
st_data_t  
)

◆ rb_st_delete_safe()

int rb_st_delete_safe ( st_table ,
st_data_t ,
st_data_t ,
st_data_t   
)

◆ rb_st_foreach()

int rb_st_foreach ( st_table ,
st_foreach_callback_func ,
st_data_t   
)

◆ rb_st_foreach_check()

int rb_st_foreach_check ( st_table ,
st_foreach_check_callback_func ,
st_data_t  ,
st_data_t   
)

◆ rb_st_foreach_with_replace()

int rb_st_foreach_with_replace ( st_table tab,
st_foreach_check_callback_func func,
st_update_callback_func replace,
st_data_t  arg 
)

◆ rb_st_free_table()

void rb_st_free_table ( st_table )

◆ rb_st_get_key()

int rb_st_get_key ( st_table ,
st_data_t  ,
st_data_t  
)

◆ rb_st_init_numtable()

st_table * rb_st_init_numtable ( void  )

◆ rb_st_init_numtable_with_size()

st_table * rb_st_init_numtable_with_size ( st_index_t  )

◆ rb_st_init_strcasetable()

st_table * rb_st_init_strcasetable ( void  )

◆ rb_st_init_strcasetable_with_size()

st_table * rb_st_init_strcasetable_with_size ( st_index_t  )

◆ rb_st_init_strtable()

st_table * rb_st_init_strtable ( void  )

◆ rb_st_init_strtable_with_size()

st_table * rb_st_init_strtable_with_size ( st_index_t  )

◆ rb_st_init_table()

st_table * rb_st_init_table ( const struct st_hash_type )

◆ rb_st_init_table_with_size()

st_table * rb_st_init_table_with_size ( const struct st_hash_type ,
st_index_t   
)

◆ rb_st_insert()

int rb_st_insert ( st_table ,
st_data_t  ,
st_data_t   
)

◆ rb_st_insert2()

int rb_st_insert2 ( st_table ,
st_data_t  ,
st_data_t  ,
st_data_t(*)(st_data_t  
)

◆ rb_st_keys()

st_index_t rb_st_keys ( st_table table,
st_data_t keys,
st_index_t  size 
)

◆ rb_st_keys_check()

st_index_t rb_st_keys_check ( st_table table,
st_data_t keys,
st_index_t  size,
st_data_t  never 
)

◆ rb_st_lookup()

int rb_st_lookup ( st_table ,
st_data_t  ,
st_data_t  
)

◆ rb_st_shift()

int rb_st_shift ( st_table ,
st_data_t ,
st_data_t  
)

◆ rb_st_update()

int rb_st_update ( st_table table,
st_data_t  key,
st_update_callback_func func,
st_data_t  arg 
)

◆ rb_st_values()

st_index_t rb_st_values ( st_table table,
st_data_t values,
st_index_t  size 
)

◆ rb_st_values_check()

st_index_t rb_st_values_check ( st_table table,
st_data_t values,
st_index_t  size,
st_data_t  never 
)

Variable Documentation

◆ st_data_t

Definition at line 22 of file st.h.