23#include "ruby/internal/config.h"
36#include "ruby/internal/cast.h"
42#define RB_ID2SYM rb_id2sym
43#define RB_SYM2ID rb_sym2id
44#define ID2SYM RB_ID2SYM
45#define SYM2ID RB_SYM2ID
46#define CONST_ID_CACHE RUBY_CONST_ID_CACHE
47#define CONST_ID RUBY_CONST_ID
50#define rb_intern_const rb_intern_const
85ID rb_intern(const
char *name);
101ID rb_intern2(const
char *name,
long len);
136const
char *rb_id2name(
ID id);
286 size_t len = strlen(str);
287 return rb_intern2(str, RBIMPL_CAST((
long)
len));
298rbimpl_intern_const(
ID *ptr, const
char *str)
311#define RUBY_CONST_ID_CACHE(result, str) \
313 static ID rb_intern_id_cache; \
314 rbimpl_intern_const(&rb_intern_id_cache, (str)); \
315 result rb_intern_id_cache; \
322#define RUBY_CONST_ID(var, str) \
324 static ID rbimpl_id; \
325 (var) = rbimpl_intern_const(&rbimpl_id, (str)); \
328#if defined(HAVE_STMT_AND_DECL_IN_EXPR)
331#define rb_intern(str) \
332 (RBIMPL_CONSTANT_P(str) ? \
334 static ID rbimpl_id; \
335 rbimpl_intern_const(&rbimpl_id, (str)); \
Defines RBIMPL_CONSTANT_P.
Tweaking visibility of C variables/functions.
#define RBIMPL_SYMBOL_EXPORT_END()
Counterpart of RBIMPL_SYMBOL_EXPORT_BEGIN.
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
Defines RBIMPL_HAS_BUILTIN.
VALUE rb_check_symbol(volatile VALUE *namep)
Identical to rb_check_id(), except it returns an instance of rb_cSymbol instead.
static ID rb_intern_const(const char *str)
This is a "tiny optimisation" over rb_intern().
VALUE rb_id2sym(ID id)
Allocates an instance of rb_cSymbol that has the given id.
ID rb_check_id(volatile VALUE *namep)
Detects if the given name is already interned or not.
VALUE rb_sym2str(VALUE symbol)
Obtain a frozen string representation of a symbol (not including the leading colon).
VALUE rb_to_symbol(VALUE name)
Identical to rb_intern_str(), except it generates a dynamic symbol if necessary.
ID rb_sym2id(VALUE obj)
Converts an instance of rb_cSymbol into an ID.
int len
Length of the buffer.
Defines RBIMPL_ATTR_NOALIAS.
#define RBIMPL_ATTR_NOALIAS()
Wraps (or simulates) __declspec((noalias))
Defines RBIMPL_ATTR_NONNULL.
#define RBIMPL_ATTR_NONNULL(list)
Wraps (or simulates) __attribute__((nonnull))
#define inline
Old Visual Studio versions do not support the inline keyword, so we need to define it to be __inline.
Defines RBIMPL_ATTR_PURE.
#define RBIMPL_ATTR_PURE()
Wraps (or simulates) __attribute__((pure))
uintptr_t ID
Type that represents a Ruby identifier such as a variable name.
uintptr_t VALUE
Type that represents a Ruby object.