24 # ifdef HAVE_CRT_EXTERNS_H 31 #define HAS_EXTRA_STATES(hash, klass) ( \ 32 ((klass = has_extra_methods(rb_obj_class(hash))) != 0) || \ 33 FL_TEST((hash), FL_EXIVAR|FL_TAINT|HASH_PROC_DEFAULT) || \ 34 !NIL_P(RHASH_IFNONE(hash))) 36 #define SET_DEFAULT(hash, ifnone) ( \ 37 FL_UNSET_RAW(hash, HASH_PROC_DEFAULT), \ 38 RHASH_SET_IFNONE(hash, ifnone)) 40 #define SET_PROC_DEFAULT(hash, proc) set_proc_default(hash, proc) 42 #define COPY_DEFAULT(hash, hash2) copy_default(RHASH(hash), RHASH(hash2)) 45 copy_default(
struct RHash *hash,
const struct RHash *hash2)
53 has_extra_methods(
VALUE klass)
114 hash_recursive(
VALUE obj,
VALUE arg,
int recurse)
116 if (recurse)
return INT2FIX(0);
131 ul &= (1UL << (
sizeof(long)*
CHAR_BIT-1)) - 1;
147 if (d == 0.0) d = 0.0;
148 #if SIZEOF_INT == SIZEOF_VOIDP 193 hnum = other_func(a);
197 return (
long)RSHIFT(hnum, 1);
201 obj_any_hash(
VALUE obj)
210 return any_hash(a, obj_any_hash);
225 #if defined(__GNUC__) && UINT_MAX != ULONG_MAX 226 __uint128_t r = (__uint128_t) m1 * (__uint128_t) m2;
229 uint64_t hm1 = m1 >> 32, hm2 = m2 >> 32;
232 uint64_t v32_96 = hm1 * lm2 + lm1 * hm2;
235 return (v64_128 + (v32_96 >> 32)) ^ ((v32_96 << 32) + v1_32);
242 return mult_and_mix(
key + seed, prime1);
252 objid_hash(
VALUE obj)
260 long hnum = any_hash(obj, objid_hash);
269 #define rb_ident_cmp st_numcmp 308 status = (*arg->
func)(key, value, arg->
arg);
368 hash_foreach_ensure(
VALUE hash)
389 if (!
RHASH(hash)->ntbl)
395 rb_ensure(hash_foreach_call, (
VALUE)&arg, hash_foreach_ensure, hash);
410 hash_alloc(
VALUE klass)
412 return hash_alloc_flags(klass, 0,
Qnil);
416 empty_hash_alloc(
VALUE klass)
420 return hash_alloc(klass);
441 VALUE ret = hash_alloc_flags(klass, flags,
460 rb_hash_modify_check(
VALUE hash)
468 if (!
RHASH(hash)->ntbl) {
471 return RHASH(hash)->ntbl;
478 return hash_tbl(hash);
484 return hash_tbl(hash);
488 rb_hash_modify(
VALUE hash)
490 rb_hash_modify_check(hash);
494 NORETURN(
static void no_new_key(
void));
506 #define NOINSERT_UPDATE_CALLBACK(func) \ 508 func##_noinsert(st_data_t *key, st_data_t *val, st_data_t arg, int existing) \ 510 if (!existing) no_new_key(); \ 511 return func(key, val, (struct update_arg *)arg, existing); \ 515 func##_insert(st_data_t *key, st_data_t *val, st_data_t arg, int existing) \ 517 return func(key, val, (struct update_arg *)arg, existing); \ 537 arg.
arg = optional_arg;
544 result =
st_update(
RHASH(hash)->ntbl, (st_data_t)key, func, (st_data_t)&arg);
548 if (arg.new_value)
RB_OBJ_WRITTEN(hash, arg.old_value, arg.new_value);
553 #define UPDATE_CALLBACK(iter_lev, func) ((iter_lev) > 0 ? func##_noinsert : func##_insert) 555 #define RHASH_UPDATE_ITER(h, iter_lev, key, func, a) do { \ 556 tbl_update((h), (key), UPDATE_CALLBACK((iter_lev), func), (st_data_t)(a)); \ 559 #define RHASH_UPDATE(hash, key, func, arg) \ 560 RHASH_UPDATE_ITER(hash, RHASH_ITER_LEV(hash), key, func, arg) 568 if (n != 2 && (n >= 0 || n < -3)) {
618 rb_hash_modify(hash);
626 ifnone = argc == 0 ?
Qnil : argv[0];
654 rb_hash_s_create(
int argc,
VALUE *argv,
VALUE klass)
659 tmp = rb_hash_s_try_convert(
Qnil, argv[0]);
661 hash = hash_alloc(klass);
662 if (
RHASH(tmp)->ntbl) {
672 hash = hash_alloc(klass);
684 rb_warn(
"wrong element type %s at %ld (expected array)",
686 rb_warn(
"ignoring wrong elements is deprecated, remove them explicitly");
687 rb_warn(
"this causes ArgumentError in the next release");
709 hash = hash_alloc(klass);
739 rb_hash_s_try_convert(
VALUE dummy,
VALUE hash)
754 st_insert(tbl, (st_data_t)key, (st_data_t)value);
787 rb_hash_modify_check(hash);
788 if (!
RHASH(hash)->ntbl)
792 RHASH(tmp)->ntbl = tbl;
796 RHASH(hash)->ntbl = tbl;
797 RHASH(tmp)->ntbl = 0;
888 rb_hash_fetch_m(
int argc,
VALUE *argv,
VALUE hash)
898 if (block_given && argc == 2) {
899 rb_warn(
"block supersedes default value argument");
902 if (block_given)
return rb_yield(key);
919 return rb_hash_fetch_m(1, &key, hash);
944 rb_hash_default(
int argc,
VALUE *argv,
VALUE hash)
946 VALUE args[2], ifnone;
951 if (argc == 0)
return Qnil;
982 rb_hash_modify_check(hash);
1003 rb_hash_default_proc(
VALUE hash)
1029 rb_hash_modify_check(hash);
1037 "wrong default_proc type %s (expected Proc)",
1088 rb_warn(
"Hash#index is deprecated; use Hash#key");
1089 return rb_hash_key(hash, value);
1102 if (!
RHASH(hash)->ntbl) {
1123 if (deleted_value !=
Qundef) {
1124 return deleted_value;
1154 rb_hash_modify_check(hash);
1199 rb_hash_shift(
VALUE hash)
1203 rb_hash_modify_check(hash);
1204 if (
RHASH(hash)->ntbl) {
1256 rb_hash_modify_check(hash);
1257 if (
RHASH(hash)->ntbl)
1277 rb_hash_modify(hash);
1279 if (!n)
return Qnil;
1281 if (n ==
RHASH(hash)->ntbl->num_entries)
return Qnil;
1339 rb_hash_slice(
int argc,
VALUE *argv,
VALUE hash)
1349 for (i = 0; i <
argc; i++) {
1376 for (i=0; i<
argc; i++) {
1404 for (i=0; i<
argc; i++) {
1470 rb_hash_modify_check(hash);
1471 if (!
RHASH(hash)->ntbl)
1473 n =
RHASH(hash)->ntbl->num_entries;
1475 if (n ==
RHASH(hash)->ntbl->num_entries)
return Qnil;
1495 rb_hash_modify_check(hash);
1496 if (
RHASH(hash)->ntbl)
1521 rb_hash_modify_check(hash);
1522 if (!
RHASH(hash)->ntbl)
1524 if (
RHASH(hash)->ntbl->num_entries > 0) {
1535 hash_aset(st_data_t *key, st_data_t *
val,
struct update_arg *arg,
int existing)
1550 fstring_existing_str(
VALUE str)
1569 hash_aset_str(st_data_t *key, st_data_t *val,
struct update_arg *arg,
int existing)
1575 (k = fstring_existing_str(*key)) !=
Qnil) {
1582 return hash_aset(key, val, arg, existing);
1621 rb_hash_modify(hash);
1623 if (iter_lev > 0) no_new_key();
1624 tbl = hash_tbl(hash);
1645 rb_hash_initialize_copy(
VALUE hash,
VALUE hash2)
1649 rb_hash_modify_check(hash);
1650 hash2 = to_hash(hash2);
1654 if (hash == hash2)
return hash;
1656 ntbl =
RHASH(hash)->ntbl;
1657 if (
RHASH(hash2)->ntbl) {
1689 rb_hash_modify_check(hash);
1690 if (hash == hash2)
return hash;
1691 hash2 = to_hash(hash2);
1695 table2 =
RHASH(hash2)->ntbl;
1698 if (table2) hash_tbl(hash)->
type = table2->
type;
1735 rb_hash_empty_p(
VALUE hash)
1767 rb_hash_each_value(
VALUE hash)
1800 rb_hash_each_key(
VALUE hash)
1847 rb_hash_each_pair(
VALUE hash)
1883 rb_hash_transform_keys(
VALUE hash)
1914 rb_hash_transform_keys_bang(
VALUE hash)
1917 rb_hash_modify_check(hash);
1918 if (
RHASH(hash)->ntbl) {
1955 rb_hash_transform_values(
VALUE hash)
1986 rb_hash_transform_values_bang(
VALUE hash)
1989 rb_hash_modify_check(hash);
1990 if (
RHASH(hash)->ntbl)
2014 rb_hash_to_a(
VALUE hash)
2073 rb_hash_inspect(
VALUE hash)
2088 rb_hash_to_hash(
VALUE hash)
2102 rb_hash_to_h(
VALUE hash)
2137 if (size == 0)
return keys;
2144 size =
st_keys(table, ptr, size);
2181 if (size == 0)
return values;
2221 if (!
RHASH(hash)->ntbl)
2289 recursive_eql(
VALUE hash,
VALUE dt,
int recur)
2293 if (recur)
return Qtrue;
2306 if (hash1 == hash2)
return Qtrue;
2312 if (
rb_eql(hash2, hash1)) {
2325 if (!
RHASH(hash1)->ntbl || !
RHASH(hash2)->ntbl)
2327 if (
RHASH(hash1)->ntbl->type !=
RHASH(hash2)->ntbl->type)
2368 return hash_equal(hash1, hash2,
FALSE);
2383 return hash_equal(hash1, hash2,
TRUE);
2394 *hval ^=
st_hash(hdata,
sizeof(hdata), 0);
2409 rb_hash_hash(
VALUE hash)
2459 rb_hash_invert(
VALUE hash)
2468 rb_hash_update_callback(st_data_t *key, st_data_t *value,
struct update_arg *arg,
int existing)
2487 RHASH_UPDATE(hash, key, rb_hash_update_callback, value);
2492 rb_hash_update_block_callback(st_data_t *key, st_data_t *value,
struct update_arg *arg,
int existing)
2513 RHASH_UPDATE(hash, key, rb_hash_update_block_callback, value);
2545 rb_hash_modify(hash1);
2546 hash2 = to_hash(hash2);
2563 rb_hash_update_func_callback(st_data_t *key, st_data_t *value,
struct update_arg *arg,
int existing)
2596 rb_hash_modify(hash1);
2597 hash2 = to_hash(hash2);
2643 lookup2_call(
VALUE arg)
2655 reset_hash_type(
VALUE arg)
2696 table =
RHASH(hash)->ntbl;
2697 orighash = table->
type;
2699 if (orighash != &identhash) {
2704 assochash.
compare = assoc_cmp;
2706 table->
type = &assochash;
2786 rb_hash_flatten(
int argc,
VALUE *argv,
VALUE hash)
2792 if (level == 0)
return rb_hash_to_a(hash);
2796 if (level - 1 > 0) {
2800 else if (level < 0) {
2824 if (!
NIL_P(value)) {
2843 rb_hash_compact(
VALUE hash)
2865 rb_hash_compact_bang(
VALUE hash)
2867 rb_hash_modify_check(hash);
2868 if (
RHASH(hash)->ntbl) {
2871 if (n !=
RHASH(hash)->ntbl->num_entries)
2894 rb_hash_compare_by_id(
VALUE hash)
2897 rb_hash_modify(hash);
2898 RHASH(hash)->ntbl->type = &identhash;
2915 if (!
RHASH(hash)->ntbl)
2917 if (
RHASH(hash)->ntbl->type == &identhash) {
2973 rb_hash_any_p(
VALUE hash)
3013 if (!--argc)
return self;
3054 other = to_hash(other);
3056 return hash_le(hash, other);
3075 other = to_hash(other);
3077 return hash_le(hash, other);
3096 other = to_hash(other);
3098 return hash_le(other, hash);
3117 other = to_hash(other);
3119 return hash_le(other, hash);
3130 rb_hash_to_proc(
VALUE hash)
3136 add_new_i(st_data_t *key, st_data_t *val, st_data_t arg,
int existing)
3156 return st_update(tbl, (st_data_t)key, add_new_i, (st_data_t)args);
3159 static int path_tainted = -1;
3161 static char **origenviron;
3163 #define GET_ENVIRON(e) ((e) = rb_w32_get_environ()) 3164 #define FREE_ENVIRON(e) rb_w32_free_environ(e) 3165 static char **my_environ;
3167 #define environ my_environ 3169 static char *(*w32_getenv)(
const char*);
3171 w32_getenv_unknown(
const char *
name)
3173 char *(*func)(
const char*);
3181 return (w32_getenv = func)(
name);
3183 static char *(*w32_getenv)(
const char*) = w32_getenv_unknown;
3184 #define getenv(n) w32_getenv(n) 3185 #elif defined(__APPLE__) 3187 #define environ (*_NSGetEnviron()) 3188 #define GET_ENVIRON(e) (e) 3189 #define FREE_ENVIRON(e) 3192 #define GET_ENVIRON(e) (e) 3193 #define FREE_ENVIRON(e) 3195 #ifdef ENV_IGNORECASE 3196 #define ENVMATCH(s1, s2) (STRCASECMP((s1), (s2)) == 0) 3197 #define ENVNMATCH(s1, s2, n) (STRNCASECMP((s1), (s2), (n)) == 0) 3199 #define ENVMATCH(n1, n2) (strcmp((n1), (n2)) == 0) 3200 #define ENVNMATCH(s1, s2, n) (memcmp((s1), (s2), (n)) == 0) 3224 env_enc_str_new_cstr(
const char *ptr,
rb_encoding *enc)
3226 return env_enc_str_new(ptr,
strlen(ptr), enc);
3230 env_str_new(
const char *ptr,
long len)
3236 env_str_new2(
const char *ptr)
3238 if (!ptr)
return Qnil;
3239 return env_str_new(ptr,
strlen(ptr));
3242 static int env_path_tainted(
const char *);
3245 env_encoding_for(
const char *name,
const char *ptr)
3256 env_name_new(
const char *name,
const char *ptr)
3258 return env_enc_str_new_cstr(ptr, env_encoding_for(name, ptr));
3264 volatile VALUE *pstr,
3292 #define get_env_ptr(var, val) \ 3293 (var = get_env_cstr(&(val), #var)) 3295 #define get_env_ptr(var, val) \ 3296 (var = get_env_cstr(val, #var)) 3299 static inline const char *
3308 #define env_name(s) env_name(&(s)) 3313 const char *nam, *
val;
3318 VALUE value = env_str_new2(val);
3344 val = env_delete(obj, name);
3359 const char *nam, *
env;
3364 return env_name_new(nam, env);
3384 env_fetch(
int argc,
VALUE *argv)
3388 const char *nam, *
env;
3393 if (block_given && argc == 2) {
3394 rb_warn(
"block supersedes default value argument");
3399 if (block_given)
return rb_yield(key);
3405 return env_name_new(nam, env);
3409 path_tainted_p(
const char *path)
3415 env_path_tainted(
const char *path)
3417 if (path_tainted < 0) {
3418 path_tainted_p(path);
3420 return path_tainted;
3426 if (path_tainted < 0) {
3429 return path_tainted;
3432 #if defined(_WIN32) || (defined(HAVE_SETENV) && defined(HAVE_UNSETENV)) 3435 in_origenv(
const char *str)
3438 for (env = origenviron; *
env; ++
env) {
3439 if (*env == str)
return 1;
3445 envix(
const char *nam)
3447 register int i, len =
strlen(nam);
3451 for (i = 0; env[i]; i++) {
3452 if (
ENVNMATCH(env[i],nam,len) && env[i][len] ==
'=')
3462 getenvsize(
const WCHAR* p)
3464 const WCHAR* porg = p;
3465 while (*p++) p += lstrlenW(p) + 1;
3466 return p - porg + 1;
3469 getenvblocksize(
void)
3475 #if defined(_WIN32) || \ 3476 (defined(__sun) && !(defined(HAVE_SETENV) && defined(HAVE_UNSETENV))) 3478 NORETURN(
static void invalid_envname(
const char *name));
3481 invalid_envname(
const char *name)
3487 check_envname(
const char *name)
3490 invalid_envname(name);
3500 # if defined(MINGW_HAS_SECURE_API) || RUBY_MSVCRT_VERSION >= 80 3501 # define HAVE__WPUTENV_S 1 3508 check_envname(name);
3509 len = MultiByteToWideChar(CP_UTF8, 0, name, -1,
NULL, 0);
3511 WCHAR* p = GetEnvironmentStringsW();
3515 n = lstrlen(name) + 2 +
strlen(value) + getenvsize(p);
3516 FreeEnvironmentStringsW(p);
3517 if (n >= getenvblocksize()) {
3520 len2 = MultiByteToWideChar(CP_UTF8, 0, value, -1,
NULL, 0);
3521 wname =
ALLOCV_N(WCHAR, buf, len + len2);
3522 wvalue = wname +
len;
3523 MultiByteToWideChar(CP_UTF8, 0, name, -1, wname, len);
3524 MultiByteToWideChar(CP_UTF8, 0, value, -1, wvalue, len2);
3525 #ifndef HAVE__WPUTENV_S 3526 wname[len-1] = L
'=';
3530 wname =
ALLOCV_N(WCHAR, buf, len + 1);
3531 MultiByteToWideChar(CP_UTF8, 0, name, -1, wname, len);
3532 wvalue = wname +
len;
3534 #ifndef HAVE__WPUTENV_S 3535 wname[len-1] = L
'=';
3538 #ifndef HAVE__WPUTENV_S 3539 failed = _wputenv(wname);
3541 failed = _wputenv_s(wname, wvalue);
3546 if (!value || !*value) {
3548 if (!SetEnvironmentVariable(name, value) &&
3549 GetLastError() != ERROR_ENVVAR_NOT_FOUND)
goto fail;
3553 invalid_envname(name);
3555 #elif defined(HAVE_SETENV) && defined(HAVE_UNSETENV) 3557 if (setenv(name, value, 1))
3561 #ifdef VOID_UNSETENV 3573 size_t len, mem_size;
3574 char **env_ptr, *str, *mem_ptr;
3576 check_envname(name);
3579 mem_size = len +
strlen(value) + 2;
3580 mem_ptr =
malloc(mem_size);
3581 if (mem_ptr ==
NULL)
3583 snprintf(mem_ptr, mem_size,
"%s=%s", name, value);
3585 for (env_ptr =
GET_ENVIRON(environ); (str = *env_ptr) != 0; ++env_ptr) {
3586 if (!strncmp(str, name, len) && str[
len] ==
'=') {
3587 if (!in_origenv(str))
free(str);
3588 while ((env_ptr[0] = env_ptr[1]) != 0) env_ptr++;
3593 if (putenv(mem_ptr)) {
3604 if (environ == origenviron) {
3609 for (max = i; environ[max]; max++) ;
3610 tmpenv =
ALLOC_N(
char*, max+2);
3611 for (j=0; j<max; j++)
3617 char **envp = origenviron;
3618 while (*envp && *envp != environ[i]) envp++;
3622 while (environ[i]) {
3623 environ[i] = environ[i+1];
3635 environ[i] =
ALLOC_N(
char, len);
3636 snprintf(environ[i],len,
"%s=%s",name,value);
3662 env_delete(obj, nm);
3681 path_tainted_p(value);
3702 char *s =
strchr(*env,
'=');
3738 env_each_key(
VALUE ehash)
3766 char *s =
strchr(*env,
'=');
3786 env_each_value(
VALUE ehash)
3792 values = env_values();
3811 env_each_pair(
VALUE ehash)
3822 char *s =
strchr(*env,
'=');
3854 env_reject_bang(
VALUE ehash)
3874 if (del == 0)
return Qnil;
3888 env_delete_if(
VALUE ehash)
3891 env_reject_bang(ehash);
3903 env_values_at(
int argc,
VALUE *argv)
3909 for (i=0; i<
argc; i++) {
3925 env_select(
VALUE ehash)
3956 env_select_bang(
VALUE ehash)
3976 if (del == 0)
return Qnil;
3990 env_keep_if(
VALUE ehash)
3993 env_select_bang(ehash);
4047 char *s =
strchr(*env,
'=');
4049 if (env != environ) {
4086 char *s =
strchr(*env,
'=');
4089 env_str_new2(s+1)));
4124 for (i=0; env[i]; i++)
4204 char *s =
strchr(*env,
'=');
4235 char *s =
strchr(*env,
'=');
4266 char *s =
strchr(*env,
'=');
4270 str = env_str_new(*env, s-*env-1);
4290 rb_warn(
"ENV.index is deprecated; use ENV.key");
4291 return env_key(dmy, value);
4311 char *s =
strchr(*env,
'=');
4351 char *s =
strchr(*env,
'=');
4353 VALUE key = env_str_new(*env, s-*env);
4355 env_delete(
Qnil, key);
4373 return rb_hash_invert(env_to_hash());
4379 env_aset(
Qnil, key, val);
4400 if (env == hash)
return env;
4401 hash = to_hash(hash);
4417 env_aset(
Qnil, key, val);
4434 if (env == hash)
return env;
4435 hash = to_hash(hash);
4557 #define rb_intern(str) rb_intern_const(str) 4562 id_flatten_bang =
rb_intern(
"flatten!");
RUBY_EXTERN VALUE rb_cString
void rb_define_global_const(const char *, VALUE)
#define RBASIC_CLEAR_CLASS(obj)
#define RHASH_UPDATE(hash, key, func, arg)
#define SET_PROC_DEFAULT(hash, proc)
void rb_hash_bulk_insert(long, const VALUE *, VALUE)
int rb_integer_pack(VALUE val, void *words, size_t numwords, size_t wordsize, size_t nails, int flags)
VALUE rb_protect(VALUE(*proc)(VALUE), VALUE data, int *pstate)
Protects a function call from potential global escapes from the function.
void rb_warn(const char *fmt,...)
const struct st_hash_type * orighash
#define get_env_ptr(var, val)
VALUE rb_ary_new_capa(long capa)
char * rb_w32_ugetenv(const char *)
void rb_enc_copy(VALUE obj1, VALUE obj2)
size_t strlen(const char *)
VALUE rb_hash_dup(VALUE hash)
VALUE rb_yield_values(int n,...)
#define RB_OBJ_WRITTEN(a, oldv, b)
void rb_define_singleton_method(VALUE obj, const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a singleton method for obj.
void rb_syserr_fail_str(int e, VALUE mesg)
int rb_block_given_p(void)
Determines if the current method is given a block.
VALUE rb_exec_recursive_outer(VALUE(*)(VALUE, VALUE, int), VALUE, VALUE)
#define RHASH_ITER_LEV(h)
#define rb_usascii_str_new2
void rb_raise(VALUE exc, const char *fmt,...)
st_table * rb_init_identtable_with_size(st_index_t size)
st_index_t rb_hash_end(st_index_t)
VALUE rb_hash_select_bang(VALUE hash)
double rb_float_value(VALUE v)
int rb_hash_add_new_element(VALUE hash, VALUE key, VALUE val)
int rb_env_path_tainted(void)
VALUE rb_external_str_new_with_enc(const char *ptr, long len, rb_encoding *)
rb_encoding * rb_default_internal_encoding(void)
VALUE rb_check_convert_type_with_id(VALUE, int, const char *, ID)
VALUE rb_ary_push(VALUE ary, VALUE item)
VALUE rb_str_buf_new2(const char *)
if(len<=MAX_WORD_LENGTH &&len >=MIN_WORD_LENGTH)
#define SET_DEFAULT(hash, ifnone)
st_index_t rb_memhash(const void *ptr, long len)
struct st_table * rb_hash_tbl_raw(VALUE hash)
VALUE rb_hash_update_by(VALUE hash1, VALUE hash2, rb_hash_update_func *func)
VALUE rb_funcall(VALUE, ID, int,...)
Calls a method.
struct st_table * rb_hash_tbl(VALUE hash)
#define INTEGER_PACK_NATIVE_BYTE_ORDER
char * rb_str_fill_terminator(VALUE str, const int termlen)
long rb_dbl_long_hash(double d)
VALUE rb_str_initialize(VALUE str, const char *ptr, long len, rb_encoding *enc)
int rb_objspace_garbage_object_p(VALUE obj)
VALUE rb_exec_recursive(VALUE(*)(VALUE, VALUE, int), VALUE, VALUE)
void rb_define_alloc_func(VALUE, rb_alloc_func_t)
VALUE rb_obj_alloc(VALUE)
Allocates an instance of klass.
st_index_t rb_str_hash(VALUE)
#define ENVNMATCH(s1, s2, n)
void rb_include_module(VALUE klass, VALUE module)
VALUE rb_hash_lookup(VALUE hash, VALUE key)
int st_update(st_table *table, st_data_t key, st_update_callback_func *func, st_data_t arg)
VALUE rb_hash_fetch(VALUE hash, VALUE key)
VALUE rb_ensure(VALUE(*b_proc)(ANYARGS), VALUE data1, VALUE(*e_proc)(ANYARGS), VALUE data2)
An equivalent to ensure clause.
VALUE rb_inspect(VALUE)
Convenient wrapper of Object::inspect.
VALUE rb_hash_new_with_size(st_index_t size)
rb_encoding * rb_utf8_encoding(void)
VALUE rb_ary_cat(VALUE ary, const VALUE *argv, long len)
VALUE rb_str_buf_append(VALUE, VALUE)
#define NOINSERT_UPDATE_CALLBACK(func)
const char * rb_obj_classname(VALUE)
VALUE rb_big_hash(VALUE x)
#define RHASH_SET_IFNONE(h, ifnone)
VALUE rb_hash_keys(VALUE hash)
VALUE rb_str_buf_cat(VALUE, const char *, long)
RUBY_SYMBOL_EXPORT_BEGIN typedef unsigned long st_data_t
VALUE rb_hash_default_value(VALUE hash, VALUE key)
#define NEWOBJ_OF(obj, type, klass, flags)
void rb_hash_foreach(VALUE hash, int(*func)(ANYARGS), VALUE farg)
#define HAS_EXTRA_STATES(hash, klass)
VALUE rb_obj_class(VALUE)
call-seq: obj.class -> class
#define RB_TYPE_P(obj, type)
VALUE rb_hash_rehash(VALUE hash)
unsigned long long uint64_t
#define COPY_DEFAULT(hash, hash2)
VALUE rb_equal(VALUE, VALUE)
call-seq: obj === other -> true or false
VALUE rb_hash_aset(VALUE hash, VALUE key, VALUE val)
VALUE rb_convert_type_with_id(VALUE, int, const char *, ID)
VALUE rb_hash_reject_bang(VALUE hash)
RUBY_EXTERN VALUE rb_cObject
VALUE rb_exec_recursive_paired(VALUE(*)(VALUE, VALUE, int), VALUE, VALUE, VALUE)
VALUE rb_obj_dig(int argc, VALUE *argv, VALUE self, VALUE notfound)
#define st_init_table_with_size
char * ruby_strdup(const char *)
VALUE rb_hash_delete_entry(VALUE hash, VALUE key)
#define ECONV_INVALID_REPLACE
#define rb_key_err_raise(mesg, recv, name)
VALUE rb_str_buf_cat2(VALUE, const char *)
#define OBJ_WB_UNPROTECT(x)
int rb_ascii8bit_encindex(void)
long rb_objid_hash(st_index_t index)
int rb_class_has_methods(VALUE c)
VALUE rb_hash_set_ifnone(VALUE hash, VALUE ifnone)
VALUE rb_any_to_s(VALUE)
call-seq: obj.to_s -> string
VALUE rb_define_class(const char *name, VALUE super)
Defines a top-level class.
rb_atomic_t cnt[RUBY_NSIG]
VALUE rb_hash_update_func(VALUE newkey, VALUE oldkey, VALUE value)
st_table * rb_vm_fstring_table(void)
int rb_foreach_func(VALUE, VALUE, VALUE)
VALUE rb_str_conv_enc(VALUE str, rb_encoding *from, rb_encoding *to)
VALUE rb_hash_has_key(VALUE hash, VALUE key)
#define ALLOCV_N(type, v, n)
int rb_locale_encindex(void)
VALUE rb_hash_reject(VALUE hash)
st_index_t(* hash)(ANYARGS)
VALUE rb_hash_size(VALUE hash)
#define HASH_PROC_DEFAULT
#define RUBY_DTRACE_CREATE_HOOK(name, arg)
int rb_str_hash_cmp(VALUE, VALUE)
void st_foreach_safe(st_table *table, int(*func)(ANYARGS), st_data_t a)
void rb_define_alias(VALUE klass, const char *name1, const char *name2)
Defines an alias of a method.
#define REALLOC_N(var, type, n)
st_index_t st_hash(const void *ptr, size_t len, st_index_t h)
VALUE rb_obj_freeze(VALUE)
call-seq: obj.freeze -> obj
VALUE rb_obj_is_proc(VALUE)
st_index_t st_values(st_table *table, st_data_t *values, st_index_t size)
VALUE rb_sprintf(const char *format,...)
st_table * rb_init_identtable(void)
VALUE rb_hash_delete(VALUE hash, VALUE key)
#define RARRAY_PTR_USE(ary, ptr_name, expr)
VALUE rb_ary_delete(VALUE ary, VALUE item)
VALUE rb_hash_values(VALUE hash)
int(* tbl_update_func)(st_data_t *, st_data_t *, st_data_t, int)
VALUE rb_check_hash_type(VALUE hash)
unsigned char buf[MIME_BUF_SIZE]
VALUE rb_assoc_new(VALUE car, VALUE cdr)
rb_encoding * rb_locale_encoding(void)
char * rb_w32_getenv(const char *)
VALUE rb_hash_clear(VALUE hash)
#define RETURN_SIZED_ENUMERATOR(obj, argc, argv, size_fn)
VALUE rb_hash_keep_if(VALUE hash)
char * strchr(char *, char)
#define rb_enc_asciicompat(enc)
VALUE rb_str_ellipsize(VALUE, long)
Shortens str and adds three dots, an ellipsis, if it is longer than len characters.
VALUE rb_proc_lambda_p(VALUE)
void ruby_unsetenv(const char *name)
VALUE rb_hash_freeze(VALUE hash)
NORETURN(static void no_new_key(void))
const char * rb_builtin_class_name(VALUE x)
int rb_respond_to(VALUE, ID)
register unsigned int len
enum rb_thread_status status
VALUE rb_obj_hash(VALUE obj)
#define ECONV_UNDEF_REPLACE
#define RB_OBJ_WRITE(a, slot, b)
rb_encoding * rb_enc_get(VALUE obj)
VALUE rb_ident_hash_new(void)
VALUE rb_yield_values2(int n, const VALUE *argv)
VALUE rb_hash_lookup2(VALUE hash, VALUE key, VALUE def)
#define UNLIMITED_ARGUMENTS
VALUE rb_hash_compare_by_id_p(VALUE hash)
int st_shift(st_table *, st_data_t *, st_data_t *)
#define RARRAY_AREF(a, i)
int rb_path_check(const char *path)
VALUE rb_block_proc(void)
VALUE rb_str_buf_cat_ascii(VALUE, const char *)
VALUE rb_check_array_type(VALUE ary)
VALUE rb_hash_aref(VALUE hash, VALUE key)
#define RHASH_UPDATE_ITER(h, iter_lev, key, func, a)
void rb_extend_object(VALUE obj, VALUE module)
Extend the object with the module.
VALUE rb_check_string_type(VALUE)
VALUE rb_ary_includes(VALUE ary, VALUE item)
void rb_check_safe_obj(VALUE)
int st_foreach_check(st_table *, int(*)(ANYARGS), st_data_t, st_data_t)
st_index_t rb_hash_uint(st_index_t, st_index_t)
rb_encoding * rb_filesystem_encoding(void)
int rb_method_basic_definition_p(VALUE, ID)
VALUE rb_func_proc_new(rb_block_call_func_t func, VALUE val)
const struct st_hash_type * type
st_index_t st_keys(st_table *table, st_data_t *keys, st_index_t size)
void rb_gc_writebarrier_remember(VALUE obj)
#define SafeStringValue(v)
VALUE rb_enc_str_new(const char *, long, rb_encoding *)
VALUE rb_hash_set_default_proc(VALUE hash, VALUE proc)
int rb_eql(VALUE, VALUE)
Determines if obj1 and obj2 are equal in terms of Object::eql?.
VALUE rb_str_cat_conv_enc_opts(VALUE newstr, long ofs, const char *ptr, long len, rb_encoding *from, int ecflags, VALUE ecopts)
VALUE rb_hash_values_at(int argc, VALUE *argv, VALUE hash)
VALUE rb_str_new_frozen(VALUE)
#define ST_DATA_COMPATIBLE_P(type)
int st_foreach_func(st_data_t, st_data_t, st_data_t)
void st_clear(st_table *)
rb_hash_update_func * func
#define RB_OBJ_TAINTED(x)
VALUE rb_hash_delete_if(VALUE hash)
#define rb_check_frozen(obj)
void ruby_register_rollback_func_for_ensure(VALUE(*ensure_func)(ANYARGS), VALUE(*rollback_func)(ANYARGS))
VALUE rb_hash_assoc(VALUE hash, VALUE key)
void rb_copy_generic_ivar(VALUE, VALUE)
#define SPECIAL_CONST_P(x)
VALUE rb_tainted_str_new(const char *, long)
int rb_enc_str_asciionly_p(VALUE)
VALUE rb_hash_select(VALUE hash)
void rb_sys_fail_str(VALUE mesg)
#define RGENGC_WB_PROTECTED_HASH
void rb_define_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
void ruby_setenv(const char *name, const char *value)
st_index_t rb_hash_start(st_index_t)
VALUE rb_to_int(VALUE)
Converts val into Integer.
VALUE rb_hash_rassoc(VALUE hash, VALUE obj)
VALUE rb_hash_fetch_values(int argc, VALUE *argv, VALUE hash)
void rb_ary_set_len(VALUE ary, long len)
VALUE rb_hash_dig(int argc, VALUE *argv, VALUE self)