Ruby: symbol.h File Reference

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

Data Structures | Macros | Typedefs | Functions | Variables
symbol.h File Reference
`#include "id.h"`
`#include "ruby/encoding.h"`

Go to the source code of this file.

## Data Structures
struct | RSymbol
struct | rb_symbols_t

## Macros
#define | DYNAMIC_ID_P(id) (!(id&ID_STATIC_SYM)&&id>tLAST_OP_ID)
#define | STATIC_ID2SYM(id) (((VALUE)(id)<<RUBY_SPECIAL_SHIFT)|SYMBOL_FLAG)
#define | RSYMBOL(obj) ((struct RSymbol *)(obj))
#define | is_notop_id(id) ((id)>tLAST_OP_ID)
#define | is_local_id(id) (id_type(id)==ID_LOCAL)
#define | is_global_id(id) (id_type(id)==ID_GLOBAL)
#define | is_instance_id(id) (id_type(id)==ID_INSTANCE)
#define | is_attrset_id(id) ((id)==idASET||id_type(id)==ID_ATTRSET)
#define | is_const_id(id) (id_type(id)==ID_CONST)
#define | is_class_id(id) (id_type(id)==ID_CLASS)
#define | is_junk_id(id) (id_type(id)==ID_JUNK)
#define | is_local_sym(sym) (sym_type(sym)==ID_LOCAL)
#define | is_global_sym(sym) (sym_type(sym)==ID_GLOBAL)
#define | is_instance_sym(sym) (sym_type(sym)==ID_INSTANCE)
#define | is_attrset_sym(sym) (sym_type(sym)==ID_ATTRSET)
#define | is_const_sym(sym) (sym_type(sym)==ID_CONST)
#define | is_class_sym(sym) (sym_type(sym)==ID_CLASS)
#define | is_junk_sym(sym) (sym_type(sym)==ID_JUNK)

## Typedefs
typedef uint32_t | rb_id_serial_t

## Functions
int | rb_enc_symname_type (const char *name, long len, rb_encoding *enc, unsigned int allowed_attrset)
size_t | rb_sym_immortal_count (void)

## Variables
const unsigned int | ruby_global_name_punct_bits [(0x7e - 0x20+31)/32]

## Macro Definition Documentation

## ◆ DYNAMIC_ID_P

#define DYNAMIC_ID_P | ( |  | id | ) | (!(id&ID_STATIC_SYM)&&id>tLAST_OP_ID)

Definition at line 17 of file symbol.h.

## ◆ is_attrset_id

#define is_attrset_id | ( |  | id | ) | ((id)==idASET||id_type(id)==ID_ATTRSET)

Definition at line 39 of file symbol.h.

## ◆ is_attrset_sym

#define is_attrset_sym | ( |  | sym | ) | (sym_type(sym)==ID_ATTRSET)

Definition at line 98 of file symbol.h.

## ◆ is_class_id

#define is_class_id | ( |  | id | ) | (id_type(id)==ID_CLASS)

Definition at line 41 of file symbol.h.

## ◆ is_class_sym

#define is_class_sym | ( |  | sym | ) | (sym_type(sym)==ID_CLASS)

Definition at line 100 of file symbol.h.

## ◆ is_const_id

#define is_const_id | ( |  | id | ) | (id_type(id)==ID_CONST)

Definition at line 40 of file symbol.h.

## ◆ is_const_sym

#define is_const_sym | ( |  | sym | ) | (sym_type(sym)==ID_CONST)

Definition at line 99 of file symbol.h.

## ◆ is_global_id

#define is_global_id | ( |  | id | ) | (id_type(id)==ID_GLOBAL)

Definition at line 37 of file symbol.h.

## ◆ is_global_sym

#define is_global_sym | ( |  | sym | ) | (sym_type(sym)==ID_GLOBAL)

Definition at line 96 of file symbol.h.

## ◆ is_instance_id

#define is_instance_id | ( |  | id | ) | (id_type(id)==ID_INSTANCE)

Definition at line 38 of file symbol.h.

## ◆ is_instance_sym

#define is_instance_sym | ( |  | sym | ) | (sym_type(sym)==ID_INSTANCE)

Definition at line 97 of file symbol.h.

## ◆ is_junk_id

#define is_junk_id | ( |  | id | ) | (id_type(id)==ID_JUNK)

Definition at line 42 of file symbol.h.

## ◆ is_junk_sym

#define is_junk_sym | ( |  | sym | ) | (sym_type(sym)==ID_JUNK)

Definition at line 101 of file symbol.h.

## ◆ is_local_id

#define is_local_id | ( |  | id | ) | (id_type(id)==ID_LOCAL)

Definition at line 36 of file symbol.h.

## ◆ is_local_sym

#define is_local_sym | ( |  | sym | ) | (sym_type(sym)==ID_LOCAL)

Definition at line 95 of file symbol.h.

## ◆ is_notop_id

#define is_notop_id | ( |  | id | ) | ((id)>tLAST_OP_ID)

Definition at line 35 of file symbol.h.

## ◆ RSYMBOL

#define RSYMBOL | ( |  | obj | ) | ((struct RSymbol *)(obj))

Definition at line 33 of file symbol.h.

## ◆ STATIC_ID2SYM

#define STATIC_ID2SYM | ( |  | id | ) | (((VALUE)(id)<<RUBY_SPECIAL_SHIFT)|SYMBOL_FLAG)

Definition at line 18 of file symbol.h.

## Typedef Documentation

## ◆ rb_id_serial_t

typedef uint32_t rb_id_serial_t

Definition at line 55 of file symbol.h.

## Function Documentation

## ◆ rb_enc_symname_type()

int rb_enc_symname_type | ( | const char * | name,
|  | long | len,
|  | rb_encoding * | enc,
|  | unsigned int | allowed_attrset
| ) |  |

Definition at line 365 of file symbol.c.

References f, ID_ATTRSET, ID_CLASS, ID_GLOBAL, ID_INSTANCE, ID_JUNK, int(), enc_synmane_type_leading_chars_tag::invalid, is_identchar, ISALPHA, ISASCII, len, name, enc_synmane_type_leading_chars_tag::needmore, rb_enc_mbclen(), rb_enc_symname_type(), and enc_synmane_type_leading_chars_tag::stophere.

Referenced by rb_enc_symname2_p(), and rb_enc_symname_type().

## ◆ rb_sym_immortal_count()

size_t rb_sym_immortal_count | ( | void |  | ) |

Definition at line 998 of file symbol.c.

## Variable Documentation

## ◆ ruby_global_name_punct_bits

const unsigned int ruby_global_name_punct_bits[(0x7e - 0x20+31)/32]

Definition at line 103 of file symbol.h.