Ruby 3.5.0dev (2025-08-04 revision 6179cc011829b9e4c7b253ac2d2a3f47d8fd6890)
symbol.h
1#ifndef INTERNAL_SYMBOL_H /*-*-C-*-vi:se ft=c:*/
2#define INTERNAL_SYMBOL_H
11#include "ruby/ruby.h" /* for VALUE */
12#include "ruby/encoding.h" /* for rb_encoding */
13#include "internal/compilers.h" /* for __has_builtin */
14
15#ifdef rb_sym_intern_ascii_cstr
16# undef rb_sym_intern_ascii_cstr
17#endif
18
19/* symbol.c */
20void rb_sym_global_symbols_mark(void);
21void rb_sym_global_symbols_update_references(void);
22VALUE rb_to_symbol_type(VALUE obj);
23VALUE rb_sym_intern(const char *ptr, long len, rb_encoding *enc);
24VALUE rb_sym_intern_ascii(const char *ptr, long len);
25VALUE rb_sym_intern_ascii_cstr(const char *ptr);
26int rb_is_const_name(VALUE name);
27int rb_is_class_name(VALUE name);
28int rb_is_instance_name(VALUE name);
29int rb_is_local_name(VALUE name);
30PUREFUNC(int rb_is_const_sym(VALUE sym));
31PUREFUNC(int rb_is_attrset_sym(VALUE sym));
32ID rb_make_internal_id(void);
33ID rb_make_temporary_id(size_t n);
34bool rb_obj_is_symbol_table(VALUE obj);
35void rb_sym_global_symbol_table_foreach_weak_reference(int (*callback)(VALUE *key, void *data), void *data);
36void rb_gc_free_dsymbol(VALUE);
37int rb_static_id_valid_p(ID id);
38
39#if __has_builtin(__builtin_constant_p)
40#define rb_sym_intern_ascii_cstr(ptr) \
41 (__builtin_constant_p(ptr) ? \
42 rb_sym_intern_ascii((ptr), (long)strlen(ptr)) : \
43 rb_sym_intern_ascii_cstr(ptr))
44#endif
45
46#endif /* INTERNAL_SYMBOL_H */
Encoding relates APIs.
int len
Length of the buffer.
Definition io.h:8
uintptr_t ID
Type that represents a Ruby identifier such as a variable name.
Definition value.h:52
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40