diff --git a/ChangeLog b/ChangeLog index a61ff61c9f46ae..a1a8f14dd28393 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +Sat Jun 18 07:27:27 2011 Tanaka Akira + + * internal.h: declare internal functions here. + + * node.h: declare NODE dependent internal functions here. + + * iseq.h: declare rb_iseq_t dependent internal functions here. + + * vm_core.h: declare rb_thread_t dependent internal functions here. + + * bignum.c, class.c, compile.c, complex.c, cont.c, dir.c, encoding.c, + enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c, io.c, + iseq.c, load.c, marshal.c, math.c, numeric.c, object.c, parse.y, + proc.c, process.c, range.c, rational.c, re.c, ruby.c, string.c, + thread.c, time.c, transcode.c, variable.c, vm.c, + tool/compile_prelude.rb: don't declare internal functions declared + in above headers. include above headers if required. + + Note that rb_thread_mark() was declared as + void rb_thread_mark(rb_thread_t *th) in cont.c but defined as + void rb_thread_mark(void *ptr) in vm.c. Now it is declared as + the later in internal.h. + Sat Jun 18 02:36:00 2011 Kenta Murata * ext/bigdecimal/bigdecimal.c (VpNewRbClass): fix type of the 2nd diff --git a/bignum.c b/bignum.c index b322a659ac75a7..809b164ff71dac 100644 --- a/bignum.c +++ b/bignum.c @@ -11,6 +11,7 @@ #include "ruby/ruby.h" #include "ruby/util.h" +#include "internal.h" #include #include diff --git a/class.c b/class.c index 828719c4ee0278..c6d011f2b61b97 100644 --- a/class.c +++ b/class.c @@ -120,8 +120,6 @@ rb_class_new(VALUE super) return rb_class_boot(super); } -VALUE rb_iseq_clone(VALUE iseqval, VALUE newcbase); - static void rb_mod_clone_method(VALUE klass, ID mid, const rb_method_entry_t *me) { diff --git a/compile.c b/compile.c index 6d596e6af2c246..b0e4514f4c87f2 100644 --- a/compile.c +++ b/compile.c @@ -10,6 +10,7 @@ **********************************************************************/ #include "ruby/ruby.h" +#include "internal.h" #include #define USE_INSN_STACK_INCREASE 1 @@ -155,7 +156,6 @@ r_value(VALUE value) #endif #if CPDEBUG > 1 || CPDEBUG < 0 -PRINTF_ARGS(void ruby_debug_printf(const char*, ...), 1, 2); #define debugs if (compile_debug_print_indent(1)) ruby_debug_printf #define debug_compile(msg, v) ((void)(compile_debug_print_indent(1) && fputs((msg), stderr)), (v)) #else diff --git a/complex.c b/complex.c index decd996a91cfdc..7189e8bdf81a5e 100644 --- a/complex.c +++ b/complex.c @@ -6,6 +6,7 @@ */ #include "ruby.h" +#include "internal.h" #include #define NDEBUG @@ -508,8 +509,6 @@ imp2(hypot) #define m_hypot(x,y) m_hypot_bang((x),(y)) -extern VALUE rb_math_log(int argc, VALUE *argv); - static VALUE m_log_bang(VALUE x) { @@ -1092,8 +1091,6 @@ nucomp_inexact_p(VALUE self) } #endif -extern VALUE rb_lcm(VALUE x, VALUE y); - /* * call-seq: * cmp.denominator -> integer diff --git a/cont.c b/cont.c index 81bad6acee179b..f5e66987516113 100644 --- a/cont.c +++ b/cont.c @@ -10,6 +10,7 @@ **********************************************************************/ #include "ruby/ruby.h" +#include "internal.h" #include "vm_core.h" #include "gc.h" #include "eval_intern.h" @@ -126,7 +127,6 @@ static VALUE rb_eFiberError; NOINLINE(static VALUE cont_capture(volatile int *stat)); -void rb_thread_mark(rb_thread_t *th); #define THREAD_MUST_BE_RUNNING(th) do { \ if (!(th)->tag) rb_raise(rb_eThreadError, "not running thread"); \ } while (0) @@ -409,8 +409,6 @@ cont_new(VALUE klass) return cont; } -void rb_vm_stack_to_heap(rb_thread_t *th); - static VALUE cont_capture(volatile int *stat) { diff --git a/dir.c b/dir.c index 71df5dab98ad83..f8ad02d205ae40 100644 --- a/dir.c +++ b/dir.c @@ -13,6 +13,7 @@ #include "ruby/ruby.h" #include "ruby/encoding.h" +#include "internal.h" #include #include @@ -1996,8 +1997,6 @@ file_s_fnmatch(int argc, VALUE *argv, VALUE obj) return Qfalse; } -VALUE rb_home_dir(const char *user, VALUE result); - /* * call-seq: * Dir.home() -> "/home/me" diff --git a/encoding.c b/encoding.c index d152d77321a91d..95b2767911578b 100644 --- a/encoding.c +++ b/encoding.c @@ -11,6 +11,7 @@ #include "ruby/ruby.h" #include "ruby/encoding.h" +#include "internal.h" #include "regenc.h" #include #ifndef NO_LOCALE_CHARMAP diff --git a/enumerator.c b/enumerator.c index 3f8d63286fbc7e..a1577ae5b022d9 100644 --- a/enumerator.c +++ b/enumerator.c @@ -1018,8 +1018,6 @@ generator_init(VALUE obj, VALUE proc) return obj; } -VALUE rb_obj_is_proc(VALUE proc); - /* :nodoc: */ static VALUE generator_initialize(int argc, VALUE *argv, VALUE obj) diff --git a/error.c b/error.c index b89818337ee718..7c95455826dacb 100644 --- a/error.c +++ b/error.c @@ -12,6 +12,7 @@ #include "ruby/ruby.h" #include "ruby/st.h" #include "ruby/encoding.h" +#include "internal.h" #include "vm_core.h" #include @@ -230,8 +231,6 @@ rb_warn_m(VALUE self, VALUE mesg) return Qnil; } -void rb_vm_bugreport(void); - static void report_bug(const char *file, int line, const char *fmt, va_list args) { diff --git a/eval.c b/eval.c index 73b0a243f78fcc..87a1ac2e2caac7 100644 --- a/eval.c +++ b/eval.c @@ -16,6 +16,7 @@ #include "gc.h" #include "ruby/vm.h" #include "ruby/encoding.h" +#include "internal.h" #include "vm_core.h" #define numberof(array) (int)(sizeof(array) / sizeof((array)[0])) @@ -35,12 +36,6 @@ VALUE rb_eSysStackError; /* initialize ruby */ -void rb_clear_trace_func(void); - -void rb_call_inits(void); -void Init_heap(void); -void Init_BareVM(void); - void ruby_init(void) { @@ -69,8 +64,6 @@ ruby_init(void) GET_VM()->running = 1; } -extern void rb_clear_trace_func(void); - void * ruby_options(int argc, char **argv) { @@ -1053,9 +1046,6 @@ top_include(int argc, VALUE *argv, VALUE self) return rb_mod_include(argc, argv, rb_cObject); } -VALUE rb_f_trace_var(); -VALUE rb_f_untrace_var(); - static VALUE * errinfo_place(rb_thread_t *th) { diff --git a/file.c b/file.c index d75398f3060942..bbe77d7a04c8c8 100644 --- a/file.c +++ b/file.c @@ -23,6 +23,7 @@ #include "ruby/io.h" #include "ruby/util.h" #include "dln.h" +#include "internal.h" #ifdef HAVE_UNISTD_H #include @@ -2203,8 +2204,6 @@ rb_file_s_lchown(int argc, VALUE *argv) #define rb_file_s_lchown rb_f_notimplement #endif -struct timespec rb_time_timespec(VALUE time); - struct utime_args { const struct timespec* tsp; VALUE atime, mtime; @@ -5088,8 +5087,6 @@ is_explicit_relative(const char *path) return isdirsep(*path); } -VALUE rb_get_load_path(void); - static VALUE copy_path_class(VALUE path, VALUE orig) { diff --git a/gc.c b/gc.c index 137504ca7edc0c..d5b8dfd58f22e5 100644 --- a/gc.c +++ b/gc.c @@ -50,8 +50,6 @@ # define VALGRIND_MAKE_MEM_UNDEFINED(p, n) /* empty */ #endif -int rb_io_fptr_finalize(struct rb_io_t*); - #define rb_setjmp(env) RUBY_SETJMP(env) #define rb_jmp_buf rb_jmpbuf_t @@ -2364,8 +2362,6 @@ obj_free(rb_objspace_t *objspace, VALUE obj) #define GC_NOTIFY 0 -void rb_vm_mark(void *ptr); - #if STACK_GROW_DIRECTION < 0 #define GET_STACK_BOUNDS(start, end, appendix) ((start) = STACK_END, (end) = STACK_START) #elif STACK_GROW_DIRECTION > 0 @@ -2406,8 +2402,6 @@ mark_current_machine_context(rb_objspace_t *objspace, rb_thread_t *th) #endif } -void rb_gc_mark_encodings(void); - static void gc_clear_mark_on_sweep_slots(rb_objspace_t *objspace) { diff --git a/hash.c b/hash.c index 742cbc62054c47..aa038a7147d247 100644 --- a/hash.c +++ b/hash.c @@ -690,8 +690,6 @@ rb_hash_default_proc(VALUE hash) return Qnil; } -VALUE rb_obj_is_proc(VALUE proc); - /* * call-seq: * hsh.default_proc = proc_obj -> proc_obj diff --git a/inits.c b/inits.c index 6fb7463c57c3e8..73b9eb4283cf5d 100644 --- a/inits.c +++ b/inits.c @@ -10,6 +10,7 @@ **********************************************************************/ #include "ruby/ruby.h" +#include "internal.h" #define CALL(n) {void Init_##n(void); Init_##n();} diff --git a/internal.h b/internal.h index bf1fcd5bb348f5..0bcfb7b8c48311 100644 --- a/internal.h +++ b/internal.h @@ -25,13 +25,128 @@ struct rb_classext_struct { struct st_table *const_tbl; }; +/* bignum.c */ +VALUE rb_big_fdiv(VALUE x, VALUE y); VALUE rb_big_uminus(VALUE x); -VALUE rb_obj_is_thread(VALUE obj); -VALUE rb_obj_is_mutex(VALUE obj); +/* class.c */ +VALUE rb_obj_methods(int argc, VALUE *argv, VALUE obj); +VALUE rb_obj_protected_methods(int argc, VALUE *argv, VALUE obj); +VALUE rb_obj_private_methods(int argc, VALUE *argv, VALUE obj); +VALUE rb_obj_public_methods(int argc, VALUE *argv, VALUE obj); + +/* compile.c */ +int rb_dvar_defined(ID); +int rb_local_defined(ID); +int rb_parse_in_eval(void); +int rb_parse_in_main(void); + +/* debug.c */ +PRINTF_ARGS(void ruby_debug_printf(const char*, ...), 1, 2); + +/* dmyext.c */ +void Init_ext(void); + +/* encoding.c */ +ID rb_id_encoding(void); + +/* encoding.c */ +void rb_gc_mark_encodings(void); + +/* file.c */ +VALUE rb_home_dir(const char *user, VALUE result); +VALUE rb_realpath_internal(VALUE basedir, VALUE path, int strict); +void Init_File(void); + +/* gc.c */ +void Init_heap(void); + +/* inits.c */ +void rb_call_inits(void); + +/* io.c */ +const char *ruby_get_inplace_mode(void); +void ruby_set_inplace_mode(const char *); +int rb_io_fptr_finalize(struct rb_io_t*); +ssize_t rb_io_bufwrite(VALUE io, const void *buf, size_t size); +ssize_t rb_io_bufread(VALUE io, void *buf, size_t size); +void rb_stdio_set_default_encoding(void); + +/* iseq.c */ +VALUE rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE filepath, VALUE line, VALUE opt); +VALUE rb_iseq_clone(VALUE iseqval, VALUE newcbase); + +/* load.c */ +VALUE rb_get_load_path(void); + +/* math.c */ +VALUE rb_math_log(int argc, VALUE *argv); + +/* newline.c */ +void Init_newline(void); + +/* numeric.c */ +VALUE rb_rational_reciprocal(VALUE x); +int rb_num_to_uint(VALUE val, unsigned int *ret); +/* parse.y */ +VALUE rb_parser_get_yydebug(VALUE); +VALUE rb_parser_set_yydebug(VALUE, VALUE); + +/* rational.c */ +VALUE rb_lcm(VALUE x, VALUE y); + +/* re.c */ +VALUE rb_reg_compile(VALUE str, int options, const char *sourcefile, int sourceline); +VALUE rb_reg_check_preprocess(VALUE); + +/* signal.c */ +int rb_get_next_signal(void); + +/* string.c */ +int rb_str_buf_cat_escaped_char(VALUE result, unsigned int c, int unicode_p); + +/* struct.c */ +VALUE rb_struct_init_copy(VALUE copy, VALUE s); + +/* time.c */ +struct timespec rb_time_timespec(VALUE time); +struct timeval rb_time_timeval(VALUE); +struct timeval rb_time_interval(VALUE); + +/* thread.c */ +VALUE rb_obj_is_mutex(VALUE obj); +VALUE ruby_suppress_tracing(VALUE (*func)(VALUE, int), VALUE arg, int always); void rb_thread_execute_interrupts(VALUE th); void *rb_thread_call_with_gvl(void *(*func)(void *), void *data1); +void rb_clear_trace_func(void); +VALUE rb_thread_backtrace(VALUE thval); + +/* thread_pthread.c, thread_win32.c */ +void Init_native_thread(void); + +/* variable.c */ +VALUE rb_f_trace_var(int argc, VALUE *argv); +VALUE rb_f_untrace_var(int argc, VALUE *argv); + +/* vm.c */ +VALUE rb_obj_is_thread(VALUE obj); +void rb_vm_mark(void *ptr); +void Init_BareVM(void); +VALUE rb_vm_top_self(void); +void rb_thread_recycle_stack_release(VALUE *); +void rb_vm_change_state(void); +void rb_vm_inc_const_missing_count(void); +void rb_thread_mark(void *th); + +/* vm_dump.c */ +void rb_vm_bugreport(void); + +/* vm_eval.c */ +VALUE rb_funcall_passing_block(VALUE recv, ID mid, int argc, const VALUE *argv); + +/* miniprelude.c, prelude.c */ +void Init_prelude(void); #if defined(__cplusplus) #if 0 diff --git a/io.c b/io.c index 657ffe41150d6f..9ce544c2ee42c5 100644 --- a/io.c +++ b/io.c @@ -82,8 +82,6 @@ #include #endif -extern void Init_File(void); - #if defined(__BEOS__) || defined(__HAIKU__) # ifndef NOFILE # define NOFILE (OPEN_MAX) @@ -142,8 +140,6 @@ static ID id_write, id_read, id_getc, id_flush, id_readpartial, id_set_encoding; static VALUE sym_mode, sym_perm, sym_extenc, sym_intenc, sym_encoding, sym_open_args; static VALUE sym_textmode, sym_binmode, sym_autoclose; -struct timeval rb_time_interval(VALUE); - struct argf { VALUE filename, current_file; long last_lineno; /* $. */ diff --git a/iseq.c b/iseq.c index b821c602a3e390..25fc7929558d31 100644 --- a/iseq.c +++ b/iseq.c @@ -10,6 +10,7 @@ **********************************************************************/ #include "ruby/ruby.h" +#include "internal.h" /* #define RUBY_MARK_FREE_DEBUG 1 */ #include "gc.h" @@ -217,8 +218,6 @@ set_relation(rb_iseq_t *iseq, const VALUE parent) } } -VALUE rb_realpath_internal(VALUE basedir, VALUE path, int strict); - static VALUE prepare_iseq_build(rb_iseq_t *iseq, VALUE name, VALUE filename, VALUE filepath, VALUE line_no, diff --git a/iseq.h b/iseq.h index d2aab1cc24541e..b626682bed34a9 100644 --- a/iseq.h +++ b/iseq.h @@ -24,6 +24,7 @@ VALUE rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args, /* iseq.c */ VALUE rb_iseq_load(VALUE data, VALUE parent, VALUE opt); +VALUE rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc); struct st_table *ruby_insn_make_insn_table(void); struct rb_compile_option_struct { diff --git a/load.c b/load.c index 098772e92790b4..5d9d293273aa55 100644 --- a/load.c +++ b/load.c @@ -4,6 +4,7 @@ #include "ruby/ruby.h" #include "ruby/util.h" +#include "internal.h" #include "dln.h" #include "eval_intern.h" @@ -267,7 +268,6 @@ rb_provide(const char *feature) } NORETURN(static void load_failed(VALUE)); -VALUE rb_realpath_internal(VALUE basedir, VALUE path, int strict); static void rb_load_internal(VALUE fname, int wrap) diff --git a/marshal.c b/marshal.c index 141288058b857f..557436894a0e6f 100644 --- a/marshal.c +++ b/marshal.c @@ -83,8 +83,6 @@ static ID s_dump, s_load, s_mdump, s_mload; static ID s_dump_data, s_load_data, s_alloc, s_call; static ID s_getbyte, s_read, s_write, s_binmode; -ID rb_id_encoding(void); - typedef struct { VALUE newclass; VALUE oldclass; diff --git a/math.c b/math.c index e3a78f74e3c510..7e073d7fe79a39 100644 --- a/math.c +++ b/math.c @@ -10,6 +10,7 @@ **********************************************************************/ #include "ruby/ruby.h" +#include "internal.h" #include #include @@ -18,7 +19,6 @@ VALUE rb_mMath; VALUE rb_eMathDomainError; -extern VALUE rb_to_float(VALUE val); #define Need_Float(x) do {if (TYPE(x) != T_FLOAT) {(x) = rb_to_float(x);}} while(0) #define Need_Float2(x,y) do {\ Need_Float(x);\ diff --git a/node.h b/node.h index 9e922a4dbdec0b..bb96107711a2bb 100644 --- a/node.h +++ b/node.h @@ -457,6 +457,9 @@ VALUE rb_parser_end_seen_p(VALUE); VALUE rb_parser_encoding(VALUE); VALUE rb_parser_get_yydebug(VALUE); VALUE rb_parser_set_yydebug(VALUE, VALUE); +VALUE rb_parser_dump_tree(NODE *node, int comment); +NODE *rb_parser_append_print(VALUE, NODE *); +NODE *rb_parser_while_loop(VALUE, NODE *, int, int); NODE *rb_parser_compile_cstr(volatile VALUE, const char*, const char*, int, int); NODE *rb_parser_compile_string(volatile VALUE, const char*, VALUE, int); diff --git a/numeric.c b/numeric.c index 1ec36ed7f87fdb..7a38404ab7dc15 100644 --- a/numeric.c +++ b/numeric.c @@ -2445,8 +2445,6 @@ fixdivmod(long x, long y, long *divp, long *modp) if (modp) *modp = mod; } -VALUE rb_big_fdiv(VALUE x, VALUE y); - /* * call-seq: * fix.fdiv(numeric) -> float @@ -2475,8 +2473,6 @@ fix_fdiv(VALUE x, VALUE y) } } -VALUE rb_rational_reciprocal(VALUE x); - static VALUE fix_divide(VALUE x, VALUE y, ID op) { diff --git a/object.c b/object.c index 9cf925b7654af3..62edcb6c47421d 100644 --- a/object.c +++ b/object.c @@ -1838,11 +1838,6 @@ rb_mod_const_defined(int argc, VALUE *argv, VALUE mod) return RTEST(recur) ? rb_const_defined(mod, id) : rb_const_defined_at(mod, id); } -VALUE rb_obj_methods(int argc, VALUE *argv, VALUE obj); /* in class.c */ -VALUE rb_obj_protected_methods(int argc, VALUE *argv, VALUE obj); /* in class.c */ -VALUE rb_obj_private_methods(int argc, VALUE *argv, VALUE obj); /* in class.c */ -VALUE rb_obj_public_methods(int argc, VALUE *argv, VALUE obj); /* in class.c */ - /* * call-seq: * obj.instance_variable_get(symbol) -> obj diff --git a/parse.y b/parse.y index 60e5a3b8b12999..59e5d8d3f1e3be 100644 --- a/parse.y +++ b/parse.y @@ -18,6 +18,7 @@ #include "ruby/ruby.h" #include "ruby/st.h" #include "ruby/encoding.h" +#include "internal.h" #include "node.h" #include "parse.h" #include "id.h" @@ -404,11 +405,6 @@ static ID *local_tbl_gen(struct parser_params*); static void fixup_nodes(NODE **); -extern int rb_dvar_defined(ID); -extern int rb_local_defined(ID); -extern int rb_parse_in_eval(void); -extern int rb_parse_in_main(void); - static VALUE reg_compile_gen(struct parser_params*, VALUE, int); #define reg_compile(str,options) reg_compile_gen(parser, (str), (options)) static void reg_fragment_setenc_gen(struct parser_params*, VALUE, int); @@ -5095,8 +5091,6 @@ parser_yyerror(struct parser_params *parser, const char *msg) static void parser_prepare(struct parser_params *parser); #ifndef RIPPER -VALUE ruby_suppress_tracing(VALUE (*func)(VALUE, int), VALUE arg, int always); - static VALUE debug_lines(const char *f) { @@ -9213,9 +9207,6 @@ dvar_curr_gen(struct parser_params *parser, ID id) } #ifndef RIPPER -VALUE rb_reg_compile(VALUE str, int options, const char *sourcefile, int sourceline); -VALUE rb_reg_check_preprocess(VALUE); - static void reg_fragment_setenc_gen(struct parser_params* parser, VALUE str, int options) { diff --git a/proc.c b/proc.c index f40e9daf10a129..7fae4f97edb20f 100644 --- a/proc.c +++ b/proc.c @@ -12,6 +12,7 @@ #include "eval_intern.h" #include "internal.h" #include "gc.h" +#include "iseq.h" struct METHOD { VALUE recv; @@ -25,8 +26,6 @@ VALUE rb_cMethod; VALUE rb_cBinding; VALUE rb_cProc; -VALUE rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc); - static VALUE bmcall(VALUE, VALUE); static int method_arity(VALUE); rb_iseq_t *rb_method_get_iseq(VALUE method); diff --git a/process.c b/process.c index d2592f55be4bde..7fdf31b0129548 100644 --- a/process.c +++ b/process.c @@ -14,6 +14,7 @@ #include "ruby/ruby.h" #include "ruby/io.h" #include "ruby/util.h" +#include "internal.h" #include "vm_core.h" #include @@ -39,8 +40,6 @@ #define EXIT_FAILURE 1 #endif -struct timeval rb_time_interval(VALUE); - #ifdef HAVE_SYS_WAIT_H # include #endif @@ -126,9 +125,6 @@ static VALUE rb_cProcessTms; do {int saved_errno = errno; stmts; errno = saved_errno;} while (0) -ssize_t rb_io_bufwrite(VALUE io, const void *buf, size_t size); -ssize_t rb_io_bufread(VALUE io, void *buf, size_t size); - /* * call-seq: * Process.pid -> fixnum diff --git a/range.c b/range.c index 1866df150750e7..aa5472df062478 100644 --- a/range.c +++ b/range.c @@ -11,12 +11,11 @@ #include "ruby/ruby.h" #include "ruby/encoding.h" +#include "internal.h" VALUE rb_cRange; static ID id_cmp, id_succ, id_beg, id_end, id_excl; -extern VALUE rb_struct_init_copy(VALUE copy, VALUE s); - #define RANGE_BEG(r) (RSTRUCT(r)->as.ary[0]) #define RANGE_END(r) (RSTRUCT(r)->as.ary[1]) #define RANGE_EXCL(r) (RSTRUCT(r)->as.ary[2]) diff --git a/rational.c b/rational.c index 00d71bf6417ba1..8dac978ca7aae0 100644 --- a/rational.c +++ b/rational.c @@ -6,6 +6,7 @@ */ #include "ruby.h" +#include "internal.h" #include #include diff --git a/re.c b/re.c index ec3fd70b4accec..9fdbf547aaf33f 100644 --- a/re.c +++ b/re.c @@ -13,6 +13,7 @@ #include "ruby/re.h" #include "ruby/encoding.h" #include "ruby/util.h" +#include "internal.h" #include "regint.h" #include @@ -314,8 +315,6 @@ rb_reg_check(VALUE re) } } -int rb_str_buf_cat_escaped_char(VALUE result, unsigned int c, int unicode_p); - static void rb_reg_expr_str(VALUE str, const char *s, long len, rb_encoding *enc, rb_encoding *resenc) diff --git a/ruby.c b/ruby.c index 4976ba185fe031..d93a908cc88698 100644 --- a/ruby.c +++ b/ruby.c @@ -17,6 +17,7 @@ #endif #include "ruby/ruby.h" #include "ruby/encoding.h" +#include "internal.h" #include "eval_intern.h" #include "dln.h" #include @@ -51,12 +52,6 @@ char *getenv(); #endif -VALUE rb_parser_get_yydebug(VALUE); -VALUE rb_parser_set_yydebug(VALUE, VALUE); - -const char *ruby_get_inplace_mode(void); -void ruby_set_inplace_mode(const char *); - #define DISABLE_BIT(bit) (1U << disable_##bit) enum disable_flag_bits { disable_gems, @@ -377,7 +372,6 @@ ruby_init_loadpath_safe(int safe_level) #elif defined(HAVE_DLADDR) Dl_info dli; if (dladdr((void *)(VALUE)expand_include_path, &dli)) { - VALUE rb_realpath_internal(VALUE basedir, VALUE path, int strict); char fbuf[MAXPATHLEN]; char *f = dln_find_file_r(dli.dli_fname, getenv(PATH_ENV), fbuf, sizeof(fbuf)); VALUE fname = rb_str_new_cstr(f ? f : dli.dli_fname); @@ -477,9 +471,6 @@ add_modules(VALUE *req_list, const char *mod) rb_ary_push(list, rb_obj_freeze(rb_str_new2(mod))); } -extern void Init_ext(void); -extern VALUE rb_vm_top_self(void); - static void require_libraries(VALUE *req_list) { @@ -568,8 +559,6 @@ process_sflag(int *sflag) } } -NODE *rb_parser_append_print(VALUE, NODE *); -NODE *rb_parser_while_loop(VALUE, NODE *, int, int); static long proc_options(long argc, char **argv, struct cmdline_options *opt, int envopt); static void @@ -1101,8 +1090,6 @@ proc_options(long argc, char **argv, struct cmdline_options *opt, int envopt) return argc0 - argc; } -void Init_prelude(void); - static void ruby_init_prelude(void) { @@ -1237,10 +1224,6 @@ rb_f_chomp(argc, argv) return str; } -void rb_stdio_set_default_encoding(void); -VALUE rb_parser_dump_tree(NODE *node, int comment); -VALUE rb_realpath_internal(VALUE basedir, VALUE path, int strict); - static VALUE process_options(int argc, char **argv, struct cmdline_options *opt) { diff --git a/string.c b/string.c index 672245748618e7..9a85f8149375cb 100644 --- a/string.c +++ b/string.c @@ -14,6 +14,7 @@ #include "ruby/ruby.h" #include "ruby/re.h" #include "ruby/encoding.h" +#include "internal.h" #include #define BEG(no) (regs->beg[(no)]) @@ -2053,8 +2054,6 @@ rb_str_append(VALUE str, VALUE str2) return rb_str_buf_append(str, str2); } -int rb_num_to_uint(VALUE val, unsigned int *ret); - /* * call-seq: * str << integer -> str @@ -7459,8 +7458,6 @@ sym_to_sym(VALUE sym) return sym; } -VALUE rb_funcall_passing_block(VALUE recv, ID mid, int argc, const VALUE *argv); - static VALUE sym_call(VALUE args, VALUE sym, int argc, VALUE *argv) { diff --git a/thread.c b/thread.c index 34068b0300d7a1..4ea9f7e09c7a10 100644 --- a/thread.c +++ b/thread.c @@ -66,7 +66,6 @@ static void sleep_timeval(rb_thread_t *th, struct timeval time); static void sleep_wait_for_interrupt(rb_thread_t *th, double sleepsec); static void sleep_forever(rb_thread_t *th, int nodeadlock); static double timeofday(void); -struct timeval rb_time_interval(VALUE); static int rb_threadptr_dead(rb_thread_t *th); static void rb_check_deadlock(rb_vm_t *vm); @@ -409,7 +408,6 @@ thread_cleanup_func(void *th_ptr, int atfork) extern void ruby_error_print(void); static VALUE rb_threadptr_raise(rb_thread_t *, int, VALUE *); -void rb_thread_recycle_stack_release(VALUE *); void ruby_thread_init_stack(rb_thread_t *th) @@ -997,8 +995,6 @@ rb_thread_interrupted(VALUE thval) return RUBY_VM_INTERRUPTED(th); } -struct timeval rb_time_timeval(VALUE); - void rb_thread_sleep(int sec) { @@ -2951,8 +2947,6 @@ rb_gc_save_machine_context(rb_thread_t *th) * */ -int rb_get_next_signal(void); - void rb_threadptr_check_signal(rb_thread_t *mth) { @@ -4024,7 +4018,6 @@ enum { }; static VALUE thread_suppress_tracing(rb_thread_t *th, int ev, VALUE (*func)(VALUE, int), VALUE arg, int always); -VALUE ruby_suppress_tracing(VALUE (*func)(VALUE, int), VALUE arg, int always); struct event_call_args { rb_thread_t *th; @@ -4562,8 +4555,6 @@ thread_suppress_tracing(rb_thread_t *th, int ev, VALUE (*func)(VALUE, int), VALU return result; } -VALUE rb_thread_backtrace(VALUE thval); - /* * call-seq: * thr.backtrace -> array diff --git a/time.c b/time.c index 20eea4728f6b46..0951e9a8a71281 100644 --- a/time.c +++ b/time.c @@ -14,6 +14,7 @@ #include #include #include "ruby/encoding.h" +#include "internal.h" #ifdef HAVE_UNISTD_H #include diff --git a/tool/compile_prelude.rb b/tool/compile_prelude.rb index 8ddf44edf13ec1..6ad9fce7daf5b6 100755 --- a/tool/compile_prelude.rb +++ b/tool/compile_prelude.rb @@ -83,6 +83,7 @@ def emit(outfile) sources: <%= @preludes.map {|n,*| prelude_base(n)}.join(', ') %> */ #include "ruby/ruby.h" +#include "internal.h" #include "vm_core.h" % preludes = @preludes.values.sort @@ -115,8 +116,6 @@ def emit(outfile) % end % unless preludes.empty? -VALUE rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE filepath, VALUE line, VALUE opt); - static void prelude_eval(VALUE code, VALUE name, VALUE line) { diff --git a/transcode.c b/transcode.c index 704c7404428b98..4d32cf705a488c 100644 --- a/transcode.c +++ b/transcode.c @@ -11,6 +11,7 @@ #include "ruby/ruby.h" #include "ruby/encoding.h" +#include "internal.h" #include "transcode_data.h" #include @@ -4299,8 +4300,6 @@ ecerr_incomplete_input(VALUE self) return rb_attr_get(self, rb_intern("incomplete_input")); } -extern void Init_newline(void); - /* * Document-class: Encoding::UndefinedConversionError * diff --git a/variable.c b/variable.c index 6bd08c03905191..2de5eccf934c76 100644 --- a/variable.c +++ b/variable.c @@ -19,9 +19,6 @@ #include "constant.h" #include "internal.h" -void rb_vm_change_state(void); -void rb_vm_inc_const_missing_count(void); - st_table *rb_global_tbl; st_table *rb_class_tbl; static ID autoload, classpath, tmp_classpath, classid; diff --git a/vm.c b/vm.c index f6a21c8b839014..eacc6740e3a221 100644 --- a/vm.c +++ b/vm.c @@ -12,6 +12,7 @@ #include "ruby/vm.h" #include "ruby/st.h" #include "ruby/encoding.h" +#include "internal.h" #include "gc.h" #include "vm_core.h" @@ -1662,8 +1663,6 @@ thread_recycle_struct(void) } #endif -void rb_gc_mark_machine_stack(rb_thread_t *th); - void rb_thread_mark(void *ptr) { @@ -1866,8 +1865,6 @@ rb_thread_alloc(VALUE klass) return self; } -VALUE rb_iseq_clone(VALUE iseqval, VALUE newcbase); - static void vm_define_method(rb_thread_t *th, VALUE obj, ID id, VALUE iseqval, rb_num_t is_singleton, NODE *cref) @@ -2151,9 +2148,6 @@ rb_vm_set_progname(VALUE filename) #if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE struct rb_objspace *rb_objspace_alloc(void); #endif -void ruby_thread_init_stack(rb_thread_t *th); - -extern void Init_native_thread(void); void Init_BareVM(void) diff --git a/vm_core.h b/vm_core.h index 98ec9b4c513f71..94025b953cd8cd 100644 --- a/vm_core.h +++ b/vm_core.h @@ -658,8 +658,11 @@ int rb_backtrace_each(rb_backtrace_iter_func *iter, void *arg); rb_control_frame_t *rb_vm_get_ruby_level_next_cfp(rb_thread_t *th, rb_control_frame_t *cfp); int rb_vm_get_sourceline(const rb_control_frame_t *); VALUE rb_name_err_mesg_new(VALUE obj, VALUE mesg, VALUE recv, VALUE method); +void rb_vm_stack_to_heap(rb_thread_t *th); +void ruby_thread_init_stack(rb_thread_t *th); NOINLINE(void rb_gc_save_machine_context(rb_thread_t *)); +void rb_gc_mark_machine_stack(rb_thread_t *th); #define sysstack_error GET_VM()->special_exceptions[ruby_error_sysstack]