ruby-changes:20109
From: akr <ko1@a...>
Date: Sat, 18 Jun 2011 07:43:59 +0900 (JST)
Subject: [ruby-changes:20109] akr:r32156 (trunk): * internal.h: declare internal functions here.
akr 2011-06-18 07:43:38 +0900 (Sat, 18 Jun 2011) New Revision: 32156 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32156 Log: * 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. Modified files: trunk/ChangeLog trunk/bignum.c trunk/class.c trunk/compile.c trunk/complex.c trunk/cont.c trunk/dir.c trunk/encoding.c trunk/enumerator.c trunk/error.c trunk/eval.c trunk/file.c trunk/gc.c trunk/hash.c trunk/inits.c trunk/internal.h trunk/io.c trunk/iseq.c trunk/iseq.h trunk/load.c trunk/marshal.c trunk/math.c trunk/node.h trunk/numeric.c trunk/object.c trunk/parse.y trunk/proc.c trunk/process.c trunk/range.c trunk/rational.c trunk/re.c trunk/ruby.c trunk/string.c trunk/thread.c trunk/time.c trunk/tool/compile_prelude.rb trunk/transcode.c trunk/variable.c trunk/vm.c trunk/vm_core.h Index: complex.c =================================================================== --- complex.c (revision 32155) +++ complex.c (revision 32156) @@ -6,6 +6,7 @@ */ #include "ruby.h" +#include "internal.h" #include <math.h> #define NDEBUG @@ -508,8 +509,6 @@ #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 @@ } #endif -extern VALUE rb_lcm(VALUE x, VALUE y); - /* * call-seq: * cmp.denominator -> integer Index: encoding.c =================================================================== --- encoding.c (revision 32155) +++ encoding.c (revision 32156) @@ -11,6 +11,7 @@ #include "ruby/ruby.h" #include "ruby/encoding.h" +#include "internal.h" #include "regenc.h" #include <ctype.h> #ifndef NO_LOCALE_CHARMAP Index: math.c =================================================================== --- math.c (revision 32155) +++ math.c (revision 32156) @@ -10,6 +10,7 @@ **********************************************************************/ #include "ruby/ruby.h" +#include "internal.h" #include <math.h> #include <errno.h> @@ -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);\ Index: time.c =================================================================== --- time.c (revision 32155) +++ time.c (revision 32156) @@ -14,6 +14,7 @@ #include <time.h> #include <errno.h> #include "ruby/encoding.h" +#include "internal.h" #ifdef HAVE_UNISTD_H #include <unistd.h> Index: ChangeLog =================================================================== --- ChangeLog (revision 32155) +++ ChangeLog (revision 32156) @@ -1,3 +1,26 @@ +Sat Jun 18 07:27:27 2011 Tanaka Akira <akr@f...> + + * 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 <mrkn@m...> * ext/bigdecimal/bigdecimal.c (VpNewRbClass): fix type of the 2nd Index: re.c =================================================================== --- re.c (revision 32155) +++ re.c (revision 32156) @@ -13,6 +13,7 @@ #include "ruby/re.h" #include "ruby/encoding.h" #include "ruby/util.h" +#include "internal.h" #include "regint.h" #include <ctype.h> @@ -314,8 +315,6 @@ } } -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) Index: enumerator.c =================================================================== --- enumerator.c (revision 32155) +++ enumerator.c (revision 32156) @@ -1018,8 +1018,6 @@ return obj; } -VALUE rb_obj_is_proc(VALUE proc); - /* :nodoc: */ static VALUE generator_initialize(int argc, VALUE *argv, VALUE obj) Index: variable.c =================================================================== --- variable.c (revision 32155) +++ variable.c (revision 32156) @@ -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; Index: vm_core.h =================================================================== --- vm_core.h (revision 32155) +++ vm_core.h (revision 32156) @@ -658,8 +658,11 @@ 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] Index: iseq.c =================================================================== --- iseq.c (revision 32155) +++ iseq.c (revision 32156) @@ -10,6 +10,7 @@ **********************************************************************/ #include "ruby/ruby.h" +#include "internal.h" /* #define RUBY_MARK_FREE_DEBUG 1 */ #include "gc.h" @@ -217,8 +218,6 @@ } } -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, Index: string.c =================================================================== --- string.c (revision 32155) +++ string.c (revision 32156) @@ -14,6 +14,7 @@ #include "ruby/ruby.h" #include "ruby/re.h" #include "ruby/encoding.h" +#include "internal.h" #include <assert.h> #define BEG(no) (regs->beg[(no)]) @@ -2053,8 +2054,6 @@ 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 @@ 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) { Index: object.c =================================================================== --- object.c (revision 32155) +++ object.c (revision 32156) @@ -1838,11 +1838,6 @@ 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 Index: iseq.h =================================================================== --- iseq.h (revision 32155) +++ iseq.h (revision 32156) @@ -24,6 +24,7 @@ /* 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 { Index: io.c =================================================================== --- io.c (revision 32155) +++ io.c (revision 32156) @@ -82,8 +82,6 @@ #include <sys/syscall.h> #endif -extern void Init_File(void); - #if defined(__BEOS__) || defined(__HAIKU__) # ifndef NOFILE # define NOFILE (OPEN_MAX) @@ -142,8 +140,6 @@ 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; /* $. */ Index: load.c =================================================================== --- load.c (revision 32155) +++ load.c (revision 32156) @@ -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 @@ } 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) Index: compile.c =================================================================== --- compile.c (revision 32155) +++ compile.c (revision 32156) @@ -10,6 +10,7 @@ **********************************************************************/ #include "ruby/ruby.h" +#include "internal.h" #include <math.h> #define USE_INSN_STACK_INCREASE 1 @@ -155,7 +156,6 @@ #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 Index: range.c =================================================================== --- range.c (revision 32155) +++ range.c (revision 32156) @@ -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]) Index: proc.c =================================================================== --- proc.c (revision 32155) +++ proc.c (revision 32156) @@ -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_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); Index: thread.c =================================================================== --- thread.c (revision 32155) +++ thread.c (revision 32156) @@ -66,7 +66,6 @@ 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 @@ 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 @@ return RUBY_VM_INTERRUPTED(th); } -struct timeval rb_time_timeval(VALUE); - void rb_thread_sleep(int sec) { @@ -2951,8 +2947,6 @@ * */ -int rb_get_next_signal(void); - void rb_threadptr_check_signal(rb_thread_t *mth) { @@ -4024,7 +4018,6 @@ }; 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 @@ return result; } -VALUE rb_thread_backtrace(VALUE thval); - /* * call-seq: * thr.backtrace -> array Index: dir.c =================================================================== --- dir.c (revision 32155) +++ dir.c (revision 32156) @@ -13,6 +13,7 @@ #include "ruby/ruby.h" #include "ruby/encoding.h" +#include "internal.h" #include <sys/types.h> #include <sys/stat.h> @@ -1996,8 +1997,6 @@ return Qfalse; } -VALUE rb_home_dir(const char *user, VALUE result); - /* * call-seq: * Dir.home() -> "/home/me" Index: eval.c =================================================================== --- eval.c (revision 32155) +++ eval.c (revision 32156) @@ -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 @@ /* 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 @@ GET_VM()->running = 1; } -extern void rb_clear_trace_func(void); - void * ruby_options(int argc, char **argv) { @@ -1053,9 +1046,6 @@ 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) { Index: gc.c =================================================================== --- gc.c (revision 32155) +++ gc.c (revision 32156) @@ -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 @@ #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 @@ #endif } -void rb_gc_mark_encodings(void); - static void gc_clear_mark_on_sweep_slots(rb_objspace_t *objspace) { Index: parse.y =================================================================== --- parse.y (revision 32155) +++ parse.y (revision 32156) @@ -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 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 @@ 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 @@ } #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) { Index: class.c =================================================================== --- class.c (revision 32155) +++ class.c (revision 32156) @@ -120,8 +120,6 @@ 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) { Index: process.c =================================================================== --- process.c (revision 32155) +++ process.c (revision 32156) @@ -14,6 +14,7 @@ #include "ruby/ruby.h" #include "ruby/io.h" #include "ruby/util.h" +#include "internal.h" #include "vm_core.h" #include <stdio.h> @@ -39,8 +40,6 @@ #define EXIT_FAILURE 1 #endif -struct timeval rb_time_interval(VALUE); - #ifdef HAVE_SYS_WAIT_H # include <sys/wait.h> #endif @@ -126,9 +125,6 @@ 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 Index: hash.c =================================================================== --- hash.c (revision 32155) +++ hash.c (revision 32156) @@ -690,8 +690,6 @@ return Qnil; } -VALUE rb_obj_is_proc(VALUE proc); - /* * call-seq: * hsh.default_proc = proc_obj -> proc_obj Index: error.c =================================================================== --- error.c (revision 32155) +++ error.c (revision 32156) @@ -12,6 +12,7 @@ #include "ruby/ruby.h" #include "ruby/st.h" #include "ruby/encoding.h" +#include "internal.h" #include "vm_core.h" #include <stdio.h> @@ -230,8 +231,6 @@ return Qnil; } -void rb_vm_bugreport(void); - static void report_bug(const char *file, int line, const char *fmt, va_list args) { Index: numeric.c =================================================================== --- numeric.c (revision 32155) +++ numeric.c (revision 32156) @@ -2445,8 +2445,6 @@ if (modp) *modp = mod; } -VALUE rb_big_fdiv(VALUE x, VALUE y); - /* * call-seq: * fix.fdiv(numeric) -> float @@ -2475,8 +2473,6 @@ } } -VALUE rb_rational_reciprocal(VALUE x); - static VALUE fix_divide(VALUE x, VALUE y, ID op) { Index: cont.c =================================================================== --- cont.c (revision 32155) +++ cont.c (revision 32156) @@ -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 @@ 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 @@ return cont; } -void rb_vm_stack_to_heap(rb_thread_t *th); - static VALUE cont_capture(volatile int *stat) { Index: internal.h =================================================================== --- internal.h (revision 32155) +++ internal.h (revision 32156) @@ -25,14 +25,129 @@ 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); +/* 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_int (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/