Ruby
2.7.1p83(2020-03-31revisiona0c7c23c9cec0d0ffcba012279cd652d28ad5bf3)
|
#include "ruby/encoding.h"
#include "ruby/st.h"
#include "internal.h"
#include "symbol.h"
#include "gc.h"
#include "probes.h"
#include "id.c"
#include "id_table.c"
Go to the source code of this file.
Macros | |
#define | SYMBOL_DEBUG 0 |
#define | CHECK_ID_SERIAL SYMBOL_DEBUG |
#define | SYMBOL_PINNED_P(sym) (RSYMBOL(sym)->id&~ID_SCOPE_MASK) |
#define | STATIC_SYM2ID(sym) RSHIFT((unsigned long)(sym), RUBY_SPECIAL_SHIFT) |
#define | REGISTER_SYMID(id, name) register_static_symid((id), (name), strlen(name), enc) |
#define | is_identchar(p, e, enc) (ISALNUM((unsigned char)*(p)) || (*(p)) == '_' || !ISASCII(*(p))) |
#define | op_tbl_count numberof(op_tbl) |
#define | op_tbl_len(i) (!op_tbl[i].name[1] ? 1 : !op_tbl[i].name[2] ? 2 : 3) |
#define | global_symbols ruby_global_symbols |
#define | IDSET_ATTRSET_FOR_SYNTAX ((1U<<ID_LOCAL)|(1U<<ID_CONST)) |
#define | IDSET_ATTRSET_FOR_INTERN (~(~0U<<(1<<ID_SCOPE_SHIFT)) & ~(1U<<ID_ATTRSET)) |
Enumerations | |
enum | id_entry_type { ID_ENTRY_STR, ID_ENTRY_SYM, ID_ENTRY_SIZE } |
Variables | |
rb_symbols_t | ruby_global_symbols = {tNEXT_ID-1} |
#define CHECK_ID_SERIAL SYMBOL_DEBUG |
#define global_symbols ruby_global_symbols |
#define IDSET_ATTRSET_FOR_INTERN (~(~0U<<(1<<ID_SCOPE_SHIFT)) & ~(1U<<ID_ATTRSET)) |
#define SYMBOL_PINNED_P | ( | sym | ) | (RSYMBOL(sym)->id&~ID_SCOPE_MASK) |
enum id_entry_type |
FUNC_MINIMIZED | ( | VALUE | rb_sym_internconst char *ptr, long len, rb_encoding *enc | ) |
FUNC_MINIMIZED | ( | VALUE | rb_sym_intern_asciiconst char *ptr, long len | ) |
FUNC_MINIMIZED | ( | VALUE | rb_sym_intern_ascii_cstrconst char *ptr | ) |
Definition at line 75 of file symbol.c.
References global_symbols, rb_gc_register_mark_object(), rb_ident_hash_new(), rb_obj_hide(), and st_init_table_with_size().
ID rb_check_id_cstr | ( | const char * | ptr, |
long | len, | ||
rb_encoding * | enc | ||
) |
Definition at line 988 of file symbol.c.
References len, name, ptr, and rb_setup_fake_str().
Referenced by rb_deprecate_constant(), rb_iv_get(), and rb_path_to_class().
VALUE rb_check_symbol_cstr | ( | const char * | ptr, |
long | len, | ||
rb_encoding * | enc | ||
) |
int rb_enc_symname2_p | ( | const char * | name, |
long | len, | ||
rb_encoding * | enc | ||
) |
Definition at line 339 of file symbol.c.
References IDSET_ATTRSET_FOR_SYNTAX, len, name, and rb_enc_symname_type().
Referenced by rb_enc_symname_p().
int rb_enc_symname_p | ( | const char * | name, |
rb_encoding * | enc | ||
) |
Definition at line 188 of file symbol.c.
References name, rb_enc_symname2_p(), and strlen().
Referenced by rb_symname_p().
int rb_enc_symname_type | ( | const char * | name, |
long | len, | ||
rb_encoding * | enc, | ||
unsigned int | allowed_attrset | ||
) |
Definition at line 233 of file symbol.c.
References ID_GLOBAL, ID_JUNK, len, name, and rb_enc_asciicompat.
Referenced by rb_enc_symname2_p().
Definition at line 776 of file symbol.c.
References DYNAMIC_ID_P, and STATIC_ID2SYM.
Definition at line 98 of file symbol.c.
References is_notop_id, PRIsVALUE, rb_id2str(), rb_name_error(), str, sym, tAREF, and tASET.
ID rb_intern3 | ( | const char * | name, |
long | len, | ||
rb_encoding * | enc | ||
) |
Definition at line 603 of file symbol.c.
References len, name, OBJ_FREEZE, rb_setup_fake_str(), str, and sym.
Referenced by rb_intern2().
Definition at line 878 of file symbol.c.
References is_attrset_id.
Definition at line 902 of file symbol.c.
References is_attrset_sym, and sym.
Definition at line 860 of file symbol.c.
References is_class_id.
Definition at line 854 of file symbol.c.
References is_const_id.
Referenced by rb_autoload_str(), and rb_define_const().
Definition at line 896 of file symbol.c.
References is_const_sym, and sym.
Definition at line 866 of file symbol.c.
References is_global_id.
Definition at line 872 of file symbol.c.
References is_instance_id.
Referenced by rb_ivar_set_internal().
Definition at line 890 of file symbol.c.
References is_junk_id.
Definition at line 884 of file symbol.c.
References is_local_id.
Definition at line 710 of file symbol.c.
References id, rb_encoding, and sym.
Referenced by rb_sym_intern().
Definition at line 748 of file symbol.c.
References DYNAMIC_SYM_P, id, STATIC_SYM2ID, STATIC_SYM_P, and sym.
Definition at line 840 of file symbol.c.
References RString::ary, global_symbols, rb_ary_new2, and st_foreach().
Definition at line 848 of file symbol.c.
References global_symbols.
VALUE rb_sym_intern | ( | const char * | ptr, |
long | len, | ||
rb_encoding * | enc | ||
) |
Definition at line 1024 of file symbol.c.
References len, name, ptr, rb_setup_fake_str(), and rb_str_intern().
Referenced by rb_sym_intern_ascii().
Definition at line 1032 of file symbol.c.
References len, ptr, rb_sym_intern(), and rb_usascii_encoding().
Referenced by rb_sym_intern_ascii_cstr().
Definition at line 1038 of file symbol.c.
References ptr, rb_sym_intern_ascii(), and strlen().
Definition at line 182 of file symbol.c.
References name, rb_ascii8bit_encoding(), and rb_enc_symname_p().
STATIC_ASSERT | ( | op_tbl_name_size | , |
sizeof(op_tbl[0].name) | = =3 |
||
) |
WARN_UNUSED_RESULT | ( | static ID | intern_strVALUE str, int mutable | ) |
WARN_UNUSED_RESULT | ( | static ID | lookup_str_idVALUE str | ) |
WARN_UNUSED_RESULT | ( | static VALUE | dsymbol_allocconst VALUE klass, const VALUE str, rb_encoding *const enc, const ID type | ) |
WARN_UNUSED_RESULT | ( | static VALUE | dsymbol_checkconst VALUE sym | ) |
WARN_UNUSED_RESULT | ( | static VALUE | lookup_id_strID id | ) |
WARN_UNUSED_RESULT | ( | static VALUE | lookup_str_symconst VALUE str | ) |
rb_symbols_t ruby_global_symbols = {tNEXT_ID-1} |