Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../opt/alt/ruby27/include/ruby
File: st.h
/* This is a public domain general purpose hash table package
[0] Fix | Delete
originally written by Peter Moore @ UCB.
[1] Fix | Delete
[2] Fix | Delete
The hash table data strutures were redesigned and the package was
[3] Fix | Delete
rewritten by Vladimir Makarov <vmakarov@redhat.com>. */
[4] Fix | Delete
[5] Fix | Delete
#ifndef RUBY_ST_H
[6] Fix | Delete
#define RUBY_ST_H 1
[7] Fix | Delete
[8] Fix | Delete
#if defined(__cplusplus)
[9] Fix | Delete
extern "C" {
[10] Fix | Delete
#if 0
[11] Fix | Delete
} /* satisfy cc-mode */
[12] Fix | Delete
#endif
[13] Fix | Delete
#endif
[14] Fix | Delete
[15] Fix | Delete
#include "ruby/defines.h"
[16] Fix | Delete
[17] Fix | Delete
RUBY_SYMBOL_EXPORT_BEGIN
[18] Fix | Delete
[19] Fix | Delete
#if SIZEOF_LONG == SIZEOF_VOIDP
[20] Fix | Delete
typedef unsigned long st_data_t;
[21] Fix | Delete
#elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
[22] Fix | Delete
typedef unsigned LONG_LONG st_data_t;
[23] Fix | Delete
#else
[24] Fix | Delete
# error ---->> st.c requires sizeof(void*) == sizeof(long) or sizeof(LONG_LONG) to be compiled. <<----
[25] Fix | Delete
#endif
[26] Fix | Delete
#define ST_DATA_T_DEFINED
[27] Fix | Delete
[28] Fix | Delete
#ifndef CHAR_BIT
[29] Fix | Delete
# ifdef HAVE_LIMITS_H
[30] Fix | Delete
# include <limits.h>
[31] Fix | Delete
# else
[32] Fix | Delete
# define CHAR_BIT 8
[33] Fix | Delete
# endif
[34] Fix | Delete
#endif
[35] Fix | Delete
#ifndef _
[36] Fix | Delete
# define _(args) args
[37] Fix | Delete
#endif
[38] Fix | Delete
#ifndef ANYARGS
[39] Fix | Delete
# ifdef __cplusplus
[40] Fix | Delete
# define ANYARGS ...
[41] Fix | Delete
# else
[42] Fix | Delete
# define ANYARGS
[43] Fix | Delete
# endif
[44] Fix | Delete
#endif
[45] Fix | Delete
[46] Fix | Delete
typedef struct st_table st_table;
[47] Fix | Delete
[48] Fix | Delete
typedef st_data_t st_index_t;
[49] Fix | Delete
[50] Fix | Delete
/* Maximal value of unsigned integer type st_index_t. */
[51] Fix | Delete
#define MAX_ST_INDEX_VAL (~(st_index_t) 0)
[52] Fix | Delete
[53] Fix | Delete
typedef int st_compare_func(st_data_t, st_data_t);
[54] Fix | Delete
typedef st_index_t st_hash_func(st_data_t);
[55] Fix | Delete
[56] Fix | Delete
typedef char st_check_for_sizeof_st_index_t[SIZEOF_VOIDP == (int)sizeof(st_index_t) ? 1 : -1];
[57] Fix | Delete
#define SIZEOF_ST_INDEX_T SIZEOF_VOIDP
[58] Fix | Delete
[59] Fix | Delete
struct st_hash_type {
[60] Fix | Delete
int (*compare)(st_data_t, st_data_t); /* st_compare_func* */
[61] Fix | Delete
st_index_t (*hash)(st_data_t); /* st_hash_func* */
[62] Fix | Delete
};
[63] Fix | Delete
[64] Fix | Delete
#define ST_INDEX_BITS (SIZEOF_ST_INDEX_T * CHAR_BIT)
[65] Fix | Delete
[66] Fix | Delete
#if defined(HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR) && defined(HAVE_BUILTIN___BUILTIN_TYPES_COMPATIBLE_P)
[67] Fix | Delete
# define ST_DATA_COMPATIBLE_P(type) \
[68] Fix | Delete
__builtin_choose_expr(__builtin_types_compatible_p(type, st_data_t), 1, 0)
[69] Fix | Delete
#else
[70] Fix | Delete
# define ST_DATA_COMPATIBLE_P(type) 0
[71] Fix | Delete
#endif
[72] Fix | Delete
[73] Fix | Delete
typedef struct st_table_entry st_table_entry;
[74] Fix | Delete
[75] Fix | Delete
struct st_table_entry; /* defined in st.c */
[76] Fix | Delete
[77] Fix | Delete
struct st_table {
[78] Fix | Delete
/* Cached features of the table -- see st.c for more details. */
[79] Fix | Delete
unsigned char entry_power, bin_power, size_ind;
[80] Fix | Delete
/* How many times the table was rebuilt. */
[81] Fix | Delete
unsigned int rebuilds_num;
[82] Fix | Delete
const struct st_hash_type *type;
[83] Fix | Delete
/* Number of entries currently in the table. */
[84] Fix | Delete
st_index_t num_entries;
[85] Fix | Delete
/* Array of bins used for access by keys. */
[86] Fix | Delete
st_index_t *bins;
[87] Fix | Delete
/* Start and bound index of entries in array entries.
[88] Fix | Delete
entries_starts and entries_bound are in interval
[89] Fix | Delete
[0,allocated_entries]. */
[90] Fix | Delete
st_index_t entries_start, entries_bound;
[91] Fix | Delete
/* Array of size 2^entry_power. */
[92] Fix | Delete
st_table_entry *entries;
[93] Fix | Delete
};
[94] Fix | Delete
[95] Fix | Delete
#define st_is_member(table,key) st_lookup((table),(key),(st_data_t *)0)
[96] Fix | Delete
[97] Fix | Delete
enum st_retval {ST_CONTINUE, ST_STOP, ST_DELETE, ST_CHECK, ST_REPLACE};
[98] Fix | Delete
[99] Fix | Delete
st_table *rb_st_init_table(const struct st_hash_type *);
[100] Fix | Delete
#define st_init_table rb_st_init_table
[101] Fix | Delete
st_table *rb_st_init_table_with_size(const struct st_hash_type *, st_index_t);
[102] Fix | Delete
#define st_init_table_with_size rb_st_init_table_with_size
[103] Fix | Delete
st_table *rb_st_init_numtable(void);
[104] Fix | Delete
#define st_init_numtable rb_st_init_numtable
[105] Fix | Delete
st_table *rb_st_init_numtable_with_size(st_index_t);
[106] Fix | Delete
#define st_init_numtable_with_size rb_st_init_numtable_with_size
[107] Fix | Delete
st_table *rb_st_init_strtable(void);
[108] Fix | Delete
#define st_init_strtable rb_st_init_strtable
[109] Fix | Delete
st_table *rb_st_init_strtable_with_size(st_index_t);
[110] Fix | Delete
#define st_init_strtable_with_size rb_st_init_strtable_with_size
[111] Fix | Delete
st_table *rb_st_init_strcasetable(void);
[112] Fix | Delete
#define st_init_strcasetable rb_st_init_strcasetable
[113] Fix | Delete
st_table *rb_st_init_strcasetable_with_size(st_index_t);
[114] Fix | Delete
#define st_init_strcasetable_with_size rb_st_init_strcasetable_with_size
[115] Fix | Delete
int rb_st_delete(st_table *, st_data_t *, st_data_t *); /* returns 0:notfound 1:deleted */
[116] Fix | Delete
#define st_delete rb_st_delete
[117] Fix | Delete
int rb_st_delete_safe(st_table *, st_data_t *, st_data_t *, st_data_t);
[118] Fix | Delete
#define st_delete_safe rb_st_delete_safe
[119] Fix | Delete
int rb_st_shift(st_table *, st_data_t *, st_data_t *); /* returns 0:notfound 1:deleted */
[120] Fix | Delete
#define st_shift rb_st_shift
[121] Fix | Delete
int rb_st_insert(st_table *, st_data_t, st_data_t);
[122] Fix | Delete
#define st_insert rb_st_insert
[123] Fix | Delete
int rb_st_insert2(st_table *, st_data_t, st_data_t, st_data_t (*)(st_data_t));
[124] Fix | Delete
#define st_insert2 rb_st_insert2
[125] Fix | Delete
int rb_st_lookup(st_table *, st_data_t, st_data_t *);
[126] Fix | Delete
#define st_lookup rb_st_lookup
[127] Fix | Delete
int rb_st_get_key(st_table *, st_data_t, st_data_t *);
[128] Fix | Delete
#define st_get_key rb_st_get_key
[129] Fix | Delete
typedef int st_update_callback_func(st_data_t *key, st_data_t *value, st_data_t arg, int existing);
[130] Fix | Delete
/* *key may be altered, but must equal to the old key, i.e., the
[131] Fix | Delete
* results of hash() are same and compare() returns 0, otherwise the
[132] Fix | Delete
* behavior is undefined */
[133] Fix | Delete
int rb_st_update(st_table *table, st_data_t key, st_update_callback_func *func, st_data_t arg);
[134] Fix | Delete
#define st_update rb_st_update
[135] Fix | Delete
typedef int st_foreach_callback_func(st_data_t, st_data_t, st_data_t);
[136] Fix | Delete
typedef int st_foreach_check_callback_func(st_data_t, st_data_t, st_data_t, int);
[137] Fix | Delete
int rb_st_foreach_with_replace(st_table *tab, st_foreach_check_callback_func *func, st_update_callback_func *replace, st_data_t arg);
[138] Fix | Delete
#define st_foreach_with_replace rb_st_foreach_with_replace
[139] Fix | Delete
int rb_st_foreach(st_table *, st_foreach_callback_func *, st_data_t);
[140] Fix | Delete
#define st_foreach rb_st_foreach
[141] Fix | Delete
int rb_st_foreach_check(st_table *, st_foreach_check_callback_func *, st_data_t, st_data_t);
[142] Fix | Delete
#define st_foreach_check rb_st_foreach_check
[143] Fix | Delete
st_index_t rb_st_keys(st_table *table, st_data_t *keys, st_index_t size);
[144] Fix | Delete
#define st_keys rb_st_keys
[145] Fix | Delete
st_index_t rb_st_keys_check(st_table *table, st_data_t *keys, st_index_t size, st_data_t never);
[146] Fix | Delete
#define st_keys_check rb_st_keys_check
[147] Fix | Delete
st_index_t rb_st_values(st_table *table, st_data_t *values, st_index_t size);
[148] Fix | Delete
#define st_values rb_st_values
[149] Fix | Delete
st_index_t rb_st_values_check(st_table *table, st_data_t *values, st_index_t size, st_data_t never);
[150] Fix | Delete
#define st_values_check rb_st_values_check
[151] Fix | Delete
void rb_st_add_direct(st_table *, st_data_t, st_data_t);
[152] Fix | Delete
#define st_add_direct rb_st_add_direct
[153] Fix | Delete
void rb_st_free_table(st_table *);
[154] Fix | Delete
#define st_free_table rb_st_free_table
[155] Fix | Delete
void rb_st_cleanup_safe(st_table *, st_data_t);
[156] Fix | Delete
#define st_cleanup_safe rb_st_cleanup_safe
[157] Fix | Delete
void rb_st_clear(st_table *);
[158] Fix | Delete
#define st_clear rb_st_clear
[159] Fix | Delete
st_table *rb_st_copy(st_table *);
[160] Fix | Delete
#define st_copy rb_st_copy
[161] Fix | Delete
CONSTFUNC(int rb_st_numcmp(st_data_t, st_data_t));
[162] Fix | Delete
#define st_numcmp rb_st_numcmp
[163] Fix | Delete
CONSTFUNC(st_index_t rb_st_numhash(st_data_t));
[164] Fix | Delete
#define st_numhash rb_st_numhash
[165] Fix | Delete
PUREFUNC(int rb_st_locale_insensitive_strcasecmp(const char *s1, const char *s2));
[166] Fix | Delete
#define st_locale_insensitive_strcasecmp rb_st_locale_insensitive_strcasecmp
[167] Fix | Delete
PUREFUNC(int rb_st_locale_insensitive_strncasecmp(const char *s1, const char *s2, size_t n));
[168] Fix | Delete
#define st_locale_insensitive_strncasecmp rb_st_locale_insensitive_strncasecmp
[169] Fix | Delete
#define st_strcasecmp rb_st_locale_insensitive_strcasecmp
[170] Fix | Delete
#define st_strncasecmp rb_st_locale_insensitive_strncasecmp
[171] Fix | Delete
PUREFUNC(size_t rb_st_memsize(const st_table *));
[172] Fix | Delete
#define st_memsize rb_st_memsize
[173] Fix | Delete
PUREFUNC(st_index_t rb_st_hash(const void *ptr, size_t len, st_index_t h));
[174] Fix | Delete
#define st_hash rb_st_hash
[175] Fix | Delete
CONSTFUNC(st_index_t rb_st_hash_uint32(st_index_t h, uint32_t i));
[176] Fix | Delete
#define st_hash_uint32 rb_st_hash_uint32
[177] Fix | Delete
CONSTFUNC(st_index_t rb_st_hash_uint(st_index_t h, st_index_t i));
[178] Fix | Delete
#define st_hash_uint rb_st_hash_uint
[179] Fix | Delete
CONSTFUNC(st_index_t rb_st_hash_end(st_index_t h));
[180] Fix | Delete
#define st_hash_end rb_st_hash_end
[181] Fix | Delete
CONSTFUNC(st_index_t rb_st_hash_start(st_index_t h));
[182] Fix | Delete
#define st_hash_start(h) ((st_index_t)(h))
[183] Fix | Delete
[184] Fix | Delete
void rb_hash_bulk_insert_into_st_table(long, const VALUE *, VALUE);
[185] Fix | Delete
[186] Fix | Delete
RUBY_SYMBOL_EXPORT_END
[187] Fix | Delete
[188] Fix | Delete
#if defined(__cplusplus)
[189] Fix | Delete
#if 0
[190] Fix | Delete
{ /* satisfy cc-mode */
[191] Fix | Delete
#endif
[192] Fix | Delete
} /* extern "C" { */
[193] Fix | Delete
#endif
[194] Fix | Delete
[195] Fix | Delete
#endif /* RUBY_ST_H */
[196] Fix | Delete
[197] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function