Ruby
2.5.0dev(2017-10-22revision60238)
|
#include "internal.h"
#include "ruby/st.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.
Data Structures | |
struct | symbols |
Macros | |
#define | SYMBOL_DEBUG 0 |
#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 | 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 } |
#define IDSET_ATTRSET_FOR_INTERN (~(~0U<<(1<<ID_SCOPE_SHIFT)) & ~(1U<<ID_ATTRSET)) |
#define IDSET_ATTRSET_FOR_SYNTAX ((1U<<ID_LOCAL)|(1U<<ID_CONST)) |
#define STATIC_SYM2ID | ( | sym | ) | RSHIFT((unsigned long)(sym), RUBY_SPECIAL_SHIFT) |
Definition at line 24 of file symbol.c.
Referenced by rb_check_id(), rb_sym2id(), and rb_sym2str().
#define SYMBOL_PINNED_P | ( | sym | ) | (RSYMBOL(sym)->id&~ID_SCOPE_MASK) |
Definition at line 22 of file symbol.c.
Referenced by rb_check_id(), and rb_check_symbol().
enum id_entry_type |
FUNC_MINIMIZED | ( | VALUE | rb_sym_internconst char *ptr, long len, rb_encoding *enc | ) |
FUNC_MINIMIZED | ( | VALUE | rb_sym_intern_cstrconst char *ptr, rb_encoding *enc | ) |
FUNC_MINIMIZED | ( | VALUE | rb_sym_intern_asciiconst char *ptr, long len | ) |
FUNC_MINIMIZED | ( | VALUE | rb_sym_intern_ascii_cstrconst char *ptr | ) |
void Init_sym | ( | void | ) |
Definition at line 75 of file symbol.c.
References rb_ident_hash_new().
Returns ID for the given name if it is interned already, or 0.
namep | the pointer to the name object |
namep
must be a Symbol or a String, or possible to convert with to_str method. namep
is a Symbol or a String if non-zero value is returned, or is a String if 0 is returned. Definition at line 915 of file symbol.c.
References DYNAMIC_SYM_P, name, NIL_P, PRIsVALUE, rb_check_string_type(), rb_eTypeError, rb_raise(), RB_TYPE_P, RSYMBOL, STATIC_SYM2ID, STATIC_SYM_P, SYMBOL_PINNED_P, and T_STRING.
Referenced by rb_execarg_addopt(), rb_f_untrace_var(), and rb_obj_singleton_method().
ID rb_check_id_cstr | ( | const char * | ptr, |
long | len, | ||
rb_encoding * | enc | ||
) |
Definition at line 984 of file symbol.c.
References rb_setup_fake_str().
Referenced by rb_deprecate_constant(), and rb_path_to_class().
Definition at line 948 of file symbol.c.
References DYNAMIC_SYM_P, name, STATIC_SYM_P, sym, and SYMBOL_PINNED_P.
VALUE rb_check_symbol_cstr | ( | const char * | ptr, |
long | len, | ||
rb_encoding * | enc | ||
) |
Definition at line 995 of file symbol.c.
References rb_setup_fake_str(), and sym.
int rb_enc_symname2_p | ( | const char * | name, |
long | len, | ||
rb_encoding * | enc | ||
) |
Definition at line 311 of file symbol.c.
Referenced by rb_enc_symname_p().
int rb_enc_symname_p | ( | const char * | name, |
rb_encoding * | enc | ||
) |
Definition at line 196 of file symbol.c.
References rb_enc_symname2_p(), and strlen().
Referenced by rb_symname_p().
Definition at line 751 of file symbol.c.
References rb_id2str(), and RSTRING_PTR.
Referenced by rb_undef(), rsock_inspect_sockaddr(), and ruby_debug_print_id().
Definition at line 745 of file symbol.c.
Referenced by rb_id2name(), rb_id_attrset(), and rb_sym2str().
Definition at line 726 of file symbol.c.
References DYNAMIC_ID_P, and STATIC_ID2SYM.
Definition at line 100 of file symbol.c.
References is_notop_id, PRIsVALUE, rb_id2str(), rb_name_error(), sym, tAREF, and tASET.
Definition at line 611 of file symbol.c.
References rb_intern2(), and strlen().
Definition at line 604 of file symbol.c.
References rb_intern3(), and rb_usascii_encoding().
Referenced by Init_load(), and rb_intern().
ID rb_intern3 | ( | const char * | name, |
long | len, | ||
rb_encoding * | enc | ||
) |
Definition at line 554 of file symbol.c.
References OBJ_FREEZE, rb_setup_fake_str(), and sym.
Referenced by rb_intern2().
int rb_is_attrset_id | ( | ID | id | ) |
Definition at line 844 of file symbol.c.
References is_attrset_id.
int rb_is_attrset_sym | ( | VALUE | sym | ) |
Definition at line 886 of file symbol.c.
References is_attrset_sym.
int rb_is_class_id | ( | ID | id | ) |
Definition at line 826 of file symbol.c.
References is_class_id.
int rb_is_class_sym | ( | VALUE | sym | ) |
Definition at line 868 of file symbol.c.
References is_class_sym.
int rb_is_const_id | ( | ID | id | ) |
Definition at line 820 of file symbol.c.
References is_const_id.
Referenced by rb_autoload_str(), and rb_define_const().
int rb_is_const_sym | ( | VALUE | sym | ) |
Definition at line 862 of file symbol.c.
References is_const_sym.
int rb_is_global_id | ( | ID | id | ) |
Definition at line 832 of file symbol.c.
References is_global_id.
int rb_is_global_sym | ( | VALUE | sym | ) |
Definition at line 874 of file symbol.c.
References is_global_sym.
int rb_is_instance_id | ( | ID | id | ) |
Definition at line 838 of file symbol.c.
References is_instance_id.
int rb_is_instance_sym | ( | VALUE | sym | ) |
Definition at line 880 of file symbol.c.
References is_instance_sym.
int rb_is_junk_id | ( | ID | id | ) |
Definition at line 856 of file symbol.c.
References is_junk_id.
int rb_is_junk_sym | ( | VALUE | sym | ) |
Definition at line 898 of file symbol.c.
References is_junk_sym.
int rb_is_local_id | ( | ID | id | ) |
Definition at line 850 of file symbol.c.
References is_local_id.
int rb_is_local_sym | ( | VALUE | sym | ) |
Definition at line 892 of file symbol.c.
References is_local_sym.
Definition at line 698 of file symbol.c.
References DYNAMIC_SYM_P, id, STATIC_SYM2ID, and STATIC_SYM_P.
Definition at line 734 of file symbol.c.
References DYNAMIC_SYM_P, rb_id2str(), RSYMBOL, and STATIC_SYM2ID.
VALUE rb_sym_all_symbols | ( | void | ) |
Definition at line 806 of file symbol.c.
References RString::ary, and rb_ary_new2.
VALUE rb_sym_intern | ( | const char * | ptr, |
long | len, | ||
rb_encoding * | enc | ||
) |
Definition at line 1022 of file symbol.c.
References rb_setup_fake_str(), and rb_str_intern().
Referenced by rb_sym_intern_ascii(), and rb_sym_intern_cstr().
Definition at line 1036 of file symbol.c.
References rb_sym_intern(), and rb_usascii_encoding().
Referenced by rb_sym_intern_ascii_cstr().
Definition at line 1042 of file symbol.c.
References rb_sym_intern_ascii(), and strlen().
Referenced by rb_catch(), and rb_throw().
VALUE rb_sym_intern_cstr | ( | const char * | ptr, |
rb_encoding * | enc | ||
) |
Definition at line 1030 of file symbol.c.
References rb_sym_intern(), and strlen().
int rb_symname_p | ( | const char * | name | ) |
Definition at line 190 of file symbol.c.
References rb_ascii8bit_encoding(), and rb_enc_symname_p().
STATIC_ASSERT | ( | op_tbl_name_size | , |
sizeof(op_tbl[0].name) | = =3 |
||
) |
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 ID | lookup_str_idVALUE str | ) |
WARN_UNUSED_RESULT | ( | static VALUE | lookup_str_symconst VALUE str | ) |
WARN_UNUSED_RESULT | ( | static VALUE | lookup_id_strID id | ) |
WARN_UNUSED_RESULT | ( | static ID | attrsetname_to_attrVALUE name | ) |
WARN_UNUSED_RESULT | ( | static ID | intern_strVALUE str, int mutable | ) |