Ruby  2.5.0dev(2017-10-22revision60238)
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_strcasecmp   st_locale_insensitive_strcasecmp
 
#define st_strncasecmp   st_locale_insensitive_strncasecmp
 
#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)
 

Enumerations

enum  st_retval { ST_CONTINUE, ST_STOP, ST_DELETE, ST_CHECK }
 

Functions

st_tablest_init_table (const struct st_hash_type *)
 
st_tablest_init_table_with_size (const struct st_hash_type *, st_index_t)
 
st_tablest_init_numtable (void)
 
st_tablest_init_numtable_with_size (st_index_t)
 
st_tablest_init_strtable (void)
 
st_tablest_init_strtable_with_size (st_index_t)
 
st_tablest_init_strcasetable (void)
 
st_tablest_init_strcasetable_with_size (st_index_t)
 
int st_delete (st_table *, st_data_t *, st_data_t *)
 
int st_delete_safe (st_table *, st_data_t *, st_data_t *, st_data_t)
 
int st_shift (st_table *, st_data_t *, st_data_t *)
 
int st_insert (st_table *, st_data_t, st_data_t)
 
int st_insert2 (st_table *, st_data_t, st_data_t, st_data_t(*)(st_data_t))
 
int st_lookup (st_table *, st_data_t, st_data_t *)
 
int st_get_key (st_table *, st_data_t, st_data_t *)
 
int st_update (st_table *table, st_data_t key, st_update_callback_func *func, st_data_t arg)
 
int st_foreach (st_table *, int(*)(ANYARGS), st_data_t)
 
int st_foreach_check (st_table *, int(*)(ANYARGS), st_data_t, st_data_t)
 
st_index_t st_keys (st_table *table, st_data_t *keys, st_index_t size)
 
st_index_t st_keys_check (st_table *table, st_data_t *keys, st_index_t size, st_data_t never)
 
st_index_t st_values (st_table *table, st_data_t *values, st_index_t size)
 
st_index_t st_values_check (st_table *table, st_data_t *values, st_index_t size, st_data_t never)
 
void st_add_direct (st_table *, st_data_t, st_data_t)
 
void st_free_table (st_table *)
 
void st_cleanup_safe (st_table *, st_data_t)
 
void st_clear (st_table *)
 
st_tablest_copy (st_table *)
 
 CONSTFUNC (int st_numcmp(st_data_t, st_data_t))
 
 CONSTFUNC (st_index_t st_numhash(st_data_t))
 
 PUREFUNC (int st_locale_insensitive_strcasecmp(const char *s1, const char *s2))
 
 PUREFUNC (int st_locale_insensitive_strncasecmp(const char *s1, const char *s2, size_t n))
 
 PUREFUNC (size_t st_memsize(const st_table *))
 
 PUREFUNC (st_index_t st_hash(const void *ptr, size_t len, st_index_t h))
 
 CONSTFUNC (st_index_t st_hash_uint32(st_index_t h, uint32_t i))
 
 CONSTFUNC (st_index_t st_hash_uint(st_index_t h, st_index_t i))
 
 CONSTFUNC (st_index_t st_hash_end(st_index_t h))
 

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.

Referenced by st_hash().

◆ ST_DATA_COMPATIBLE_P

#define ST_DATA_COMPATIBLE_P (   type)    0

Definition at line 72 of file st.h.

Referenced by rb_hash_keys(), and rb_hash_values().

◆ ST_DATA_T_DEFINED

#define ST_DATA_T_DEFINED

Definition at line 28 of file st.h.

◆ st_hash_start

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

Definition at line 144 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_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_strcasecmp

#define st_strcasecmp   st_locale_insensitive_strcasecmp

Definition at line 136 of file st.h.

◆ st_strncasecmp

#define st_strncasecmp   st_locale_insensitive_strncasecmp

Definition at line 137 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_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 116 of file st.h.

Enumeration Type Documentation

◆ st_retval

enum st_retval
Enumerator
ST_CONTINUE 
ST_STOP 
ST_DELETE 
ST_CHECK 

Definition at line 99 of file st.h.

Function Documentation

◆ CONSTFUNC() [1/5]

CONSTFUNC ( int   st_numcmpst_data_t, st_data_t)

◆ CONSTFUNC() [2/5]

CONSTFUNC ( st_index_t   st_numhashst_data_t)

◆ CONSTFUNC() [3/5]

CONSTFUNC ( st_index_t   st_hash_uint32st_index_t h, uint32_t i)

◆ CONSTFUNC() [4/5]

CONSTFUNC ( st_index_t   st_hash_uintst_index_t h, st_index_t i)

◆ CONSTFUNC() [5/5]

CONSTFUNC ( st_index_t   st_hash_endst_index_t h)

◆ PUREFUNC() [1/4]

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

◆ PUREFUNC() [2/4]

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

◆ PUREFUNC() [3/4]

PUREFUNC ( size_t   st_memsizeconst st_table *)

◆ PUREFUNC() [4/4]

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

◆ st_add_direct()

void st_add_direct ( st_table ,
st_data_t  ,
st_data_t   
)

Definition at line 1173 of file st.c.

◆ st_cleanup_safe()

void st_cleanup_safe ( st_table ,
st_data_t   
)

◆ st_clear()

void st_clear ( st_table )

Definition at line 655 of file st.c.

◆ st_copy()

st_table* st_copy ( st_table )

Definition at line 1237 of file st.c.

References st_table::bins, malloc, and NULL.

◆ st_delete()

int st_delete ( st_table ,
st_data_t ,
st_data_t  
)

Definition at line 1313 of file st.c.

◆ st_delete_safe()

int st_delete_safe ( st_table ,
st_data_t ,
st_data_t ,
st_data_t   
)

◆ st_foreach()

int st_foreach ( st_table ,
int(*)(ANYARGS ,
st_data_t   
)

Definition at line 1554 of file st.c.

◆ st_foreach_check()

int st_foreach_check ( st_table ,
int(*)(ANYARGS ,
st_data_t  ,
st_data_t   
)

Referenced by st_foreach_safe().

◆ st_free_table()

void st_free_table ( st_table )

Definition at line 666 of file st.c.

References st_table::bins, st_table::entries, free, and NULL.

◆ st_get_key()

int st_get_key ( st_table ,
st_data_t  ,
st_data_t  
)

Definition at line 1062 of file st.c.

◆ st_init_numtable()

st_table* st_init_numtable ( void  )

Definition at line 610 of file st.c.

References st_init_table(), and type_numhash.

◆ st_init_numtable_with_size()

st_table* st_init_numtable_with_size ( st_index_t  )

Definition at line 617 of file st.c.

References st_init_table_with_size(), and type_numhash.

◆ st_init_strcasetable()

st_table* st_init_strcasetable ( void  )

Definition at line 640 of file st.c.

References st_init_table().

Referenced by Init_transcode().

◆ st_init_strcasetable_with_size()

st_table* st_init_strcasetable_with_size ( st_index_t  )

Definition at line 648 of file st.c.

References st_init_table_with_size().

◆ st_init_strtable()

st_table* st_init_strtable ( void  )

Definition at line 625 of file st.c.

References st_init_table().

◆ st_init_strtable_with_size()

st_table* st_init_strtable_with_size ( st_index_t  )

Definition at line 632 of file st.c.

References st_init_table_with_size().

◆ st_init_table()

st_table* st_init_table ( const struct st_hash_type )

Definition at line 602 of file st.c.

References st_init_table_with_size().

Referenced by st_init_numtable(), st_init_strcasetable(), and st_init_strtable().

◆ st_init_table_with_size()

st_table* st_init_table_with_size ( const struct st_hash_type ,
st_index_t   
)

◆ st_insert()

int st_insert ( st_table ,
st_data_t  ,
st_data_t   
)

Definition at line 1098 of file st.c.

References bin.

◆ st_insert2()

int st_insert2 ( st_table ,
st_data_t  ,
st_data_t  ,
st_data_t(*)(st_data_t  
)

Definition at line 1185 of file st.c.

References bin.

◆ st_keys()

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

Definition at line 1592 of file st.c.

Referenced by rb_hash_keys().

◆ st_keys_check()

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

Definition at line 1599 of file st.c.

◆ st_lookup()

int st_lookup ( st_table ,
st_data_t  ,
st_data_t  
)

Definition at line 1038 of file st.c.

References bin, and st_table_entry::hash.

◆ st_shift()

int st_shift ( st_table ,
st_data_t ,
st_data_t  
)

◆ st_update()

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

Definition at line 1393 of file st.c.

References bin, st_table_entry::hash, NULL, and st_data_t.

◆ st_values()

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

Definition at line 1630 of file st.c.

Referenced by rb_hash_values().

◆ st_values_check()

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

Definition at line 1637 of file st.c.

Variable Documentation

◆ st_data_t

RUBY_SYMBOL_EXPORT_BEGIN typedef unsigned long st_data_t