summaryrefslogtreecommitdiff
path: root/include/ruby/3/intern
diff options
context:
space:
mode:
Diffstat (limited to 'include/ruby/3/intern')
-rw-r--r--include/ruby/3/intern/array.h78
-rw-r--r--include/ruby/3/intern/bignum.h105
-rw-r--r--include/ruby/3/intern/class.h57
-rw-r--r--include/ruby/3/intern/compar.h34
-rw-r--r--include/ruby/3/intern/complex.h60
-rw-r--r--include/ruby/3/intern/cont.h40
-rw-r--r--include/ruby/3/intern/dir.h33
-rw-r--r--include/ruby/3/intern/enum.h33
-rw-r--r--include/ruby/3/intern/enumerator.h79
-rw-r--r--include/ruby/3/intern/error.h82
-rw-r--r--include/ruby/3/intern/eval.h59
-rw-r--r--include/ruby/3/intern/file.h44
-rw-r--r--include/ruby/3/intern/gc.h57
-rw-r--r--include/ruby/3/intern/hash.h59
-rw-r--r--include/ruby/3/intern/io.h70
-rw-r--r--include/ruby/3/intern/load.h40
-rw-r--r--include/ruby/3/intern/marshal.h35
-rw-r--r--include/ruby/3/intern/numeric.h42
-rw-r--r--include/ruby/3/intern/object.h89
-rw-r--r--include/ruby/3/intern/parse.h64
-rw-r--r--include/ruby/3/intern/proc.h53
-rw-r--r--include/ruby/3/intern/process.h46
-rw-r--r--include/ruby/3/intern/random.h45
-rw-r--r--include/ruby/3/intern/range.h35
-rw-r--r--include/ruby/3/intern/rational.h46
-rw-r--r--include/ruby/3/intern/re.h50
-rw-r--r--include/ruby/3/intern/ruby.h37
-rw-r--r--include/ruby/3/intern/select.h52
-rw-r--r--include/ruby/3/intern/select/largesize.h103
-rw-r--r--include/ruby/3/intern/select/posix.h82
-rw-r--r--include/ruby/3/intern/select/win32.h124
-rw-r--r--include/ruby/3/intern/signal.h40
-rw-r--r--include/ruby/3/intern/sprintf.h43
-rw-r--r--include/ruby/3/intern/string.h326
-rw-r--r--include/ruby/3/intern/struct.h47
-rw-r--r--include/ruby/3/intern/thread.h77
-rw-r--r--include/ruby/3/intern/time.h52
-rw-r--r--include/ruby/3/intern/variable.h83
-rw-r--r--include/ruby/3/intern/vm.h77
39 files changed, 2578 insertions, 0 deletions
diff --git a/include/ruby/3/intern/array.h b/include/ruby/3/intern/array.h
new file mode 100644
index 0000000000..02e44c99ad
--- /dev/null
+++ b/include/ruby/3/intern/array.h
@@ -0,0 +1,78 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to ::rb_cArray.
+ */
+#ifndef RUBY3_INTERN_ARRAY_H
+#define RUBY3_INTERN_ARRAY_H
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* array.c */
+void rb_mem_clear(VALUE*, long);
+VALUE rb_assoc_new(VALUE, VALUE);
+VALUE rb_check_array_type(VALUE);
+VALUE rb_ary_new(void);
+VALUE rb_ary_new_capa(long capa);
+VALUE rb_ary_new_from_args(long n, ...);
+VALUE rb_ary_new_from_values(long n, const VALUE *elts);
+VALUE rb_ary_tmp_new(long);
+void rb_ary_free(VALUE);
+void rb_ary_modify(VALUE);
+VALUE rb_ary_freeze(VALUE);
+VALUE rb_ary_shared_with_p(VALUE, VALUE);
+VALUE rb_ary_aref(int, const VALUE*, VALUE);
+VALUE rb_ary_subseq(VALUE, long, long);
+void rb_ary_store(VALUE, long, VALUE);
+VALUE rb_ary_dup(VALUE);
+VALUE rb_ary_resurrect(VALUE ary);
+VALUE rb_ary_to_ary(VALUE);
+VALUE rb_ary_to_s(VALUE);
+VALUE rb_ary_cat(VALUE, const VALUE *, long);
+VALUE rb_ary_push(VALUE, VALUE);
+VALUE rb_ary_pop(VALUE);
+VALUE rb_ary_shift(VALUE);
+VALUE rb_ary_unshift(VALUE, VALUE);
+VALUE rb_ary_entry(VALUE, long);
+VALUE rb_ary_each(VALUE);
+VALUE rb_ary_join(VALUE, VALUE);
+VALUE rb_ary_reverse(VALUE);
+VALUE rb_ary_rotate(VALUE, long);
+VALUE rb_ary_sort(VALUE);
+VALUE rb_ary_sort_bang(VALUE);
+VALUE rb_ary_delete(VALUE, VALUE);
+VALUE rb_ary_delete_at(VALUE, long);
+VALUE rb_ary_clear(VALUE);
+VALUE rb_ary_plus(VALUE, VALUE);
+VALUE rb_ary_concat(VALUE, VALUE);
+VALUE rb_ary_assoc(VALUE, VALUE);
+VALUE rb_ary_rassoc(VALUE, VALUE);
+VALUE rb_ary_includes(VALUE, VALUE);
+VALUE rb_ary_cmp(VALUE, VALUE);
+VALUE rb_ary_replace(VALUE copy, VALUE orig);
+VALUE rb_get_values_at(VALUE, long, int, const VALUE*, VALUE(*)(VALUE,long));
+VALUE rb_ary_resize(VALUE ary, long len);
+#define rb_ary_new2 rb_ary_new_capa
+#define rb_ary_new3 rb_ary_new_from_args
+#define rb_ary_new4 rb_ary_new_from_values
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_ARRAY_H */
diff --git a/include/ruby/3/intern/bignum.h b/include/ruby/3/intern/bignum.h
new file mode 100644
index 0000000000..398d09f625
--- /dev/null
+++ b/include/ruby/3/intern/bignum.h
@@ -0,0 +1,105 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to so-called rb_cBignum.
+ */
+#ifndef RUBY3_INTERN_BIGNUM_H
+#define RUBY3_INTERN_BIGNUM_H
+#include "ruby/3/config.h"
+
+#ifdef STDC_HEADERS
+# include <stddef.h>
+#endif
+
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+#include "ruby/backward/2/long_long.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* bignum.c */
+VALUE rb_big_new(size_t, int);
+int rb_bigzero_p(VALUE x);
+VALUE rb_big_clone(VALUE);
+void rb_big_2comp(VALUE);
+VALUE rb_big_norm(VALUE);
+void rb_big_resize(VALUE big, size_t len);
+VALUE rb_cstr_to_inum(const char*, int, int);
+VALUE rb_str_to_inum(VALUE, int, int);
+VALUE rb_cstr2inum(const char*, int);
+VALUE rb_str2inum(VALUE, int);
+VALUE rb_big2str(VALUE, int);
+long rb_big2long(VALUE);
+#define rb_big2int(x) rb_big2long(x)
+unsigned long rb_big2ulong(VALUE);
+#define rb_big2uint(x) rb_big2ulong(x)
+#if HAVE_LONG_LONG
+LONG_LONG rb_big2ll(VALUE);
+unsigned LONG_LONG rb_big2ull(VALUE);
+#endif /* HAVE_LONG_LONG */
+void rb_big_pack(VALUE val, unsigned long *buf, long num_longs);
+VALUE rb_big_unpack(unsigned long *buf, long num_longs);
+int rb_uv_to_utf8(char[6],unsigned long);
+VALUE rb_dbl2big(double);
+double rb_big2dbl(VALUE);
+VALUE rb_big_cmp(VALUE, VALUE);
+VALUE rb_big_eq(VALUE, VALUE);
+VALUE rb_big_eql(VALUE, VALUE);
+VALUE rb_big_plus(VALUE, VALUE);
+VALUE rb_big_minus(VALUE, VALUE);
+VALUE rb_big_mul(VALUE, VALUE);
+VALUE rb_big_div(VALUE, VALUE);
+VALUE rb_big_idiv(VALUE, VALUE);
+VALUE rb_big_modulo(VALUE, VALUE);
+VALUE rb_big_divmod(VALUE, VALUE);
+VALUE rb_big_pow(VALUE, VALUE);
+VALUE rb_big_and(VALUE, VALUE);
+VALUE rb_big_or(VALUE, VALUE);
+VALUE rb_big_xor(VALUE, VALUE);
+VALUE rb_big_lshift(VALUE, VALUE);
+VALUE rb_big_rshift(VALUE, VALUE);
+
+/* For rb_integer_pack and rb_integer_unpack: */
+/* "MS" in MSWORD and MSBYTE means "most significant" */
+/* "LS" in LSWORD and LSBYTE means "least significant" */
+#define INTEGER_PACK_MSWORD_FIRST 0x01
+#define INTEGER_PACK_LSWORD_FIRST 0x02
+#define INTEGER_PACK_MSBYTE_FIRST 0x10
+#define INTEGER_PACK_LSBYTE_FIRST 0x20
+#define INTEGER_PACK_NATIVE_BYTE_ORDER 0x40
+#define INTEGER_PACK_2COMP 0x80
+#define INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION 0x400
+/* For rb_integer_unpack: */
+#define INTEGER_PACK_FORCE_BIGNUM 0x100
+#define INTEGER_PACK_NEGATIVE 0x200
+/* Combinations: */
+#define INTEGER_PACK_LITTLE_ENDIAN \
+ (INTEGER_PACK_LSWORD_FIRST | \
+ INTEGER_PACK_LSBYTE_FIRST)
+#define INTEGER_PACK_BIG_ENDIAN \
+ (INTEGER_PACK_MSWORD_FIRST | \
+ INTEGER_PACK_MSBYTE_FIRST)
+int rb_integer_pack(VALUE val, void *words, size_t numwords, size_t wordsize, size_t nails, int flags);
+VALUE rb_integer_unpack(const void *words, size_t numwords, size_t wordsize, size_t nails, int flags);
+size_t rb_absint_size(VALUE val, int *nlz_bits_ret);
+size_t rb_absint_numwords(VALUE val, size_t word_numbits, size_t *nlz_bits_ret);
+int rb_absint_singlebit_p(VALUE val);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_BIGNUM_H */
diff --git a/include/ruby/3/intern/class.h b/include/ruby/3/intern/class.h
new file mode 100644
index 0000000000..a4778bdf27
--- /dev/null
+++ b/include/ruby/3/intern/class.h
@@ -0,0 +1,57 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to ::rb_cClass/::rb_cModule.
+ */
+#ifndef RUBY3_INTERN_CLASS_H
+#define RUBY3_INTERN_CLASS_H
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+#include "ruby/backward/2/stdarg.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* class.c */
+VALUE rb_class_new(VALUE);
+VALUE rb_mod_init_copy(VALUE, VALUE);
+VALUE rb_singleton_class_clone(VALUE);
+void rb_singleton_class_attached(VALUE,VALUE);
+void rb_check_inheritable(VALUE);
+VALUE rb_define_class_id(ID, VALUE);
+VALUE rb_define_class_id_under(VALUE, ID, VALUE);
+VALUE rb_module_new(void);
+VALUE rb_define_module_id(ID);
+VALUE rb_define_module_id_under(VALUE, ID);
+VALUE rb_mod_included_modules(VALUE);
+VALUE rb_mod_include_p(VALUE, VALUE);
+VALUE rb_mod_ancestors(VALUE);
+VALUE rb_class_instance_methods(int, const VALUE*, VALUE);
+VALUE rb_class_public_instance_methods(int, const VALUE*, VALUE);
+VALUE rb_class_protected_instance_methods(int, const VALUE*, VALUE);
+VALUE rb_class_private_instance_methods(int, const VALUE*, VALUE);
+VALUE rb_obj_singleton_methods(int, const VALUE*, VALUE);
+void rb_define_method_id(VALUE, ID, VALUE (*)(ANYARGS), int);
+void rb_undef(VALUE, ID);
+void rb_define_protected_method(VALUE, const char*, VALUE (*)(ANYARGS), int);
+void rb_define_private_method(VALUE, const char*, VALUE (*)(ANYARGS), int);
+void rb_define_singleton_method(VALUE, const char*, VALUE(*)(ANYARGS), int);
+VALUE rb_singleton_class(VALUE);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_CLASS_H */
diff --git a/include/ruby/3/intern/compar.h b/include/ruby/3/intern/compar.h
new file mode 100644
index 0000000000..68e8661b56
--- /dev/null
+++ b/include/ruby/3/intern/compar.h
@@ -0,0 +1,34 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to ::rb_mComparable.
+ */
+#ifndef RUBY3_INTERN_COMPAR_H
+#define RUBY3_INTERN_COMPAR_H
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* compar.c */
+int rb_cmpint(VALUE, VALUE, VALUE);
+NORETURN(void rb_cmperr(VALUE, VALUE));
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_COMPAR_H */
diff --git a/include/ruby/3/intern/complex.h b/include/ruby/3/intern/complex.h
new file mode 100644
index 0000000000..d9a0f15631
--- /dev/null
+++ b/include/ruby/3/intern/complex.h
@@ -0,0 +1,60 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to ::rb_cComplex.
+ */
+#ifndef RUBY3_INTERN_COMPLEX_H
+#define RUBY3_INTERN_COMPLEX_H
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+#include "ruby/3/arithmetic/long.h" /* INT2FIX is here. */
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* complex.c */
+VALUE rb_complex_raw(VALUE, VALUE);
+#define rb_complex_raw1(x) rb_complex_raw((x), INT2FIX(0))
+#define rb_complex_raw2(x,y) rb_complex_raw((x), (y))
+VALUE rb_complex_new(VALUE, VALUE);
+#define rb_complex_new1(x) rb_complex_new((x), INT2FIX(0))
+#define rb_complex_new2(x,y) rb_complex_new((x), (y))
+VALUE rb_complex_new_polar(VALUE abs, VALUE arg);
+DEPRECATED_BY(rb_complex_new_polar, VALUE rb_complex_polar(VALUE abs, VALUE arg));
+VALUE rb_complex_real(VALUE z);
+VALUE rb_complex_imag(VALUE z);
+VALUE rb_complex_plus(VALUE x, VALUE y);
+VALUE rb_complex_minus(VALUE x, VALUE y);
+VALUE rb_complex_mul(VALUE x, VALUE y);
+VALUE rb_complex_div(VALUE x, VALUE y);
+VALUE rb_complex_uminus(VALUE z);
+VALUE rb_complex_conjugate(VALUE z);
+VALUE rb_complex_abs(VALUE z);
+VALUE rb_complex_arg(VALUE z);
+VALUE rb_complex_pow(VALUE base, VALUE exp);
+VALUE rb_dbl_complex_new(double real, double imag);
+#define rb_complex_add rb_complex_plus
+#define rb_complex_sub rb_complex_minus
+#define rb_complex_nagate rb_complex_uminus
+
+VALUE rb_Complex(VALUE, VALUE);
+#define rb_Complex1(x) rb_Complex((x), INT2FIX(0))
+#define rb_Complex2(x,y) rb_Complex((x), (y))
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_COMPLEX_H */
diff --git a/include/ruby/3/intern/cont.h b/include/ruby/3/intern/cont.h
new file mode 100644
index 0000000000..95374f909c
--- /dev/null
+++ b/include/ruby/3/intern/cont.h
@@ -0,0 +1,40 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to rb_cFiber.
+ */
+#ifndef RUBY3_INTERN_CONT_H
+#define RUBY3_INTERN_CONT_H
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+#include "ruby/3/iterator.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* cont.c */
+VALUE rb_fiber_new(rb_block_call_func_t, VALUE);
+VALUE rb_fiber_resume(VALUE fib, int argc, const VALUE *argv);
+VALUE rb_fiber_resume_kw(VALUE fib, int argc, const VALUE *argv, int kw_splat);
+VALUE rb_fiber_yield(int argc, const VALUE *argv);
+VALUE rb_fiber_yield_kw(int argc, const VALUE *argv, int kw_splat);
+VALUE rb_fiber_current(void);
+VALUE rb_fiber_alive_p(VALUE);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_CONT_H */
diff --git a/include/ruby/3/intern/dir.h b/include/ruby/3/intern/dir.h
new file mode 100644
index 0000000000..1a7bfbe7de
--- /dev/null
+++ b/include/ruby/3/intern/dir.h
@@ -0,0 +1,33 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to ::rb_cDir.
+ */
+#ifndef RUBY3_INTERN_DIR_H
+#define RUBY3_INTERN_DIR_H
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* dir.c */
+VALUE rb_dir_getwd(void);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_DIR_H */
diff --git a/include/ruby/3/intern/enum.h b/include/ruby/3/intern/enum.h
new file mode 100644
index 0000000000..075cd2066a
--- /dev/null
+++ b/include/ruby/3/intern/enum.h
@@ -0,0 +1,33 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to ::rb_mEnumerable.
+ */
+#ifndef RUBY3_INTERN_ENUM_H
+#define RUBY3_INTERN_ENUM_H
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* enum.c */
+VALUE rb_enum_values_pack(int, const VALUE*);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_ENUM_H */
diff --git a/include/ruby/3/intern/enumerator.h b/include/ruby/3/intern/enumerator.h
new file mode 100644
index 0000000000..31efa07bd1
--- /dev/null
+++ b/include/ruby/3/intern/enumerator.h
@@ -0,0 +1,79 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to ::rb_cEnumerator.
+ */
+#ifndef RUBY3_INTERN_ENUMERATOR_H
+#define RUBY3_INTERN_ENUMERATOR_H
+#include "ruby/3/dllexport.h"
+#include "ruby/3/intern/eval.h" /* rb_frame_this_func */
+#include "ruby/3/iterator.h" /* rb_block_given_p */
+#include "ruby/3/symbol.h"
+#include "ruby/3/value.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+typedef VALUE rb_enumerator_size_func(VALUE, VALUE, VALUE);
+
+typedef struct {
+ VALUE begin;
+ VALUE end;
+ VALUE step;
+ int exclude_end;
+} rb_arithmetic_sequence_components_t;
+
+/* enumerator.c */
+VALUE rb_enumeratorize(VALUE, VALUE, int, const VALUE *);
+VALUE rb_enumeratorize_with_size(VALUE, VALUE, int, const VALUE *, rb_enumerator_size_func *);
+VALUE rb_enumeratorize_with_size_kw(VALUE, VALUE, int, const VALUE *, rb_enumerator_size_func *, int);
+int rb_arithmetic_sequence_extract(VALUE, rb_arithmetic_sequence_components_t *);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#ifndef RUBY_EXPORT
+# define rb_enumeratorize_with_size(obj, id, argc, argv, size_fn) \
+ rb_enumeratorize_with_size(obj, id, argc, argv, (rb_enumerator_size_func *)(size_fn))
+# define rb_enumeratorize_with_size_kw(obj, id, argc, argv, size_fn, kw_splat) \
+ rb_enumeratorize_with_size_kw(obj, id, argc, argv, (rb_enumerator_size_func *)(size_fn), kw_splat)
+#endif
+
+#define SIZED_ENUMERATOR(obj, argc, argv, size_fn) \
+ rb_enumeratorize_with_size((obj), ID2SYM(rb_frame_this_func()), \
+ (argc), (argv), (size_fn))
+
+#define SIZED_ENUMERATOR_KW(obj, argc, argv, size_fn, kw_splat) \
+ rb_enumeratorize_with_size_kw((obj), ID2SYM(rb_frame_this_func()), \
+ (argc), (argv), (size_fn), (kw_splat))
+
+#define RETURN_SIZED_ENUMERATOR(obj, argc, argv, size_fn) do { \
+ if (!rb_block_given_p()) \
+ return SIZED_ENUMERATOR(obj, argc, argv, size_fn); \
+ } while (0)
+
+#define RETURN_SIZED_ENUMERATOR_KW(obj, argc, argv, size_fn, kw_splat) do { \
+ if (!rb_block_given_p()) \
+ return SIZED_ENUMERATOR_KW(obj, argc, argv, size_fn, kw_splat); \
+ } while (0)
+
+#define RETURN_ENUMERATOR(obj, argc, argv) \
+ RETURN_SIZED_ENUMERATOR(obj, argc, argv, 0)
+
+#define RETURN_ENUMERATOR_KW(obj, argc, argv, kw_splat) \
+ RETURN_SIZED_ENUMERATOR_KW(obj, argc, argv, 0, kw_splat)
+
+#endif /* RUBY3_INTERN_ENUMERATOR_H */
diff --git a/include/ruby/3/intern/error.h b/include/ruby/3/intern/error.h
new file mode 100644
index 0000000000..a5b56db760
--- /dev/null
+++ b/include/ruby/3/intern/error.h
@@ -0,0 +1,82 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to ::rb_eException.
+ */
+#ifndef RUBY3_INTERN_ERROR_H
+#define RUBY3_INTERN_ERROR_H
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+#include "ruby/3/fl_type.h"
+#include "ruby/backward/2/assume.h"
+#include "ruby/backward/2/attributes.h"
+
+#define UNLIMITED_ARGUMENTS (-1)
+#define rb_exc_new2 rb_exc_new_cstr
+#define rb_exc_new3 rb_exc_new_str
+#define rb_check_trusted rb_check_trusted
+#define rb_check_trusted_inline rb_check_trusted
+#define rb_check_arity rb_check_arity
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* error.c */
+VALUE rb_exc_new(VALUE, const char*, long);
+VALUE rb_exc_new_cstr(VALUE, const char*);
+VALUE rb_exc_new_str(VALUE, VALUE);
+PRINTF_ARGS(NORETURN(void rb_loaderror(const char*, ...)), 1, 2);
+PRINTF_ARGS(NORETURN(void rb_loaderror_with_path(VALUE path, const char*, ...)), 2, 3);
+PRINTF_ARGS(NORETURN(void rb_name_error(ID, const char*, ...)), 2, 3);
+PRINTF_ARGS(NORETURN(void rb_name_error_str(VALUE, const char*, ...)), 2, 3);
+PRINTF_ARGS(NORETURN(void rb_frozen_error_raise(VALUE, const char*, ...)), 2, 3);
+NORETURN(void rb_invalid_str(const char*, const char*));
+NORETURN(void rb_error_frozen(const char*));
+NORETURN(void rb_error_frozen_object(VALUE));
+void rb_error_untrusted(VALUE);
+void rb_check_frozen(VALUE);
+void rb_check_trusted(VALUE);
+void rb_check_copyable(VALUE obj, VALUE orig);
+NORETURN(MJIT_STATIC void rb_error_arity(int, int, int));
+RUBY3_SYMBOL_EXPORT_END()
+
+/* Does anyone use this? Remain not deleted for compatibility. */
+#define rb_check_frozen_internal(obj) do { \
+ VALUE frozen_obj = (obj); \
+ if (RB_UNLIKELY(RB_OBJ_FROZEN(frozen_obj))) { \
+ rb_error_frozen_object(frozen_obj); \
+ } \
+ } while (0)
+
+static inline void
+rb_check_frozen_inline(VALUE obj)
+{
+ if (RB_UNLIKELY(RB_OBJ_FROZEN(obj))) {
+ rb_error_frozen_object(obj);
+ }
+}
+#define rb_check_frozen rb_check_frozen_inline
+
+static inline int
+rb_check_arity(int argc, int min, int max)
+{
+ if ((argc < min) || (max != UNLIMITED_ARGUMENTS && argc > max))
+ rb_error_arity(argc, min, max);
+ return argc;
+}
+
+#endif /* RUBY3_INTERN_ERROR_H */
diff --git a/include/ruby/3/intern/eval.h b/include/ruby/3/intern/eval.h
new file mode 100644
index 0000000000..158820d96a
--- /dev/null
+++ b/include/ruby/3/intern/eval.h
@@ -0,0 +1,59 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Pre-1.9 era evaluator APIs (now considered miscellaneous).
+ */
+#ifndef RUBY3_INTERN_EVAL_H
+#define RUBY3_INTERN_EVAL_H
+#include "ruby/3/attr/noreturn.h"
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* eval.c */
+RUBY3_ATTR_NORETURN()
+void rb_exc_raise(VALUE);
+
+RUBY3_ATTR_NORETURN()
+void rb_exc_fatal(VALUE);
+
+RUBY3_ATTR_NORETURN()
+VALUE rb_f_exit(int, const VALUE*);
+
+RUBY3_ATTR_NORETURN()
+VALUE rb_f_abort(int, const VALUE*);
+
+RUBY3_ATTR_NORETURN()
+void rb_interrupt(void);
+ID rb_frame_this_func(void);
+
+RUBY3_ATTR_NORETURN()
+void rb_jump_tag(int);
+void rb_obj_call_init(VALUE, int, const VALUE*);
+void rb_obj_call_init_kw(VALUE, int, const VALUE*, int);
+VALUE rb_protect(VALUE (*)(VALUE), VALUE, int*);
+ID rb_frame_callee(void);
+VALUE rb_make_exception(int, const VALUE*);
+
+/* eval_jump.c */
+void rb_set_end_proc(void (*)(VALUE), VALUE);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_EVAL_H */
diff --git a/include/ruby/3/intern/file.h b/include/ruby/3/intern/file.h
new file mode 100644
index 0000000000..a2d4a9996e
--- /dev/null
+++ b/include/ruby/3/intern/file.h
@@ -0,0 +1,44 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to ::rb_cFile.
+ */
+#ifndef RUBY3_INTERN_FILE_H
+#define RUBY3_INTERN_FILE_H
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* file.c */
+VALUE rb_file_s_expand_path(int, const VALUE *);
+VALUE rb_file_expand_path(VALUE, VALUE);
+VALUE rb_file_s_absolute_path(int, const VALUE *);
+VALUE rb_file_absolute_path(VALUE, VALUE);
+VALUE rb_file_dirname(VALUE fname);
+int rb_find_file_ext_safe(VALUE*, const char* const*, int); /* Remove in 3.0 */
+VALUE rb_find_file_safe(VALUE, int); /* Remove in 3.0 */
+int rb_find_file_ext(VALUE*, const char* const*);
+VALUE rb_find_file(VALUE);
+VALUE rb_file_directory_p(VALUE,VALUE);
+VALUE rb_str_encode_ospath(VALUE);
+int rb_is_absolute_path(const char *);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_FILE_H */
diff --git a/include/ruby/3/intern/gc.h b/include/ruby/3/intern/gc.h
new file mode 100644
index 0000000000..dd96229ace
--- /dev/null
+++ b/include/ruby/3/intern/gc.h
@@ -0,0 +1,57 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to ::rb_mGC.
+ */
+#ifndef RUBY3_INTERN_GC_H
+#define RUBY3_INTERN_GC_H
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+#include "ruby/backward/2/attributes.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* gc.c */
+COLDFUNC NORETURN(void rb_memerror(void));
+PUREFUNC(int rb_during_gc(void));
+void rb_gc_mark_locations(const VALUE*, const VALUE*);
+void rb_mark_tbl(struct st_table*);
+void rb_mark_tbl_no_pin(struct st_table*);
+void rb_mark_set(struct st_table*);
+void rb_mark_hash(struct st_table*);
+void rb_gc_update_tbl_refs(st_table *ptr);
+void rb_gc_mark_maybe(VALUE);
+void rb_gc_mark(VALUE);
+void rb_gc_mark_movable(VALUE);
+VALUE rb_gc_location(VALUE);
+void rb_gc_force_recycle(VALUE);
+void rb_gc(void);
+void rb_gc_copy_finalizer(VALUE,VALUE);
+VALUE rb_gc_enable(void);
+VALUE rb_gc_disable(void);
+VALUE rb_gc_start(void);
+VALUE rb_define_finalizer(VALUE, VALUE);
+VALUE rb_undefine_finalizer(VALUE);
+size_t rb_gc_count(void);
+size_t rb_gc_stat(VALUE);
+VALUE rb_gc_latest_gc_info(VALUE);
+void rb_gc_adjust_memory_usage(ssize_t);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_GC_H */
diff --git a/include/ruby/3/intern/hash.h b/include/ruby/3/intern/hash.h
new file mode 100644
index 0000000000..d39e420a22
--- /dev/null
+++ b/include/ruby/3/intern/hash.h
@@ -0,0 +1,59 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to ::rb_cHash.
+ */
+#ifndef RUBY3_INTERN_HASH_H
+#define RUBY3_INTERN_HASH_H
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+#include "ruby/st.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* hash.c */
+void rb_st_foreach_safe(struct st_table *, int (*)(st_data_t, st_data_t, st_data_t), st_data_t);
+#define st_foreach_safe rb_st_foreach_safe
+VALUE rb_check_hash_type(VALUE);
+void rb_hash_foreach(VALUE, int (*)(VALUE, VALUE, VALUE), VALUE);
+VALUE rb_hash(VALUE);
+VALUE rb_hash_new(void);
+VALUE rb_hash_dup(VALUE);
+VALUE rb_hash_freeze(VALUE);
+VALUE rb_hash_aref(VALUE, VALUE);
+VALUE rb_hash_lookup(VALUE, VALUE);
+VALUE rb_hash_lookup2(VALUE, VALUE, VALUE);
+VALUE rb_hash_fetch(VALUE, VALUE);
+VALUE rb_hash_aset(VALUE, VALUE, VALUE);
+VALUE rb_hash_clear(VALUE);
+VALUE rb_hash_delete_if(VALUE);
+VALUE rb_hash_delete(VALUE,VALUE);
+VALUE rb_hash_set_ifnone(VALUE hash, VALUE ifnone);
+void rb_hash_bulk_insert(long, const VALUE *, VALUE);
+typedef VALUE rb_hash_update_func(VALUE newkey, VALUE oldkey, VALUE value);
+VALUE rb_hash_update_by(VALUE hash1, VALUE hash2, rb_hash_update_func *func);
+struct st_table *rb_hash_tbl(VALUE, const char *file, int line);
+int rb_path_check(const char*);
+int rb_env_path_tainted(void);
+VALUE rb_env_clear(void);
+VALUE rb_hash_size(VALUE);
+void rb_hash_free(VALUE);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_HASH_H */
diff --git a/include/ruby/3/intern/io.h b/include/ruby/3/intern/io.h
new file mode 100644
index 0000000000..783f2515c2
--- /dev/null
+++ b/include/ruby/3/intern/io.h
@@ -0,0 +1,70 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to ::rb_cIO.
+ */
+#ifndef RUBY3_INTERN_IO_H
+#define RUBY3_INTERN_IO_H
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* io.c */
+#define rb_defout rb_stdout
+RUBY_EXTERN VALUE rb_fs;
+RUBY_EXTERN VALUE rb_output_fs;
+RUBY_EXTERN VALUE rb_rs;
+RUBY_EXTERN VALUE rb_default_rs;
+RUBY_EXTERN VALUE rb_output_rs;
+VALUE rb_io_write(VALUE, VALUE);
+VALUE rb_io_gets(VALUE);
+VALUE rb_io_getbyte(VALUE);
+VALUE rb_io_ungetc(VALUE, VALUE);
+VALUE rb_io_ungetbyte(VALUE, VALUE);
+VALUE rb_io_close(VALUE);
+VALUE rb_io_flush(VALUE);
+VALUE rb_io_eof(VALUE);
+VALUE rb_io_binmode(VALUE);
+VALUE rb_io_ascii8bit_binmode(VALUE);
+VALUE rb_io_addstr(VALUE, VALUE);
+VALUE rb_io_printf(int, const VALUE*, VALUE);
+VALUE rb_io_print(int, const VALUE*, VALUE);
+VALUE rb_io_puts(int, const VALUE*, VALUE);
+VALUE rb_io_fdopen(int, int, const char*);
+VALUE rb_io_get_io(VALUE);
+VALUE rb_file_open(const char*, const char*);
+VALUE rb_file_open_str(VALUE, const char*);
+VALUE rb_gets(void);
+void rb_write_error(const char*);
+void rb_write_error2(const char*, long);
+void rb_close_before_exec(int lowfd, int maxhint, VALUE noclose_fds);
+int rb_pipe(int *pipes);
+int rb_reserved_fd_p(int fd);
+int rb_cloexec_open(const char *pathname, int flags, mode_t mode);
+int rb_cloexec_dup(int oldfd);
+int rb_cloexec_dup2(int oldfd, int newfd);
+int rb_cloexec_pipe(int fildes[2]);
+int rb_cloexec_fcntl_dupfd(int fd, int minfd);
+#define RB_RESERVED_FD_P(fd) rb_reserved_fd_p(fd)
+void rb_update_max_fd(int fd);
+void rb_fd_fix_cloexec(int fd);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_IO_H */
diff --git a/include/ruby/3/intern/load.h b/include/ruby/3/intern/load.h
new file mode 100644
index 0000000000..0f26c9f136
--- /dev/null
+++ b/include/ruby/3/intern/load.h
@@ -0,0 +1,40 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to ::rb_f_require().
+ */
+#ifndef RUBY3_INTERN_LOAD_H
+#define RUBY3_INTERN_LOAD_H
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* load.c */
+void rb_load(VALUE, int);
+void rb_load_protect(VALUE, int, int*);
+int rb_provided(const char*);
+int rb_feature_provided(const char *, const char **);
+void rb_provide(const char*);
+VALUE rb_f_require(VALUE, VALUE);
+VALUE rb_require_safe(VALUE, int); /* Remove in 3.0 */
+VALUE rb_require_string(VALUE);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_LOAD_H */
diff --git a/include/ruby/3/intern/marshal.h b/include/ruby/3/intern/marshal.h
new file mode 100644
index 0000000000..5c46d04fab
--- /dev/null
+++ b/include/ruby/3/intern/marshal.h
@@ -0,0 +1,35 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to rb_mMarshal.
+ */
+#ifndef RUBY3_INTERN_MARSHAL_H
+#define RUBY3_INTERN_MARSHAL_H
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* marshal.c */
+VALUE rb_marshal_dump(VALUE, VALUE);
+VALUE rb_marshal_load(VALUE);
+void rb_marshal_define_compat(VALUE newclass, VALUE oldclass, VALUE (*dumper)(VALUE), VALUE (*loader)(VALUE, VALUE));
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_MARSHAL_H */
diff --git a/include/ruby/3/intern/numeric.h b/include/ruby/3/intern/numeric.h
new file mode 100644
index 0000000000..989ec7ee6a
--- /dev/null
+++ b/include/ruby/3/intern/numeric.h
@@ -0,0 +1,42 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to ::rb_cNumeric.
+ */
+#ifndef RUBY3_INTERN_NUMERIC_H
+#define RUBY3_INTERN_NUMERIC_H
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+#include "ruby/backward/2/attributes.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* numeric.c */
+NORETURN(void rb_num_zerodiv(void));
+#define RB_NUM_COERCE_FUNCS_NEED_OPID 1
+VALUE rb_num_coerce_bin(VALUE, VALUE, ID);
+VALUE rb_num_coerce_cmp(VALUE, VALUE, ID);
+VALUE rb_num_coerce_relop(VALUE, VALUE, ID);
+VALUE rb_num_coerce_bit(VALUE, VALUE, ID);
+VALUE rb_num2fix(VALUE);
+VALUE rb_fix2str(VALUE, int);
+CONSTFUNC(VALUE rb_dbl_cmp(double, double));
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_NUMERIC_H */
diff --git a/include/ruby/3/intern/object.h b/include/ruby/3/intern/object.h
new file mode 100644
index 0000000000..543985a489
--- /dev/null
+++ b/include/ruby/3/intern/object.h
@@ -0,0 +1,89 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to ::rb_cObject.
+ */
+#ifndef RUBY3_INTERN_OBJECT_H
+#define RUBY3_INTERN_OBJECT_H
+#include "ruby/3/attr/pure.h"
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+#define RB_OBJ_INIT_COPY(obj, orig) \
+ ((obj) != (orig) && (rb_obj_init_copy((obj), (orig)), 1))
+#define OBJ_INIT_COPY(obj, orig) RB_OBJ_INIT_COPY(obj, orig)
+
+VALUE rb_class_new_instance(int, const VALUE*, VALUE);
+VALUE rb_class_new_instance_kw(int, const VALUE*, VALUE, int);
+
+/* object.c */
+int rb_eql(VALUE, VALUE);
+VALUE rb_any_to_s(VALUE);
+VALUE rb_inspect(VALUE);
+VALUE rb_obj_is_instance_of(VALUE, VALUE);
+VALUE rb_obj_is_kind_of(VALUE, VALUE);
+VALUE rb_obj_alloc(VALUE);
+VALUE rb_obj_clone(VALUE);
+VALUE rb_obj_dup(VALUE);
+VALUE rb_obj_init_copy(VALUE,VALUE);
+VALUE rb_obj_taint(VALUE);
+
+RUBY3_ATTR_PURE()
+VALUE rb_obj_tainted(VALUE);
+VALUE rb_obj_untaint(VALUE);
+VALUE rb_obj_untrust(VALUE);
+
+RUBY3_ATTR_PURE()
+VALUE rb_obj_untrusted(VALUE);
+VALUE rb_obj_trust(VALUE);
+VALUE rb_obj_freeze(VALUE);
+
+RUBY3_ATTR_PURE()
+VALUE rb_obj_frozen_p(VALUE);
+
+VALUE rb_obj_id(VALUE);
+VALUE rb_memory_id(VALUE);
+VALUE rb_obj_class(VALUE);
+
+RUBY3_ATTR_PURE()
+VALUE rb_class_real(VALUE);
+
+RUBY3_ATTR_PURE()
+VALUE rb_class_inherited_p(VALUE, VALUE);
+VALUE rb_class_superclass(VALUE);
+VALUE rb_class_get_superclass(VALUE);
+VALUE rb_convert_type(VALUE,int,const char*,const char*);
+VALUE rb_check_convert_type(VALUE,int,const char*,const char*);
+VALUE rb_check_to_integer(VALUE, const char *);
+VALUE rb_check_to_float(VALUE);
+VALUE rb_to_int(VALUE);
+VALUE rb_check_to_int(VALUE);
+VALUE rb_Integer(VALUE);
+VALUE rb_to_float(VALUE);
+VALUE rb_Float(VALUE);
+VALUE rb_String(VALUE);
+VALUE rb_Array(VALUE);
+VALUE rb_Hash(VALUE);
+double rb_cstr_to_dbl(const char*, int);
+double rb_str_to_dbl(VALUE, int);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_OBJECT_H */
diff --git a/include/ruby/3/intern/parse.h b/include/ruby/3/intern/parse.h
new file mode 100644
index 0000000000..d89ef400c0
--- /dev/null
+++ b/include/ruby/3/intern/parse.h
@@ -0,0 +1,64 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to ::rb_cSymbol.
+ */
+#ifndef RUBY3_INTERN_PARSE_H
+#define RUBY3_INTERN_PARSE_H
+#include "ruby/3/attr/const.h"
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* parse.y */
+ID rb_id_attrset(ID);
+
+RUBY3_ATTR_CONST()
+int rb_is_const_id(ID);
+
+RUBY3_ATTR_CONST()
+int rb_is_global_id(ID);
+
+RUBY3_ATTR_CONST()
+int rb_is_instance_id(ID);
+
+RUBY3_ATTR_CONST()
+int rb_is_attrset_id(ID);
+
+RUBY3_ATTR_CONST()
+int rb_is_class_id(ID);
+
+RUBY3_ATTR_CONST()
+int rb_is_local_id(ID);
+
+RUBY3_ATTR_CONST()
+int rb_is_junk_id(ID);
+int rb_symname_p(const char*);
+int rb_sym_interned_p(VALUE);
+VALUE rb_backref_get(void);
+void rb_backref_set(VALUE);
+VALUE rb_lastline_get(void);
+void rb_lastline_set(VALUE);
+
+/* symbol.c */
+VALUE rb_sym_all_symbols(void);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_PARSE_H */
diff --git a/include/ruby/3/intern/proc.h b/include/ruby/3/intern/proc.h
new file mode 100644
index 0000000000..ce8304bb59
--- /dev/null
+++ b/include/ruby/3/intern/proc.h
@@ -0,0 +1,53 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to ::rb_cProc.
+ */
+#ifndef RUBY3_INTERN_PROC_H
+#define RUBY3_INTERN_PROC_H
+#include "ruby/3/dllexport.h"
+#include "ruby/3/iterator.h"
+#include "ruby/3/value.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* proc.c */
+VALUE rb_block_proc(void);
+VALUE rb_block_lambda(void);
+VALUE rb_proc_new(rb_block_call_func_t, VALUE);
+VALUE rb_obj_is_proc(VALUE);
+VALUE rb_proc_call(VALUE, VALUE);
+VALUE rb_proc_call_kw(VALUE, VALUE, int);
+VALUE rb_proc_call_with_block(VALUE, int argc, const VALUE *argv, VALUE);
+VALUE rb_proc_call_with_block_kw(VALUE, int argc, const VALUE *argv, VALUE, int);
+int rb_proc_arity(VALUE);
+VALUE rb_proc_lambda_p(VALUE);
+VALUE rb_binding_new(void);
+VALUE rb_obj_method(VALUE, VALUE);
+VALUE rb_obj_is_method(VALUE);
+VALUE rb_method_call(int, const VALUE*, VALUE);
+VALUE rb_method_call_kw(int, const VALUE*, VALUE, int);
+VALUE rb_method_call_with_block(int, const VALUE *, VALUE, VALUE);
+VALUE rb_method_call_with_block_kw(int, const VALUE *, VALUE, VALUE, int);
+int rb_mod_method_arity(VALUE, ID);
+int rb_obj_method_arity(VALUE, ID);
+VALUE rb_protect(VALUE (*)(VALUE), VALUE, int*);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_PROC_H */
diff --git a/include/ruby/3/intern/process.h b/include/ruby/3/intern/process.h
new file mode 100644
index 0000000000..efa830aa6c
--- /dev/null
+++ b/include/ruby/3/intern/process.h
@@ -0,0 +1,46 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to ::rb_mProcess.
+ */
+#ifndef RUBY3_INTERN_PROCESS_H
+#define RUBY3_INTERN_PROCESS_H
+#include "ruby/3/attr/noreturn.h"
+#include "ruby/3/config.h" /* rb_pid_t is defined here. */
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* process.c */
+void rb_last_status_set(int status, rb_pid_t pid);
+VALUE rb_last_status_get(void);
+int rb_proc_exec(const char*);
+
+RUBY3_ATTR_NORETURN()
+VALUE rb_f_exec(int, const VALUE*);
+rb_pid_t rb_waitpid(rb_pid_t pid, int *status, int flags);
+void rb_syswait(rb_pid_t pid);
+rb_pid_t rb_spawn(int, const VALUE*);
+rb_pid_t rb_spawn_err(int, const VALUE*, char*, size_t);
+VALUE rb_proc_times(VALUE);
+VALUE rb_detach_process(rb_pid_t pid);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_PROCESS_H */
diff --git a/include/ruby/3/intern/random.h b/include/ruby/3/intern/random.h
new file mode 100644
index 0000000000..8493cf1d7d
--- /dev/null
+++ b/include/ruby/3/intern/random.h
@@ -0,0 +1,45 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief MT19937 backended pseudo random number generator.
+ * @see Matsumoto, M., Nishimura, T., "Mersenne Twister: A 623-
+ * dimensionally equidistributed uniform pseudorandom number
+ * generator", ACM Trans. on Modeling and Computer Simulation, 8
+ * (1): pp 3-30, 1998. https://doi.org/10.1145/272991.272995
+ */
+#ifndef RUBY3_INTERN_RANDOM_H
+#define RUBY3_INTERN_RANDOM_H
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* random.c */
+unsigned int rb_genrand_int32(void);
+double rb_genrand_real(void);
+void rb_reset_random_seed(void);
+VALUE rb_random_bytes(VALUE rnd, long n);
+VALUE rb_random_int(VALUE rnd, VALUE max);
+unsigned int rb_random_int32(VALUE rnd);
+double rb_random_real(VALUE rnd);
+unsigned long rb_random_ulong_limited(VALUE rnd, unsigned long limit);
+unsigned long rb_genrand_ulong_limited(unsigned long i);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_RANDOM_H */
diff --git a/include/ruby/3/intern/range.h b/include/ruby/3/intern/range.h
new file mode 100644
index 0000000000..0fb6a20a3d
--- /dev/null
+++ b/include/ruby/3/intern/range.h
@@ -0,0 +1,35 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to ::rb_cRange.
+ */
+#ifndef RUBY3_INTERN_RANGE_H
+#define RUBY3_INTERN_RANGE_H
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* range.c */
+VALUE rb_range_new(VALUE, VALUE, int);
+VALUE rb_range_beg_len(VALUE, long*, long*, long, int);
+int rb_range_values(VALUE range, VALUE *begp, VALUE *endp, int *exclp);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_RANGE_H */
diff --git a/include/ruby/3/intern/rational.h b/include/ruby/3/intern/rational.h
new file mode 100644
index 0000000000..3eccd7f1d5
--- /dev/null
+++ b/include/ruby/3/intern/rational.h
@@ -0,0 +1,46 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to ::rb_cRational.
+ */
+#ifndef RUBY3_INTERN_RATIONAL_H
+#define RUBY3_INTERN_RATIONAL_H
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+#include "ruby/3/arithmetic/long.h" /* INT2FIX is here. */
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* rational.c */
+VALUE rb_rational_raw(VALUE, VALUE);
+#define rb_rational_raw1(x) rb_rational_raw((x), INT2FIX(1))
+#define rb_rational_raw2(x,y) rb_rational_raw((x), (y))
+VALUE rb_rational_new(VALUE, VALUE);
+#define rb_rational_new1(x) rb_rational_new((x), INT2FIX(1))
+#define rb_rational_new2(x,y) rb_rational_new((x), (y))
+VALUE rb_Rational(VALUE, VALUE);
+#define rb_Rational1(x) rb_Rational((x), INT2FIX(1))
+#define rb_Rational2(x,y) rb_Rational((x), (y))
+VALUE rb_rational_num(VALUE rat);
+VALUE rb_rational_den(VALUE rat);
+VALUE rb_flt_rationalize_with_prec(VALUE, VALUE);
+VALUE rb_flt_rationalize(VALUE);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_RATIONAL_H */
diff --git a/include/ruby/3/intern/re.h b/include/ruby/3/intern/re.h
new file mode 100644
index 0000000000..090fbe4511
--- /dev/null
+++ b/include/ruby/3/intern/re.h
@@ -0,0 +1,50 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to ::rb_cRegexp.
+ */
+#ifndef RUBY3_INTERN_RE_H
+#define RUBY3_INTERN_RE_H
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* re.c */
+#define rb_memcmp memcmp
+int rb_memcicmp(const void*,const void*,long);
+void rb_match_busy(VALUE);
+VALUE rb_reg_nth_defined(int, VALUE);
+VALUE rb_reg_nth_match(int, VALUE);
+int rb_reg_backref_number(VALUE match, VALUE backref);
+VALUE rb_reg_last_match(VALUE);
+VALUE rb_reg_match_pre(VALUE);
+VALUE rb_reg_match_post(VALUE);
+VALUE rb_reg_match_last(VALUE);
+#define HAVE_RB_REG_NEW_STR 1
+VALUE rb_reg_new_str(VALUE, int);
+VALUE rb_reg_new(const char *, long, int);
+VALUE rb_reg_alloc(void);
+VALUE rb_reg_init_str(VALUE re, VALUE s, int options);
+VALUE rb_reg_match(VALUE, VALUE);
+VALUE rb_reg_match2(VALUE);
+int rb_reg_options(VALUE);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_RE_H */
diff --git a/include/ruby/3/intern/ruby.h b/include/ruby/3/intern/ruby.h
new file mode 100644
index 0000000000..f41a4d2ee7
--- /dev/null
+++ b/include/ruby/3/intern/ruby.h
@@ -0,0 +1,37 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Process-global APIs.
+ */
+#ifndef RUBY3_INTERN_RUBY_H
+#define RUBY3_INTERN_RUBY_H
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* ruby.c */
+#define rb_argv rb_get_argv()
+RUBY_EXTERN VALUE rb_argv0;
+VALUE rb_get_argv(void);
+void *rb_load_file(const char*);
+void *rb_load_file_str(VALUE);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_RUBY_H */
diff --git a/include/ruby/3/intern/select.h b/include/ruby/3/intern/select.h
new file mode 100644
index 0000000000..a4be259cc2
--- /dev/null
+++ b/include/ruby/3/intern/select.h
@@ -0,0 +1,52 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs to provide ::rb_fd_select().
+ * @note Functions and structs defined in this header file are not
+ * necessarily ruby-specific. They don't need ::VALUE etc.
+ */
+#ifndef RUBY3_INTERN_SELECT_H
+#define RUBY3_INTERN_SELECT_H
+#include "ruby/3/config.h"
+
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h> /* for NFDBITS (BSD Net/2) */
+#endif
+
+#include "ruby/3/dllexport.h"
+
+/* thread.c */
+#if defined(NFDBITS) && defined(HAVE_RB_FD_INIT)
+# include "ruby/3/intern/select/largesize.h"
+#elif defined(_WIN32)
+# include "ruby/3/intern/select/win32.h"
+# define rb_fd_resize(n, f) ((void)(f))
+#else
+# include "ruby/3/intern/select/posix.h"
+# define rb_fd_resize(n, f) ((void)(f))
+#endif
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+struct timeval;
+
+int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_SELECT_H */
diff --git a/include/ruby/3/intern/select/largesize.h b/include/ruby/3/intern/select/largesize.h
new file mode 100644
index 0000000000..2bf88ffed4
--- /dev/null
+++ b/include/ruby/3/intern/select/largesize.h
@@ -0,0 +1,103 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs to provide ::rb_fd_select().
+ *
+ * Several Unix platforms support file descriptors bigger than FD_SETSIZE in
+ * `select(2)` system call.
+ *
+ * - Linux 2.2.12 (?)
+ *
+ * - NetBSD 1.2 (src/sys/kern/sys_generic.c:1.25)
+ * `select(2)` documents how to allocate fd_set dynamically.
+ * http://netbsd.gw.com/cgi-bin/man-cgi?select++NetBSD-4.0
+ *
+ * - FreeBSD 2.2 (src/sys/kern/sys_generic.c:1.19)
+ *
+ * - OpenBSD 2.0 (src/sys/kern/sys_generic.c:1.4)
+ * `select(2)` documents how to allocate fd_set dynamically.
+ * http://www.openbsd.org/cgi-bin/man.cgi?query=select&manpath=OpenBSD+4.4
+ *
+ * - HP-UX documents how to allocate fd_set dynamically.
+ * http://docs.hp.com/en/B2355-60105/select.2.html
+ *
+ * - Solaris 8 has `select_large_fdset`
+ *
+ * - Mac OS X 10.7 (Lion)
+ * `select(2)` returns `EINVAL` if `nfds` is greater than `FD_SET_SIZE` and
+ * `_DARWIN_UNLIMITED_SELECT` (or `_DARWIN_C_SOURCE`) isn't defined.
+ * http://developer.apple.com/library/mac/#releasenotes/Darwin/SymbolVariantsRelNotes/_index.html
+ *
+ * When `fd_set` is not big enough to hold big file descriptors, it should be
+ * allocated dynamically. Note that this assumes `fd_set` is structured as
+ * bitmap.
+ *
+ * `rb_fd_init` allocates the memory.
+ * `rb_fd_term` frees the memory.
+ * `rb_fd_set` may re-allocate bitmap.
+ *
+ * So `rb_fd_set` doesn't reject file descriptors bigger than `FD_SETSIZE`.
+ */
+#ifndef RUBY3_INTERN_SELECT_LARGESIZE_H
+#define RUBY3_INTERN_SELECT_LARGESIZE_H
+#include "ruby/3/attr/nonnull.h"
+#include "ruby/3/attr/pure.h"
+#include "ruby/3/dllexport.h"
+
+/**@cond INTERNAL_MACRO */
+#define rb_fd_ptr rb_fd_ptr
+#define rb_fd_max rb_fd_max
+/** @endcond */
+
+struct timeval;
+
+typedef struct {
+ int maxfd;
+ fd_set *fdset;
+} rb_fdset_t;
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+void rb_fd_init(rb_fdset_t *);
+void rb_fd_term(rb_fdset_t *);
+void rb_fd_zero(rb_fdset_t *);
+void rb_fd_set(int, rb_fdset_t *);
+void rb_fd_clr(int, rb_fdset_t *);
+int rb_fd_isset(int, const rb_fdset_t *);
+void rb_fd_copy(rb_fdset_t *, const fd_set *, int);
+void rb_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src);
+int rb_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
+RUBY3_SYMBOL_EXPORT_END()
+
+RUBY3_ATTR_NONNULL(())
+RUBY3_ATTR_PURE()
+/* :TODO: can this function be __attribute__((returns_nonnull)) or not? */
+static inline fd_set *
+rb_fd_ptr(const rb_fdset_t *f)
+{
+ return f->fdset;
+}
+
+RUBY3_ATTR_NONNULL(())
+RUBY3_ATTR_PURE()
+static inline int
+rb_fd_max(const rb_fdset_t *f)
+{
+ return f->maxfd;
+}
+
+#endif /* RUBY3_INTERN_SELECT_LARGESIZE_H */
diff --git a/include/ruby/3/intern/select/posix.h b/include/ruby/3/intern/select/posix.h
new file mode 100644
index 0000000000..83d93e99d9
--- /dev/null
+++ b/include/ruby/3/intern/select/posix.h
@@ -0,0 +1,82 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs to provide ::rb_fd_select().
+ */
+#ifndef RUBY3_INTERN_SELECT_POSIX_H
+#define RUBY3_INTERN_SELECT_POSIX_H
+#include "ruby/3/config.h"
+
+#ifdef HAVE_SYS_SELECT_H
+# include <sys/select.h> /* for select(2) (modern POSIX) */
+#endif
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h> /* for select(2) (archaic UNIX) */
+#endif
+
+#include "ruby/3/attr/pure.h"
+#include "ruby/3/attr/const.h"
+
+typedef fd_set rb_fdset_t;
+
+#define rb_fd_zero FD_ZERO
+#define rb_fd_set FD_SET
+#define rb_fd_clr FD_CLR
+#define rb_fd_isset FD_ISSET
+#define rb_fd_init FD_ZERO
+#define rb_fd_select select
+/**@cond INTERNAL_MACRO */
+#define rb_fd_copy rb_fd_copy
+#define rb_fd_dup rb_fd_dup
+#define rb_fd_ptr rb_fd_ptr
+#define rb_fd_max rb_fd_max
+/** @endcond */
+
+static inline void
+rb_fd_copy(rb_fdset_t *dst, const fd_set *src, int n)
+{
+ *dst = *src;
+}
+
+static inline void
+rb_fd_dup(rb_fdset_t *dst, const fd_set *src, int n)
+{
+ *dst = *src;
+}
+
+RUBY3_ATTR_PURE()
+/* :TODO: can this function be __attribute__((returns_nonnull)) or not? */
+static inline fd_set *
+rb_fd_ptr(rb_fdset_t *f)
+{
+ return f;
+}
+
+RUBY3_ATTR_CONST()
+static inline int
+rb_fd_max(const rb_fdset_t *f)
+{
+ return FD_SETSIZE;
+}
+
+/* :FIXME: What are these? They don't exist for shibling implementations. */
+#define rb_fd_init_copy(d, s) (*(d) = *(s))
+#define rb_fd_term(f) ((void)(f))
+
+#endif /* RUBY3_INTERN_SELECT_POSIX_H */
diff --git a/include/ruby/3/intern/select/win32.h b/include/ruby/3/intern/select/win32.h
new file mode 100644
index 0000000000..8977624dc8
--- /dev/null
+++ b/include/ruby/3/intern/select/win32.h
@@ -0,0 +1,124 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs to provide ::rb_fd_select().
+ */
+#ifndef RUBY3_INTERN_SELECT_WIN32_H
+#define RUBY3_INTERN_SELECT_WIN32_H
+#include "ruby/3/dosish.h" /* for rb_w32_select */
+#include "ruby/3/attr/nonnull.h"
+#include "ruby/3/attr/pure.h"
+#include "ruby/3/attr/noalias.h"
+#include "ruby/3/dllexport.h"
+#include "ruby/assert.h"
+
+/**@cond INTERNAL_MACRO */
+#define rb_fd_zero rb_fd_zero
+#define rb_fd_clr rb_fd_clr
+#define rb_fd_isset rb_fd_isset
+#define rb_fd_copy rb_fd_copy
+#define rb_fd_dup rb_fd_dup
+#define rb_fd_ptr rb_fd_ptr
+#define rb_fd_max rb_fd_max
+/** @endcond */
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+struct timeval;
+
+typedef struct {
+ int capa;
+ fd_set *fdset;
+} rb_fdset_t;
+
+void rb_fd_init(rb_fdset_t *);
+void rb_fd_term(rb_fdset_t *);
+void rb_fd_set(int, rb_fdset_t *);
+void rb_w32_fd_copy(rb_fdset_t *, const fd_set *, int);
+void rb_w32_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+RUBY3_ATTR_NONNULL(())
+RUBY3_ATTR_NOALIAS()
+static inline void
+rb_fd_zero(rb_fdset_t *f)
+{
+ f->fdset->fd_count = 0;
+}
+
+RUBY3_ATTR_NONNULL(())
+static inline void
+rb_fd_clr(int n, rb_fdset_t *f)
+{
+ rb_w32_fdclr(n, f->fdset);
+}
+
+RUBY3_ATTR_NONNULL(())
+static inline int
+rb_fd_isset(int n, rb_fdset_t *f)
+{
+ return rb_w32_fdisset(n, f->fdset);
+}
+
+RUBY3_ATTR_NONNULL(())
+static inline void
+rb_fd_copy(rb_fdset_t *dst, const fd_set *src, int n)
+{
+ rb_w32_fd_copy(dst, src, n);
+}
+
+RUBY3_ATTR_NONNULL(())
+static inline void
+rb_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src)
+{
+ rb_w32_fd_dup(dst, src);
+}
+
+static inline int
+rb_fd_select(int n, rb_fdset_t *rfds, rb_fdset_t *wfds, rb_fdset_t *efds, struct timeval *timeout)
+{
+ return rb_w32_select(
+ n,
+ rfds ? rfds->fdset : NULL,
+ wfds ? wfds->fdset : NULL,
+ efds ? efds->fdset : NULL,
+ timeout);
+}
+
+RUBY3_ATTR_NONNULL(())
+RUBY3_ATTR_PURE()
+/* :TODO: can this function be __attribute__((returns_nonnull)) or not? */
+static inline fd_set *
+rb_fd_ptr(const rb_fdset_t *f)
+{
+ return f->fdset;
+}
+
+RUBY3_ATTR_NONNULL(())
+RUBY3_ATTR_PURE()
+static inline int
+rb_fd_max(const rb_fdset_t *f)
+{
+ const fd_set *p = f->fdset;
+
+ RUBY3_ASSERT_OR_ASSUME(p);
+ return p->fd_count;
+}
+
+#endif /* RUBY3_INTERN_SELECT_WIN32_H */
diff --git a/include/ruby/3/intern/signal.h b/include/ruby/3/intern/signal.h
new file mode 100644
index 0000000000..f4fa08732e
--- /dev/null
+++ b/include/ruby/3/intern/signal.h
@@ -0,0 +1,40 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Signal handling APIs.
+ */
+#ifndef RUBY3_INTERN_SIGNAL_H
+#define RUBY3_INTERN_SIGNAL_H
+#include "ruby/3/config.h" /* POSIX_SIGNAL / RETSIGTYPE */
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* signal.c */
+VALUE rb_f_kill(int, const VALUE*);
+#ifdef POSIX_SIGNAL
+#define posix_signal ruby_posix_signal
+RETSIGTYPE (*posix_signal(int, RETSIGTYPE (*)(int)))(int);
+#endif
+const char *ruby_signal_name(int);
+void ruby_default_signal(int);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_SIGNAL_H */
diff --git a/include/ruby/3/intern/sprintf.h b/include/ruby/3/intern/sprintf.h
new file mode 100644
index 0000000000..d65517af83
--- /dev/null
+++ b/include/ruby/3/intern/sprintf.h
@@ -0,0 +1,43 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Our own private printf(3).
+ */
+#ifndef RUBY3_INTERN_SPRINTF_H
+#define RUBY3_INTERN_SPRINTF_H
+#include "ruby/3/attr/format.h"
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* sprintf.c */
+VALUE rb_f_sprintf(int, const VALUE*);
+
+RUBY3_ATTR_FORMAT(RUBY3_PRINTF_FORMAT, 1, 2)
+VALUE rb_sprintf(const char*, ...);
+VALUE rb_vsprintf(const char*, va_list);
+
+RUBY3_ATTR_FORMAT(RUBY3_PRINTF_FORMAT, 2, 3)
+VALUE rb_str_catf(VALUE, const char*, ...);
+VALUE rb_str_vcatf(VALUE, const char*, va_list);
+VALUE rb_str_format(int, const VALUE *, VALUE);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_SPRINTF_H */
diff --git a/include/ruby/3/intern/string.h b/include/ruby/3/intern/string.h
new file mode 100644
index 0000000000..5ac355af38
--- /dev/null
+++ b/include/ruby/3/intern/string.h
@@ -0,0 +1,326 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to ::rb_cString.
+ */
+#ifndef RUBY3_INTERN_STRING_H
+#define RUBY3_INTERN_STRING_H
+#include "ruby/3/config.h"
+
+#ifdef STDC_HEADERS
+# include <stddef.h>
+#endif
+
+#ifdef HAVE_STRING_H
+# include <string.h>
+#endif
+
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+
+#include "ruby/3/attr/nonnull.h"
+#include "ruby/3/attr/pure.h"
+#include "ruby/3/constant_p.h"
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+#include "ruby/3/variable.h" /* rb_gvar_setter_t */
+#include "ruby/st.h" /* st_index_t */
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* string.c */
+VALUE rb_str_new(const char*, long);
+VALUE rb_str_new_cstr(const char*);
+VALUE rb_str_new_shared(VALUE);
+VALUE rb_str_new_frozen(VALUE);
+VALUE rb_str_new_with_class(VALUE, const char*, long);
+VALUE rb_tainted_str_new_cstr(const char*);
+VALUE rb_tainted_str_new(const char*, long);
+VALUE rb_external_str_new(const char*, long);
+VALUE rb_external_str_new_cstr(const char*);
+VALUE rb_locale_str_new(const char*, long);
+VALUE rb_locale_str_new_cstr(const char*);
+VALUE rb_filesystem_str_new(const char*, long);
+VALUE rb_filesystem_str_new_cstr(const char*);
+VALUE rb_str_buf_new(long);
+VALUE rb_str_buf_new_cstr(const char*);
+VALUE rb_str_buf_new2(const char*);
+VALUE rb_str_tmp_new(long);
+VALUE rb_usascii_str_new(const char*, long);
+VALUE rb_usascii_str_new_cstr(const char*);
+VALUE rb_utf8_str_new(const char*, long);
+VALUE rb_utf8_str_new_cstr(const char*);
+VALUE rb_str_new_static(const char *, long);
+VALUE rb_usascii_str_new_static(const char *, long);
+VALUE rb_utf8_str_new_static(const char *, long);
+void rb_str_free(VALUE);
+void rb_str_shared_replace(VALUE, VALUE);
+VALUE rb_str_buf_append(VALUE, VALUE);
+VALUE rb_str_buf_cat(VALUE, const char*, long);
+VALUE rb_str_buf_cat2(VALUE, const char*);
+VALUE rb_str_buf_cat_ascii(VALUE, const char*);
+VALUE rb_obj_as_string(VALUE);
+VALUE rb_check_string_type(VALUE);
+void rb_must_asciicompat(VALUE);
+VALUE rb_str_dup(VALUE);
+VALUE rb_str_resurrect(VALUE str);
+VALUE rb_str_locktmp(VALUE);
+VALUE rb_str_unlocktmp(VALUE);
+VALUE rb_str_dup_frozen(VALUE);
+#define rb_str_dup_frozen rb_str_new_frozen
+VALUE rb_str_plus(VALUE, VALUE);
+VALUE rb_str_times(VALUE, VALUE);
+long rb_str_sublen(VALUE, long);
+VALUE rb_str_substr(VALUE, long, long);
+VALUE rb_str_subseq(VALUE, long, long);
+char *rb_str_subpos(VALUE, long, long*);
+void rb_str_modify(VALUE);
+void rb_str_modify_expand(VALUE, long);
+VALUE rb_str_freeze(VALUE);
+void rb_str_set_len(VALUE, long);
+VALUE rb_str_resize(VALUE, long);
+VALUE rb_str_cat(VALUE, const char*, long);
+VALUE rb_str_cat_cstr(VALUE, const char*);
+VALUE rb_str_cat2(VALUE, const char*);
+VALUE rb_str_append(VALUE, VALUE);
+VALUE rb_str_concat(VALUE, VALUE);
+st_index_t rb_memhash(const void *ptr, long len);
+st_index_t rb_hash_start(st_index_t);
+st_index_t rb_hash_uint32(st_index_t, uint32_t);
+st_index_t rb_hash_uint(st_index_t, st_index_t);
+st_index_t rb_hash_end(st_index_t);
+#define rb_hash_uint32(h, i) st_hash_uint32((h), (i))
+#define rb_hash_uint(h, i) st_hash_uint((h), (i))
+#define rb_hash_end(h) st_hash_end(h)
+st_index_t rb_str_hash(VALUE);
+int rb_str_hash_cmp(VALUE,VALUE);
+int rb_str_comparable(VALUE, VALUE);
+int rb_str_cmp(VALUE, VALUE);
+VALUE rb_str_equal(VALUE str1, VALUE str2);
+VALUE rb_str_drop_bytes(VALUE, long);
+void rb_str_update(VALUE, long, long, VALUE);
+VALUE rb_str_replace(VALUE, VALUE);
+VALUE rb_str_inspect(VALUE);
+VALUE rb_str_dump(VALUE);
+VALUE rb_str_split(VALUE, const char*);
+rb_gvar_setter_t rb_str_setter;
+VALUE rb_str_intern(VALUE);
+VALUE rb_sym_to_s(VALUE);
+long rb_str_strlen(VALUE);
+VALUE rb_str_length(VALUE);
+long rb_str_offset(VALUE, long);
+RUBY3_ATTR_PURE()
+size_t rb_str_capacity(VALUE);
+VALUE rb_str_ellipsize(VALUE, long);
+VALUE rb_str_scrub(VALUE, VALUE);
+VALUE rb_str_succ(VALUE);
+
+RUBY3_ATTR_NONNULL(())
+static inline long
+ruby3_strlen(const char *str)
+{
+ return RUBY3_CAST((long)strlen(str));
+}
+
+static inline VALUE
+ruby3_str_new(const char *str, long len)
+{
+ if /* constexpr */ (! RUBY3_CONSTANT_P(str)) {
+ return rb_str_new(str, len);
+ }
+ else if /* constexpr */ (! RUBY3_CONSTANT_P(len)) {
+ return rb_str_new(str, len);
+ }
+ else {
+ return rb_str_new_static(str, len);
+ }
+}
+
+static inline VALUE
+ruby3_str_new_cstr(const char *str)
+{
+ if /* constexpr */ (! RUBY3_CONSTANT_P(str)) {
+ return rb_str_new_cstr(str);
+ }
+ else {
+ long len = ruby3_strlen(str);
+ return rb_str_new_static(str, len);
+ }
+}
+
+static inline VALUE
+ruby3_usascii_str_new(const char *str, long len)
+{
+ if /* constexpr */ (! RUBY3_CONSTANT_P(str)) {
+ return rb_usascii_str_new(str, len);
+ }
+ else if /* constexpr */ (! RUBY3_CONSTANT_P(len)) {
+ return rb_usascii_str_new(str, len);
+ }
+ else {
+ return rb_usascii_str_new_static(str, len);
+ }
+}
+
+static inline VALUE
+ruby3_utf8_str_new(const char *str, long len)
+{
+ if /* constexpr */ (! RUBY3_CONSTANT_P(str)) {
+ return rb_utf8_str_new(str, len);
+ }
+ else if /* constexpr */ (! RUBY3_CONSTANT_P(len)) {
+ return rb_utf8_str_new(str, len);
+ }
+ else {
+ return rb_utf8_str_new_static(str, len);
+ }
+}
+
+static inline VALUE
+ruby3_tainted_str_new_cstr(const char *str)
+{
+ if /* constexpr */ (! RUBY3_CONSTANT_P(str)) {
+ return rb_tainted_str_new_cstr(str);
+ }
+ else {
+ long len = ruby3_strlen(str);
+ return rb_tainted_str_new(str, len);
+ }
+}
+
+static inline VALUE
+ruby3_usascii_str_new_cstr(const char *str)
+{
+ if /* constexpr */ (! RUBY3_CONSTANT_P(str)) {
+ return rb_usascii_str_new_cstr(str);
+ }
+ else {
+ long len = ruby3_strlen(str);
+ return rb_usascii_str_new_static(str, len);
+ }
+}
+
+static inline VALUE
+ruby3_utf8_str_new_cstr(const char *str)
+{
+ if /* constexpr */ (! RUBY3_CONSTANT_P(str)) {
+ return rb_utf8_str_new_cstr(str);
+ }
+ else {
+ long len = ruby3_strlen(str);
+ return rb_utf8_str_new_static(str, len);
+ }
+}
+
+static inline VALUE
+ruby3_external_str_new_cstr(const char *str)
+{
+ if /* constexpr */ (! RUBY3_CONSTANT_P(str)) {
+ return rb_external_str_new_cstr(str);
+ }
+ else {
+ long len = ruby3_strlen(str);
+ return rb_external_str_new(str, len);
+ }
+}
+
+static inline VALUE
+ruby3_locale_str_new_cstr(const char *str)
+{
+ if /* constexpr */ (! RUBY3_CONSTANT_P(str)) {
+ return rb_locale_str_new_cstr(str);
+ }
+ else {
+ long len = ruby3_strlen(str);
+ return rb_locale_str_new(str, len);
+ }
+}
+
+static inline VALUE
+ruby3_str_buf_new_cstr(const char *str)
+{
+ if /* constexpr */ (! RUBY3_CONSTANT_P(str)) {
+ return rb_str_buf_new_cstr(str);
+ }
+ else {
+ long len = ruby3_strlen(str);
+ VALUE buf = rb_str_buf_new(len);
+ return rb_str_buf_cat(buf, str, len);
+ }
+}
+
+static inline VALUE
+ruby3_str_cat_cstr(VALUE buf, const char *str)
+{
+ if /* constexpr */ (! RUBY3_CONSTANT_P(str)) {
+ return rb_str_cat_cstr(buf, str);
+ }
+ else {
+ long len = ruby3_strlen(str);
+ return rb_str_cat(buf, str, len);
+ }
+}
+
+static inline VALUE
+ruby3_exc_new_cstr(VALUE exc, const char *str)
+{
+ if /* constexpr */ (! RUBY3_CONSTANT_P(str)) {
+ return rb_exc_new_cstr(exc, str);
+ }
+ else {
+ long len = ruby3_strlen(str);
+ return rb_exc_new(exc, str, len);
+ }
+}
+
+#define rb_str_new ruby3_str_new
+#define rb_str_new_cstr ruby3_str_new_cstr
+#define rb_usascii_str_new ruby3_usascii_str_new
+#define rb_utf8_str_new ruby3_utf8_str_new
+#define rb_tainted_str_new_cstr ruby3_tainted_str_new_cstr
+#define rb_usascii_str_new_cstr ruby3_usascii_str_new_cstr
+#define rb_utf8_str_new_cstr ruby3_utf8_str_new_cstr
+#define rb_external_str_new_cstr ruby3_external_str_new_cstr
+#define rb_locale_str_new_cstr ruby3_locale_str_new_cstr
+#define rb_str_buf_new_cstr ruby3_str_buf_new_cstr
+#define rb_str_cat_cstr ruby3_str_cat_cstr
+#define rb_exc_new_cstr ruby3_exc_new_cstr
+#define rb_str_new2 rb_str_new_cstr
+#define rb_str_new3 rb_str_new_shared
+#define rb_str_new4 rb_str_new_frozen
+#define rb_str_new5 rb_str_new_with_class
+#define rb_tainted_str_new2 rb_tainted_str_new_cstr
+#define rb_str_buf_new2 rb_str_buf_new_cstr
+#define rb_usascii_str_new2 rb_usascii_str_new_cstr
+#define rb_str_buf_cat rb_str_cat
+#define rb_str_buf_cat2 rb_str_cat_cstr
+#define rb_str_cat2 rb_str_cat_cstr
+#define rb_strlen_lit(str) (sizeof(str "") - 1)
+#define rb_str_new_lit(str) rb_str_new_static((str), rb_strlen_lit(str))
+#define rb_usascii_str_new_lit(str) rb_usascii_str_new_static((str), rb_strlen_lit(str))
+#define rb_utf8_str_new_lit(str) rb_utf8_str_new_static((str), rb_strlen_lit(str))
+#define rb_enc_str_new_lit(str, enc) rb_enc_str_new_static((str), rb_strlen_lit(str), (enc))
+#define rb_str_new_literal(str) rb_str_new_lit(str)
+#define rb_usascii_str_new_literal(str) rb_usascii_str_new_lit(str)
+#define rb_utf8_str_new_literal(str) rb_utf8_str_new_lit(str)
+#define rb_enc_str_new_literal(str, enc) rb_enc_str_new_lit(str, enc)
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_STRING_H */
diff --git a/include/ruby/3/intern/struct.h b/include/ruby/3/intern/struct.h
new file mode 100644
index 0000000000..25e80a28b8
--- /dev/null
+++ b/include/ruby/3/intern/struct.h
@@ -0,0 +1,47 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to ::rb_cStruct.
+ */
+#ifndef RUBY3_INTERN_STRUCT_H
+#define RUBY3_INTERN_STRUCT_H
+#include "ruby/3/dllexport.h"
+#include "ruby/3/intern/vm.h" /* rb_alloc_func_t */
+#include "ruby/3/value.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* struct.c */
+VALUE rb_struct_new(VALUE, ...);
+VALUE rb_struct_define(const char*, ...);
+VALUE rb_struct_define_under(VALUE, const char*, ...);
+VALUE rb_struct_alloc(VALUE, VALUE);
+VALUE rb_struct_initialize(VALUE, VALUE);
+VALUE rb_struct_aref(VALUE, VALUE);
+VALUE rb_struct_aset(VALUE, VALUE, VALUE);
+VALUE rb_struct_getmember(VALUE, ID);
+VALUE rb_struct_s_members(VALUE);
+VALUE rb_struct_members(VALUE);
+VALUE rb_struct_size(VALUE s);
+VALUE rb_struct_alloc_noinit(VALUE);
+VALUE rb_struct_define_without_accessor(const char *, VALUE, rb_alloc_func_t, ...);
+VALUE rb_struct_define_without_accessor_under(VALUE outer, const char *class_name, VALUE super, rb_alloc_func_t alloc, ...);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_STRUCT_H */
diff --git a/include/ruby/3/intern/thread.h b/include/ruby/3/intern/thread.h
new file mode 100644
index 0000000000..51f20eeab2
--- /dev/null
+++ b/include/ruby/3/intern/thread.h
@@ -0,0 +1,77 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to ::rb_cThread.
+ */
+#ifndef RUBY3_INTERN_THREAD_H
+#define RUBY3_INTERN_THREAD_H
+#include "ruby/3/config.h"
+
+#include "ruby/3/cast.h"
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+struct timeval;
+
+/* thread.c */
+void rb_thread_schedule(void);
+void rb_thread_wait_fd(int);
+int rb_thread_fd_writable(int);
+void rb_thread_fd_close(int);
+int rb_thread_alone(void);
+void rb_thread_sleep(int);
+void rb_thread_sleep_forever(void);
+void rb_thread_sleep_deadly(void);
+VALUE rb_thread_stop(void);
+VALUE rb_thread_wakeup(VALUE);
+VALUE rb_thread_wakeup_alive(VALUE);
+VALUE rb_thread_run(VALUE);
+VALUE rb_thread_kill(VALUE);
+VALUE rb_thread_create(VALUE (*)(void *), void*);
+void rb_thread_wait_for(struct timeval);
+VALUE rb_thread_current(void);
+VALUE rb_thread_main(void);
+VALUE rb_thread_local_aref(VALUE, ID);
+VALUE rb_thread_local_aset(VALUE, ID, VALUE);
+void rb_thread_atfork(void);
+void rb_thread_atfork_before_exec(void);
+VALUE rb_exec_recursive(VALUE(*)(VALUE, VALUE, int),VALUE,VALUE);
+VALUE rb_exec_recursive_paired(VALUE(*)(VALUE, VALUE, int),VALUE,VALUE,VALUE);
+VALUE rb_exec_recursive_outer(VALUE(*)(VALUE, VALUE, int),VALUE,VALUE);
+VALUE rb_exec_recursive_paired_outer(VALUE(*)(VALUE, VALUE, int),VALUE,VALUE,VALUE);
+
+typedef void rb_unblock_function_t(void *);
+typedef VALUE rb_blocking_function_t(void *);
+void rb_thread_check_ints(void);
+int rb_thread_interrupted(VALUE thval);
+
+#define RUBY_UBF_IO RUBY3_CAST((rb_unblock_function_t *)-1)
+#define RUBY_UBF_PROCESS RUBY3_CAST((rb_unblock_function_t *)-1)
+VALUE rb_mutex_new(void);
+VALUE rb_mutex_locked_p(VALUE mutex);
+VALUE rb_mutex_trylock(VALUE mutex);
+VALUE rb_mutex_lock(VALUE mutex);
+VALUE rb_mutex_unlock(VALUE mutex);
+VALUE rb_mutex_sleep(VALUE self, VALUE timeout);
+VALUE rb_mutex_synchronize(VALUE mutex, VALUE (*func)(VALUE arg), VALUE arg);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_THREAD_H */
diff --git a/include/ruby/3/intern/time.h b/include/ruby/3/intern/time.h
new file mode 100644
index 0000000000..d66d740679
--- /dev/null
+++ b/include/ruby/3/intern/time.h
@@ -0,0 +1,52 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to ::rb_cStruct.
+ */
+#ifndef RUBY3_INTERN_TIME_H
+#define RUBY3_INTERN_TIME_H
+#include "ruby/3/config.h"
+
+#ifdef HAVE_TIME_H
+# include <time.h> /* for time_t */
+#endif
+
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+struct timespec;
+struct timeval;
+
+/* time.c */
+void rb_timespec_now(struct timespec *);
+VALUE rb_time_new(time_t, long);
+VALUE rb_time_nano_new(time_t, long);
+VALUE rb_time_timespec_new(const struct timespec *, int);
+VALUE rb_time_num_new(VALUE, VALUE);
+struct timeval rb_time_interval(VALUE num);
+struct timeval rb_time_timeval(VALUE time);
+struct timespec rb_time_timespec(VALUE time);
+struct timespec rb_time_timespec_interval(VALUE num);
+VALUE rb_time_utc_offset(VALUE time);
+VALUE rb_time_succ(VALUE);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_TIME_H */
diff --git a/include/ruby/3/intern/variable.h b/include/ruby/3/intern/variable.h
new file mode 100644
index 0000000000..36408bf788
--- /dev/null
+++ b/include/ruby/3/intern/variable.h
@@ -0,0 +1,83 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to names inside of a Ruby program.
+ */
+#ifndef RUBY3_INTERN_VARIABLE_H
+#define RUBY3_INTERN_VARIABLE_H
+#include "ruby/3/attr/noreturn.h"
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+#include "ruby/st.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* variable.c */
+VALUE rb_mod_name(VALUE);
+VALUE rb_class_path(VALUE);
+VALUE rb_class_path_cached(VALUE);
+void rb_set_class_path(VALUE, VALUE, const char*);
+void rb_set_class_path_string(VALUE, VALUE, VALUE);
+VALUE rb_path_to_class(VALUE);
+VALUE rb_path2class(const char*);
+VALUE rb_class_name(VALUE);
+VALUE rb_autoload_load(VALUE, ID);
+VALUE rb_autoload_p(VALUE, ID);
+VALUE rb_f_trace_var(int, const VALUE*);
+VALUE rb_f_untrace_var(int, const VALUE*);
+VALUE rb_f_global_variables(void);
+void rb_alias_variable(ID, ID);
+void rb_copy_generic_ivar(VALUE,VALUE);
+void rb_free_generic_ivar(VALUE);
+VALUE rb_ivar_get(VALUE, ID);
+VALUE rb_ivar_set(VALUE, ID, VALUE);
+VALUE rb_ivar_defined(VALUE, ID);
+void rb_ivar_foreach(VALUE, int (*)(ID, VALUE, st_data_t), st_data_t);
+st_index_t rb_ivar_count(VALUE);
+VALUE rb_attr_get(VALUE, ID);
+VALUE rb_obj_instance_variables(VALUE);
+VALUE rb_obj_remove_instance_variable(VALUE, VALUE);
+void *rb_mod_const_at(VALUE, void*);
+void *rb_mod_const_of(VALUE, void*);
+VALUE rb_const_list(void*);
+VALUE rb_mod_constants(int, const VALUE *, VALUE);
+VALUE rb_mod_remove_const(VALUE, VALUE);
+int rb_const_defined(VALUE, ID);
+int rb_const_defined_at(VALUE, ID);
+int rb_const_defined_from(VALUE, ID);
+VALUE rb_const_get(VALUE, ID);
+VALUE rb_const_get_at(VALUE, ID);
+VALUE rb_const_get_from(VALUE, ID);
+void rb_const_set(VALUE, ID, VALUE);
+VALUE rb_const_remove(VALUE, ID);
+#if 0 /* EXPERIMENTAL: remove if no problem */
+RUBY3_ATTR_NORETURN()
+VALUE rb_mod_const_missing(VALUE,VALUE);
+#endif
+VALUE rb_cvar_defined(VALUE, ID);
+void rb_cvar_set(VALUE, ID, VALUE);
+VALUE rb_cvar_get(VALUE, ID);
+void rb_cv_set(VALUE, const char*, VALUE);
+VALUE rb_cv_get(VALUE, const char*);
+void rb_define_class_variable(VALUE, const char*, VALUE);
+VALUE rb_mod_class_variables(int, const VALUE*, VALUE);
+VALUE rb_mod_remove_cvar(VALUE, VALUE);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_VARIABLE_H */
diff --git a/include/ruby/3/intern/vm.h b/include/ruby/3/intern/vm.h
new file mode 100644
index 0000000000..53b2b9f8bc
--- /dev/null
+++ b/include/ruby/3/intern/vm.h
@@ -0,0 +1,77 @@
+/** \noop-*-C++-*-vi:ft=cpp
+ * @file
+ * @author Ruby developers <ruby-core@ruby-lang.org>
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
+ * implementation details. Don't take them as canon. They could
+ * rapidly appear then vanish. The name (path) of this header file
+ * is also an implementation detail. Do not expect it to persist
+ * at the place it is now. Developers are free to move it anywhere
+ * anytime at will.
+ * @note To ruby-core: remember that this header can be possibly
+ * recursively included from extension libraries written in C++.
+ * Do not expect for instance `__VA_ARGS__` is always available.
+ * We assume C99 for ruby itself but we don't assume languages of
+ * extension libraries. They could be written in C++98.
+ * @brief Public APIs related to ::rb_cRubyVM.
+ */
+#ifndef RUBY3_INTERN_VM_H
+#define RUBY3_INTERN_VM_H
+#include "ruby/3/attr/noreturn.h"
+#include "ruby/3/dllexport.h"
+#include "ruby/3/value.h"
+
+RUBY3_SYMBOL_EXPORT_BEGIN()
+
+/* vm.c */
+int rb_sourceline(void);
+const char *rb_sourcefile(void);
+int rb_frame_method_id_and_class(ID *idp, VALUE *klassp);
+
+/* vm_eval.c */
+VALUE rb_check_funcall(VALUE, ID, int, const VALUE*);
+VALUE rb_check_funcall_kw(VALUE, ID, int, const VALUE*, int);
+void rb_remove_method(VALUE, const char*);
+void rb_remove_method_id(VALUE, ID);
+
+VALUE rb_eval_cmd_kw(VALUE, VALUE, int);
+VALUE rb_apply(VALUE, ID, VALUE);
+
+VALUE rb_obj_instance_eval(int, const VALUE*, VALUE);
+VALUE rb_obj_instance_exec(int, const VALUE*, VALUE);
+VALUE rb_mod_module_eval(int, const VALUE*, VALUE);
+VALUE rb_mod_module_exec(int, const VALUE*, VALUE);
+
+/* vm_method.c */
+#define HAVE_RB_DEFINE_ALLOC_FUNC 1
+typedef VALUE (*rb_alloc_func_t)(VALUE);
+void rb_define_alloc_func(VALUE, rb_alloc_func_t);
+void rb_undef_alloc_func(VALUE);
+rb_alloc_func_t rb_get_alloc_func(VALUE);
+void rb_clear_constant_cache(void);
+void rb_clear_method_cache_by_class(VALUE);
+void rb_alias(VALUE, ID, ID);
+void rb_attr(VALUE,ID,int,int,int);
+int rb_method_boundp(VALUE, ID, int);
+int rb_method_basic_definition_p(VALUE, ID);
+
+int rb_obj_respond_to(VALUE, ID, int);
+int rb_respond_to(VALUE, ID);
+
+RUBY3_ATTR_NORETURN()
+VALUE rb_f_notimplement(int argc, const VALUE *argv, VALUE obj, VALUE marker);
+#if !defined(RUBY_EXPORT) && defined(_WIN32)
+RUBY_EXTERN VALUE (*const rb_f_notimplement_)(int, const VALUE *, VALUE, VALUE marker);
+#define rb_f_notimplement (*rb_f_notimplement_)
+#endif
+
+/* vm_backtrace.c */
+void rb_backtrace(void);
+VALUE rb_make_backtrace(void);
+
+RUBY3_SYMBOL_EXPORT_END()
+
+#endif /* RUBY3_INTERN_VM_H */